/// <summary> /// Renders the fill of the <see cref="SvgVisualElement"/> to the specified <see cref="SvgRenderer"/> /// </summary> /// <param name="renderer">The <see cref="SvgRenderer"/> object to render to.</param> protected internal virtual void RenderFill(SvgRenderer renderer) { if (this.Fill != null) { using (Brush brush = this.Fill.GetBrush(this, this.FillOpacity)) { if (brush != null) { renderer.FillPath(brush, this.Path); } } } }
/// <summary> /// Renders the fill of the <see cref="SvgVisualElement"/> to the specified <see cref="SvgRenderer"/> /// </summary> /// <param name="renderer">The <see cref="SvgRenderer"/> object to render to.</param> protected internal virtual void RenderFill(SvgRenderer renderer) { if (this.Fill != null) { using (Brush brush = this.Fill.GetBrush(this, this.FillOpacity)) { if (brush != null) { this.Path.FillMode = this.FillRule == SvgFillRule.NonZero ? FillMode.Winding : FillMode.Alternate; renderer.FillPath(brush, this.Path); } } } }
/// <summary> /// Common code for rendering a marker once the orientation angle has been calculated /// </summary> /// <param name="fAngle"></param> /// <param name="pRenderer"></param> /// <param name="pOwner"></param> /// <param name="pMarkerPoint"></param> private void RenderPart2(float fAngle, SvgRenderer pRenderer, SvgPath pOwner, PointF pMarkerPoint) { Pen pRenderPen = CreatePen(pOwner, pRenderer); GraphicsPath markerPath = GetClone(pOwner); Matrix transMatrix = new Matrix(); transMatrix.Translate(pMarkerPoint.X, pMarkerPoint.Y); if (Orient.IsAuto) { transMatrix.Rotate(fAngle); } else { transMatrix.Rotate(Orient.Angle); } switch (MarkerUnits) { case SvgMarkerUnits.strokeWidth: transMatrix.Translate(AdjustForViewBoxWidth(-RefX.ToDeviceValue(pRenderer, UnitRenderingType.Horizontal, this) * pOwner.StrokeWidth.ToDeviceValue(pRenderer, UnitRenderingType.Other, this)), AdjustForViewBoxHeight(-RefY.ToDeviceValue(pRenderer, UnitRenderingType.Vertical, this) * pOwner.StrokeWidth.ToDeviceValue(pRenderer, UnitRenderingType.Other, this))); break; case SvgMarkerUnits.userSpaceOnUse: transMatrix.Translate(-RefX.ToDeviceValue(pRenderer, UnitRenderingType.Horizontal, this), -RefY.ToDeviceValue(pRenderer, UnitRenderingType.Vertical, this)); break; } markerPath.Transform(transMatrix); pRenderer.DrawPath(pRenderPen, markerPath); SvgPaintServer pFill = Fill; SvgFillRule pFillRule = FillRule; // TODO: What do we use the fill rule for? float fOpacity = FillOpacity; if (pFill != null) { Brush pBrush = pFill.GetBrush(this, pRenderer, fOpacity); pRenderer.FillPath(pBrush, markerPath); pBrush.Dispose(); } pRenderPen.Dispose(); markerPath.Dispose(); transMatrix.Dispose(); }