Ejemplo n.º 1
0
GraphicsPath* GdipCreateRoundRect( RectF& rect, int nRadiusLT, int nRadiusRT, int nRadiusRB, int nRadiusLB )
{
	GraphicsPath roundRect;
	if( nRadiusLT == 0 )
		roundRect.AddLine( rect.GetLeft(), rect.GetTop(), rect.GetRight() - (nRadiusRT<<1), rect.GetTop() );
	else
		roundRect.AddArc( RectF(rect.GetLeft(), rect.GetTop(), (float)(nRadiusLT<<1), (float)(nRadiusLT<<1)), 180, 90 );

	if( nRadiusRT == 0 )
		roundRect.AddLine( rect.GetRight(), rect.GetTop(), rect.GetRight(), rect.GetBottom()-(float)(nRadiusRB<<1) );
	else
		roundRect.AddArc( RectF(rect.GetRight() - (float)(nRadiusRT<<1), rect.GetTop(), (float)(nRadiusRT<<1), (float)(nRadiusRT<<1)), 270, 90 );

	if( nRadiusRB == 0 )
		roundRect.AddLine( rect.GetRight(), rect.GetBottom(), rect.GetLeft()-(float)(nRadiusLB<<1), rect.GetBottom() );
	else
		roundRect.AddArc( RectF(rect.GetRight() - (float)(nRadiusRB<<1), rect.GetBottom() -(float)(nRadiusRB<<1), (float)(nRadiusRB<<1), (float)(nRadiusRB<<1)), 0, 90 );

	if( nRadiusLB == 0 )
		roundRect.AddLine( rect.GetLeft(), rect.GetBottom(), rect.GetLeft(), rect.GetTop()-(float)(nRadiusLT<<1) );
	else
		roundRect.AddArc( RectF(rect.GetLeft(), rect.GetBottom() -(float)(nRadiusLB<<1), (float)(nRadiusLB<<1), (float)(nRadiusLB<<1)), 90, 90 );

	roundRect.CloseFigure();

	return roundRect.Clone();
}
Ejemplo n.º 2
0
void ProcessDateTime::DrawOutlineText(Graphics *graphics,
	Font &font,
	const GraphicsPath &path,
	const StringFormat &format,
	const Brush *brush)
{

	GraphicsPath *outlinePath;

	outlinePath = path.Clone();

	// Outline color and size
	UINT tmpOpacity = (UINT)((((float)opacity * 0.01f) * ((float)outlineOpacity * 0.01f)) * 100.0f);
	Pen pen(Gdiplus::Color(GetAlphaVal(tmpOpacity) | (outlineColor & 0xFFFFFF)), outlineSize);
	pen.SetLineJoin(Gdiplus::LineJoinRound);

	// Widen the outline
	// It seems that Widen has a huge performance impact on DrawPath call, screw it! We're talking about freaking seconds in some extreme cases...
	//outlinePath->Widen(&pen);

	// Draw the outline
	graphics->DrawPath(&pen, outlinePath);

	// Draw the text        
	graphics->FillPath(brush, &path);

	delete outlinePath;
}
Ejemplo n.º 3
0
GraphicsPath* GdipCreateRoundRect( RectF& rect, int nRadius )
{
	GraphicsPath roundRect;
	float fDiameter = nRadius * 2.f;
	RectF arcRect( 0.f, 0.f, fDiameter, fDiameter );

	arcRect.X = rect.GetLeft();
	arcRect.Y = rect.GetTop();
	roundRect.AddArc(arcRect, 180, 90);
	arcRect.X = rect.GetRight() - fDiameter;
	roundRect.AddArc(arcRect, 270, 90);
	arcRect.Y = rect.GetBottom() - fDiameter;
	roundRect.AddArc(arcRect, 0, 90);
	arcRect.X = rect.GetLeft();
	roundRect.AddArc(arcRect, 90, 90);
	roundRect.CloseFigure();

	return roundRect.Clone();
}
Ejemplo n.º 4
0
GraphicsPath* GdipCreateRoundRect( Rect& rect, int nRadius )
{
	GraphicsPath roundRect;
	int nDiameter = nRadius << 1;
	Rect arcRect( 0, 0, nDiameter, nDiameter );

	arcRect.X = rect.GetLeft();
	arcRect.Y = rect.GetTop();
	roundRect.AddArc(arcRect, 180, 90);
	arcRect.X = rect.GetRight() - nDiameter;
	roundRect.AddArc(arcRect, 270, 90);
	arcRect.Y = rect.GetBottom() - nDiameter;
	roundRect.AddArc(arcRect, 0, 90);
	arcRect.X = rect.GetLeft();
	roundRect.AddArc(arcRect, 90, 90);
	roundRect.CloseFigure();

	return roundRect.Clone();
}