protected void PerformLayoutBackground(RectangleF innerBorderRect, RenderContext context) { // Setup background brush if (Background != null) { // TODO: Draw background only in the inner rectangle (outer rect minus BorderThickness) using (GraphicsPath path = CreateBorderRectPath(innerBorderRect)) { // Some backgrounds might not be closed (subclasses sometimes create open background shapes, // for example GroupBox). To create a completely filled background, we need a closed figure. path.CloseFigure(); PositionColoredTextured[] verts; float centerX, centerY; PointF[] pathPoints = path.PathPoints; TriangulateHelper.CalcCentroid(pathPoints, out centerX, out centerY); TriangulateHelper.FillPolygon_TriangleList(pathPoints, centerX, centerY, 1, out verts); Background.SetupBrush(this, ref verts, context.ZOrder, true); PrimitiveBuffer.SetPrimitiveBuffer(ref _backgroundContext, ref verts, PrimitiveType.TriangleList); } } else { PrimitiveBuffer.DisposePrimitiveBuffer(ref _backgroundContext); } }
protected override void DoPerformLayout(RenderContext context) { base.DoPerformLayout(context); // Setup brushes if (Fill != null || (Stroke != null && StrokeThickness > 0)) { using (GraphicsPath path = GetEllipse(_innerRect.ToDrawingRectF())) { PositionColoredTextured[] verts; float centerX; float centerY; PointF[] pathPoints = path.PathPoints; TriangulateHelper.CalcCentroid(pathPoints, out centerX, out centerY); if (Fill != null) { TriangulateHelper.FillPolygon_TriangleList(pathPoints, centerX, centerY, 1, out verts); Fill.SetupBrush(this, ref verts, context.ZOrder, true); PrimitiveBuffer.SetPrimitiveBuffer(ref _fillContext, ref verts, PrimitiveType.TriangleList); } else { PrimitiveBuffer.DisposePrimitiveBuffer(ref _fillContext); } if (Stroke != null && StrokeThickness > 0) { TriangulateHelper.TriangulateStroke_TriangleList(pathPoints, (float)StrokeThickness, true, 1, PenLineJoin.Bevel, out verts); Stroke.SetupBrush(this, ref verts, context.ZOrder, true); PrimitiveBuffer.SetPrimitiveBuffer(ref _strokeContext, ref verts, PrimitiveType.TriangleList); } else { PrimitiveBuffer.DisposePrimitiveBuffer(ref _strokeContext); } } } }
protected override void DoPerformLayout(RenderContext context) { base.DoPerformLayout(context); if (Stroke != null && StrokeThickness > 0) { using (GraphicsPath path = GetLine(_innerRect)) { float centerX; float centerY; PointF[] pathPoints = path.PathPoints; TriangulateHelper.CalcCentroid(pathPoints, out centerX, out centerY); PositionColoredTextured[] verts; TriangulateHelper.FillPolygon_TriangleList(pathPoints, centerX, centerY, 1, out verts); Stroke.SetupBrush(this, ref verts, context.ZOrder, true); PrimitiveBuffer.SetPrimitiveBuffer(ref _strokeContext, ref verts, PrimitiveType.TriangleList); } } else { PrimitiveBuffer.DisposePrimitiveBuffer(ref _strokeContext); } }