void CFlarePainter::PaintFlare (CG32bitImage &Dest, int x, int y, int iRadius, CG32bitPixel rgbColor, bool bSpikes, SViewportPaintCtx &Ctx) // PaintFlare // // Paints a flare { int i; if (iRadius > 0) { // Paint each of the spikes first if (bSpikes) { int iAngle = 360 / MAIN_SPIKE_COUNT; for (i = 0; i < MAIN_SPIKE_COUNT; i++) { SPoint Spike[4]; m_pCreator->CreateFlareSpike(i * iAngle, iRadius, iRadius / MAIN_SPIKE_WIDTH_RATIO, Spike); CG16bitBinaryRegion Region; Region.CreateFromSimplePolygon(4, Spike); Region.Fill(Dest, x, y, CG32bitPixel(rgbColor, MAIN_SPIKE_OPACITY)); } } // Paint the extended glow CGDraw::CircleGradient(Dest, x, y, iRadius, rgbColor); } }
void CFlarePainter::Paint (CG16bitImage &Dest, int x, int y, SViewportPaintCtx &Ctx) // Paint // // Paint { int i; // Safety checks int iTotalLifetime = m_pCreator->GetLifetime(); if (iTotalLifetime <= 0) return; switch (m_pCreator->GetStyle()) { case CFlareEffectCreator::styleFadingBlast: { // Radius shrinks proportionally each tick int iRadius; if (m_iTick < m_pCreator->GetLifetime()) iRadius = (int)(m_pCreator->GetRadius() * ((Metric)(m_pCreator->GetLifetime() - m_iTick) / (Metric)iTotalLifetime)); else iRadius = 0; // Color moves from primary to secondary WORD wColor; if (m_pCreator->GetPrimaryColor() != m_pCreator->GetSecondaryColor()) wColor = CG16bitImage::FadeColor(m_pCreator->GetPrimaryColor(), m_pCreator->GetSecondaryColor(), 100 * m_iTick / iTotalLifetime); else wColor = m_pCreator->GetPrimaryColor(); // Paint if (iRadius) { // Paint each of the spikes first int iAngle = 360 / MAIN_SPIKE_COUNT; for (i = 0; i < MAIN_SPIKE_COUNT; i++) { SPoint Spike[4]; m_pCreator->CreateFlareSpike(i * iAngle, iRadius, iRadius / MAIN_SPIKE_WIDTH_RATIO, Spike); CG16bitBinaryRegion Region; Region.CreateFromSimplePolygon(4, Spike); Region.FillTrans(Dest, x, y, wColor, MAIN_SPIKE_OPACITY); } // Paint the extended glow DrawAlphaGradientCircle(Dest, x, y, iRadius, wColor); } break; } } }