Пример #1
0
void DrawNode (STopologyMapCtx &Ctx, COutputChart &Output, CTopologyNode *pNode, int x, int y)

//	DrawNode
//
//	Draws a topology node

	{
	CG16bitImage &Dest = Output.GetOutputImage();
	const CG16bitFont &NameFont = Output.GetStyleFont(STYLE_NAME);
	WORD wNameColor = Output.GetStyleColor(STYLE_NAME);

	DrawAlphaGradientCircle(Dest, x + 2, y + 2, NODE_RADIUS + 1, 0);
	DrawFilledCircle(Dest, x, y, NODE_RADIUS, NODE_COLOR);
	DrawAlphaGradientCircle(Dest, x - 2, y - 2, NODE_RADIUS - 3, CG16bitImage::RGBValue(255, 255, 255));

	NameFont.DrawText(Dest,
			x, y + NODE_RADIUS + 2,
			wNameColor,
			255,
			pNode->GetSystemName(),
			CG16bitFont::AlignCenter);
	}
Пример #2
0
void CFlarePainter::Paint (CG16bitImage &Dest, int x, int y, SViewportPaintCtx &Ctx)

//	Paint
//
//	Paint

	{
	int i;
	COLORREF wPrimaryColor = m_pCreator->GetPrimaryColor();

	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)m_pCreator->GetLifetime()));
			else
				iRadius = 0;

			//	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);

					CG16bitRegion Region;
					Region.CreateFromConvexPolygon(4, Spike);
					Region.FillTrans(Dest, x, y, wPrimaryColor, 128);
					}

				//	Paint central glow

#if 0
				DrawAlphaGradientCircle(Dest,
						x,
						y,
						iRadius / 8,
						wPrimaryColor);
#endif

				//	Paint the extended glow

				DrawAlphaGradientCircle(Dest,
						x,
						y,
						iRadius,
						wPrimaryColor);
				}

			break;
			}
		}
	}
Пример #3
0
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);

					CG16bitRegion 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;
			}
		}
	}