FillGeometry() публичный Метод

Paints the interior of the specified geometry.
If the opacityBrush parameter is not NULL, the alpha value of each pixel of the mapped opacityBrush is used to determine the resulting opacity of each corresponding pixel of the geometry. Only the alpha value of each color in the brush is used for this processing; all other color information is ignored. The alpha value specified by the brush is multiplied by the alpha value of the geometry after the geometry has been painted by brush. When this method fails, it does not return an error code. To determine whether a drawing operation (such as FillGeometry) failed, check the result returned by the EndDraw() or Flush() method.
public FillGeometry ( SharpDX geometry, SharpDX brush ) : void
geometry SharpDX The geometry to paint.
brush SharpDX The brush used to paint the geometry's interior.
Результат void
Пример #1
0
        /// <summary>
        /// Fills the given geometry.
        /// </summary>
        public void FillGeometry(Geometry2DResourceBase geometry, BrushResource brush)
        {
            if (m_renderTarget == null)
            {
                return;
            }

            geometry.EnsureNotNullOrDisposed(nameof(geometry));
            brush.EnsureNotNull(nameof(brush));

            m_renderTarget.FillGeometry(
                geometry.GetGeometry(),
                brush.GetBrush(m_device));
        }
Пример #2
0
        /// <summary>
        /// Draws a bitmap image.
        /// </summary>
        /// <param name="source">The bitmap image.</param>
        /// <param name="opacityMask">The opacity mask to draw with.</param>
        /// <param name="opacityMaskRect">The destination rect for the opacity mask.</param>
        /// <param name="destRect">The rect in the output to draw to.</param>
        public void DrawImage(IBitmapImpl source, IBrush opacityMask, Rect opacityMaskRect, Rect destRect)
        {
            using (var d2dSource = ((BitmapImpl)source).GetDirect2DBitmap(_renderTarget))
                using (var sourceBrush = new BitmapBrush(_renderTarget, d2dSource))
                    using (var d2dOpacityMask = CreateBrush(opacityMask, opacityMaskRect.Size))
                        using (var geometry = new SharpDX.Direct2D1.RectangleGeometry(_renderTarget.Factory, destRect.ToDirect2D()))
                        {
                            d2dOpacityMask.PlatformBrush.Transform = Matrix.CreateTranslation(opacityMaskRect.Position).ToDirect2D();

                            _renderTarget.FillGeometry(
                                geometry,
                                sourceBrush,
                                d2dOpacityMask.PlatformBrush);
                        }
        }
Пример #3
0
        /// <summary>
        /// Draws a geometry.
        /// </summary>
        /// <param name="brush">The fill brush.</param>
        /// <param name="pen">The stroke pen.</param>
        /// <param name="geometry">The geometry.</param>
        public void DrawGeometry(IBrush brush, Pen pen, Avalonia.Media.Geometry geometry)
        {
            if (brush != null)
            {
                using (var d2dBrush = CreateBrush(brush, geometry.Bounds.Size))
                {
                    if (d2dBrush.PlatformBrush != null)
                    {
                        var impl = (GeometryImpl)geometry.PlatformImpl;
                        _renderTarget.FillGeometry(impl.Geometry, d2dBrush.PlatformBrush);
                    }
                }
            }

            if (pen != null)
            {
                using (var d2dBrush = CreateBrush(pen.Brush, geometry.GetRenderBounds(pen.Thickness).Size))
                    using (var d2dStroke = pen.ToDirect2DStrokeStyle(_renderTarget))
                    {
                        if (d2dBrush.PlatformBrush != null)
                        {
                            var impl = (GeometryImpl)geometry.PlatformImpl;
                            _renderTarget.DrawGeometry(impl.Geometry, d2dBrush.PlatformBrush, (float)pen.Thickness, d2dStroke);
                        }
                    }
            }
        }
Пример #4
0
 public void RenderScatterGeometry(RenderTarget renderTarget)
 {
     double[] x = curve.X;
     double[] y = curve.Y;
     int length = x.Length;
     double xScale, xOffset, yScale, yOffset;
     xScale = graphToCanvas.Matrix.M11;
     xOffset = graphToCanvas.Matrix.OffsetX - this.xOffsetMarker;
     yScale = graphToCanvas.Matrix.M22;
     yOffset = graphToCanvas.Matrix.OffsetY - this.yOffsetMarker;
     bool[] include = curve.includeMarker;
     StrokeStyleProperties properties = new StrokeStyleProperties();
     properties.LineJoin = LineJoin.MiterOrBevel;
     StrokeStyle strokeStyle = new StrokeStyle(renderTarget.Factory, properties);
     for (int i = 0; i < length; ++i)
     {
         if (include[i])
         {
             renderTarget.Transform = (Matrix3x2)Matrix.Translation((float)(x[i] * xScale + xOffset), (float)(y[i] * yScale + yOffset), 0);
             renderTarget.FillGeometry(Geometry, FillBrush);
             renderTarget.DrawGeometry(Geometry, Brush, (float)StrokeThickness, strokeStyle);
         }
     }
     renderTarget.Transform = Matrix3x2.Identity;
 }
Пример #5
0
 public static void FillPolygon(this SharpDX.Direct2D1.RenderTarget target, ID2DBrush brush, FillMode fillMode, params PointF[] points)
 {
     if (points == null)
     {
         throw new ArgumentNullException(nameof(points));
     }
     if (points.Length == 0)
     {
         return;
     }
     using (var path = new PathGeometry(target.Factory)) {
         using (var sink = path.Open()) {
             sink.SetFillMode((SharpDX.Direct2D1.FillMode)fillMode);
             sink.BeginFigure(new RawVector2(points[0].X, points[0].Y), FigureBegin.Filled);
             var len = points.Length;
             for (var i = 1; i < len; ++i)
             {
                 var pt = points[i];
                 sink.AddLine(new RawVector2(pt.X, pt.Y));
             }
             sink.EndFigure(FigureEnd.Closed);
             sink.Close();
         }
         target.FillGeometry(path, brush.NativeBrush);
     }
 }
Пример #6
0
        internal static async Task Render(CompositionEngine compositionEngine, SharpDX.Direct2D1.RenderTarget renderTarget, FrameworkElement rootElement, Jupiter.Shapes.Path path)
        {
            var rect = path.GetBoundingRect(rootElement).ToSharpDX();
            var fill = await path.Fill.ToSharpDX(renderTarget, rect);

            var stroke = await path.Stroke.ToSharpDX(renderTarget, rect);

            //var layer = new D2D.Layer(renderTarget);
            //var layerParameters = new D2D.LayerParameters();
            //layerParameters.ContentBounds = rect;
            var oldTransform = renderTarget.Transform;

            renderTarget.Transform = new Matrix3x2(
                1, 0, 0, 1, rect.Left, rect.Top);
            //renderTarget.PushLayer(ref layerParameters, layer);

            var d2dGeometry = path.Data.ToSharpDX(compositionEngine.D2DFactory, rect);

            if (fill != null)
            {
                renderTarget.FillGeometry(d2dGeometry, fill, null);
            }

            if (stroke != null &&
                path.StrokeThickness > 0)
            {
                renderTarget.DrawGeometry(
                    d2dGeometry,
                    stroke,
                    (float)path.StrokeThickness,
                    path.GetStrokeStyle(compositionEngine.D2DFactory));
            }

            //if (path.StrokeThickness > 0 &&
            //    stroke != null)
            //{
            //    var halfThickness = (float)(path.StrokeThickness * 0.5);
            //    roundedRect.Rect = rect.Eroded(halfThickness);

            //    if (fill != null)
            //    {
            //        renderTarget.FillRoundedRectangle(roundedRect, fill);
            //    }

            //    renderTarget.DrawRoundedRectangle(
            //        roundedRect,
            //        stroke,
            //        (float)path.StrokeThickness,
            //        path.GetStrokeStyle(compositionEngine.D2DFactory));
            //}
            //else
            //{
            //    renderTarget.FillRoundedRectangle(roundedRect, fill);
            //}

            //renderTarget.PopLayer();
            renderTarget.Transform = oldTransform;
        }
            //---------------------------------------------------------------------------------------------------------
            /// <summary>
            /// Рисование арки
            /// </summary>
            //---------------------------------------------------------------------------------------------------------
            public override void Draw()
            {
                Direct2D.RenderTarget render_target = XDirect2DManager.D2DRenderTarget;

                if (mIsFilled)
                {
                    render_target.FillGeometry(mD2DGeometry, mFill.D2DBrush);
                }

                if (mIsStroked)
                {
                    render_target.DrawGeometry(mD2DGeometry, mStroke.Brush.D2DBrush, mStroke.Thickness, mStroke.mD2DStrokeStyle);
                }
            }
Пример #8
0
        public override Result DrawGlyphRun(object clientDrawingContext, float baselineOriginX, float baselineOriginY,
                                            D2D1.MeasuringMode measuringMode, DW.GlyphRun glyphRun, DW.GlyphRunDescription glyphRunDescription,
                                            ComObject clientDrawingEffect)
        {
            using (var pathGeometry = new D2D1.PathGeometry(_renderTarget.Factory))
            {
                using (var geometrySink = pathGeometry.Open())
                    using (var fontFace = glyphRun.FontFace)
                    {
                        if (glyphRun.Indices.Length > 0)
                        {
                            fontFace.GetGlyphRunOutline(
                                glyphRun.FontSize,
                                glyphRun.Indices,
                                glyphRun.Advances,
                                glyphRun.Offsets,
                                glyphRun.Indices.Length,
                                glyphRun.IsSideways,
                                glyphRun.BidiLevel % 2 != 0,
                                geometrySink
                                );
                        }
                        geometrySink.Close();
                    }

                var matrix = new Matrix3x2()
                {
                    M11 = 1,
                    M12 = 0,
                    M21 = 0,
                    M22 = 1,
                    M31 = baselineOriginX,
                    M32 = baselineOriginY
                };

                var sw = _renderTarget.StrokeWidth;
                using (var transformedGeometry =
                           new D2D1.TransformedGeometry(_renderTarget.Factory, pathGeometry, matrix))
                {
                    _renderTarget.StrokeWidth = _strokeWidth;
                    _renderTarget.DrawGeometry(transformedGeometry, _strokeBrush);
                    _renderTarget.FillGeometry(transformedGeometry, _fillBrush);
                }
                _renderTarget.StrokeWidth = sw;
            }

            return(SharpDX.Result.Ok);
        }
Пример #9
0
        public static void DrawPolygon(D2D1.RenderTarget renderTarget, D2D1.Factory factory, IPolygon pol, D2D1.Brush brush, D2D1.Brush pen, float penWidth, D2D1.StrokeStyle penStrokeStyle, bool clip, Map map)
        {
            if (pol.ExteriorRing == null)
            {
                return;
            }

            Vector2[] points;
            var       startPoint = TransformToImage(pol.ExteriorRing, map, out points);

            if (points.Length > 1)
            {
                using (var geom = new D2D1.PathGeometry(factory))
                {
                    using (var gs = geom.Open())
                    {
                        gs.SetFillMode(D2D1.FillMode.Alternate);

                        gs.BeginFigure(startPoint, D2D1.FigureBegin.Filled);
                        gs.AddLines(points);
                        gs.EndFigure(D2D1.FigureEnd.Closed);

                        for (var i = 0; i < pol.NumInteriorRings; i++)
                        {
                            startPoint = TransformToImage(pol.GetInteriorRingN(i), map, out points);
                            if (points.Length > 1)
                            {
                                gs.BeginFigure(startPoint, D2D1.FigureBegin.Filled);
                                gs.AddLines(points);
                                gs.EndFigure(D2D1.FigureEnd.Closed);
                            }
                        }

                        gs.Close();
                    }

                    if (brush != null)
                    {
                        renderTarget.FillGeometry(geom, brush);
                    }
                    if (pen != null)
                    {
                        renderTarget.DrawGeometry(geom, pen, penWidth, penStrokeStyle);
                    }
                }
            }
        }
Пример #10
0
        internal static void Render(CompositionEngine compositionEngine, SharpDX.Direct2D1.RenderTarget renderTarget, FrameworkElement rootElement, Border border)
        {
            var rect  = border.GetBoundingRect(rootElement).ToSharpDX();
            var brush = border.Background.ToSharpDX(renderTarget, rect);

            var geometry = GetBorderFillGeometry(compositionEngine, border, rect);

            //var layer = new Layer(renderTarget);
            //var layerParameters = new LayerParameters();
            //layerParameters.ContentBounds = rect;
            //renderTarget.PushLayer(ref layerParameters, layer);

            renderTarget.FillGeometry(geometry, brush);

            //renderTarget.PopLayer();

            compositionEngine.RenderChildren(renderTarget, rootElement, border);
        }
Пример #11
0
        internal static async Task Render(CompositionEngine compositionEngine, SharpDX.Direct2D1.RenderTarget renderTarget, FrameworkElement rootElement, Border border)
        {
            var rect  = border.GetBoundingRect(rootElement).ToSharpDX();
            var brush = await border.Background.ToSharpDX(renderTarget, rect);

            if (brush != null)
            {
                var geometry = GetBorderFillGeometry(compositionEngine, border, rect);

                var layer = border.CreateAndPushLayerIfNecessary(renderTarget, rootElement);

                renderTarget.FillGeometry(geometry, brush);

                if (layer != null)
                {
                    renderTarget.PopLayer();
                    layer.Dispose();
                }
            }

            await compositionEngine.RenderChildren(renderTarget, rootElement, border);
        }
Пример #12
0
        static void Main()
        {
            var form = new RenderForm("FUN STUFF PHYSXS");

            // SwapChain description
            var desc = new SwapChainDescription()
                           {
                               BufferCount = 1,
                               ModeDescription =
                                   new ModeDescription(form.ClientSize.Width, form.ClientSize.Height,
                                                       new Rational(60, 1), Format.R8G8B8A8_UNorm),
                               IsWindowed = true,
                               OutputHandle = form.Handle,
                               SampleDescription = new SampleDescription(1, 0),
                               SwapEffect = SwapEffect.Discard,
                               Usage = Usage.RenderTargetOutput
                           };

            // Create Device and SwapChain
            Device device;
            SwapChain swapChain;
            Device.CreateWithSwapChain(DriverType.Hardware, DeviceCreationFlags.BgraSupport, new SharpDX.Direct3D.FeatureLevel[] { SharpDX.Direct3D.FeatureLevel.Level_10_0 }, desc, out device, out swapChain);

            var d2dFactory = new SharpDX.Direct2D1.Factory();

            // Ignore all windows events
            Factory factory = swapChain.GetParent<Factory>();
            factory.MakeWindowAssociation(form.Handle, WindowAssociationFlags.IgnoreAll);

            // New RenderTargetView from the backbuffer
            Texture2D backBuffer = Texture2D.FromSwapChain<Texture2D>(swapChain, 0);
            var renderView = new RenderTargetView(device, backBuffer);

            Surface surface = backBuffer.QueryInterface<Surface>();

            var d2dRenderTarget = new RenderTarget(d2dFactory, surface,
                                                            new RenderTargetProperties(new PixelFormat(Format.Unknown, AlphaMode.Premultiplied)));

            var solidColorBrush = new SolidColorBrush(d2dRenderTarget, Color.White);

            var sim = new Simulation();

            // Main loop
            RenderLoop.Run(form, () =>
                                      {
                                          d2dRenderTarget.BeginDraw();

                                          int width = form.ClientSize.Width;
                                          int height = form.ClientSize.Height;
                                          var simScaleX = sim.SimBounds.MaxX - sim.SimBounds.MinX;
                                          var simScaleY = sim.SimBounds.MaxY - sim.SimBounds.MinY;
                                          var viewScaleX = sim.ViewBounds.MaxX - sim.ViewBounds.MinX;
                                          var viewScaleY = sim.ViewBounds.MaxY - sim.ViewBounds.MinY;

                                          d2dRenderTarget.Clear(Color.Black);
                                          foreach (Body body in sim.State)
                                          {
                                              var x = Convert.ToSingle((body.Pos.X - sim.SimBounds.MinX) * width / simScaleX);
                                              var y = Convert.ToSingle((body.Pos.Y - sim.SimBounds.MinY) * height / simScaleY);
                                              var xRad = Convert.ToSingle((body.Radius) * width / viewScaleX);
                                              var yRad = Convert.ToSingle((body.Radius) * height / viewScaleY);
                                              var elipse = new EllipseGeometry(d2dFactory, new Ellipse(new Vector2(x, y), xRad, yRad));
                                              d2dRenderTarget.FillGeometry(elipse, solidColorBrush, null);
                                          }

                                          d2dRenderTarget.EndDraw();

                                          sim.Step();
                                          swapChain.Present(0, PresentFlags.None);
                                      });

            // Release all resources
            renderView.Dispose();
            backBuffer.Dispose();
            device.ImmediateContext.ClearState();
            device.ImmediateContext.Flush();
            device.Dispose();
            device.Dispose();
            swapChain.Dispose();
            factory.Dispose();
        }
Пример #13
0
 public static void FillPath(this SharpDX.Direct2D1.RenderTarget target, ID2DBrush brush, D2DPathData path)
 {
     target.FillGeometry(path.NativeGeometry, brush.NativeBrush);
 }
Пример #14
0
        /// <summary>
        /// render the circle to specific render target of Direct2D1
        /// </summary>
        /// <param name="renderTarget"></param>
        public void Render2D(RenderTarget renderTarget, SharpDX.Direct2D1.Brush brush)
        {
            // check if the geometry is dirty
            if (isGeometryDirty)
            {
                // dispose the old geometry
                if (TriangleGeometry != null)
                {
                    TriangleGeometry.Dispose();
                }

                // create a new one
                TriangleGeometry = new PathGeometry(renderTarget.Factory);

                // fill the geometry struct
                using (GeometrySink Geo_Sink = TriangleGeometry.Open())
                {
                    // create the figure
                    Geo_Sink.BeginFigure(mp_P1, FigureBegin.Filled);
                    Geo_Sink.AddLine(mp_P2);
                    Geo_Sink.AddLine(mp_P3);
                    Geo_Sink.EndFigure(FigureEnd.Closed);

                    // close the mesh
                    Geo_Sink.Close();
                }

                // set the geometry that is the final
                isGeometryDirty = false;
            }

            // draw the wireframe of the triangle
            renderTarget.DrawGeometry(TriangleGeometry, brush, _LineWidth);

            if (fillTheTriangle)
            {
                // check if we must renew the brush
                if (fillColorDirty)
                {
                    // dispose the old brush
                    if (fillColorBrush != null)
                        fillColorBrush.Dispose();

                    // create the new one
                    fillColorBrush = new SolidColorBrush(renderTarget, fillColor);

                    // set that the color is the correct
                    fillColorDirty = false;
                }

                // fill the triangle
                renderTarget.FillGeometry(TriangleGeometry, fillColorBrush);
            }
        }
        public void DrawPath(IEnumerable <PathOp> ops, Pen pen = null, Brush brush = null)
        {
            var bb          = new BoundingBoxBuilder();
            var s           = new D2D1.PathGeometry(factories.D2DFactory);
            var figureDepth = 0;

            using (var sink = s.Open()) {
                foreach (var op in ops)
                {
                    if (op is MoveTo)
                    {
                        while (figureDepth > 0)
                        {
                            sink.EndFigure(D2D1.FigureEnd.Open);
                            figureDepth--;
                        }
                        var mt = ((MoveTo)op);
                        sink.BeginFigure(Conversions.ToVector2(mt.Point), D2D1.FigureBegin.Filled);
                        figureDepth++;
                        bb.Add(mt.Point);
                    }
                    else if (op is LineTo)
                    {
                        var lt = ((LineTo)op);
                        sink.AddLine(Conversions.ToVector2(lt.Point));
                        bb.Add(lt.Point);
                    }
                    else if (op is ArcTo)
                    {
                        var ar = ((ArcTo)op);
                        // TODO: Direct2D Arcs
                        //sink.AddArc (new D2D1.ArcSegment {
                        //	Size = Conversions.ToSize2F (ar.Radius),
                        //	Point = Conversions.ToVector2 (ar.Point),
                        //	SweepDirection = ar.SweepClockwise ? D2D1.SweepDirection.Clockwise : D2D1.SweepDirection.CounterClockwise,
                        //});
                        sink.AddLine(Conversions.ToVector2(ar.Point));
                        bb.Add(ar.Point);
                    }
                    else if (op is CurveTo)
                    {
                        var ct = ((CurveTo)op);
                        sink.AddBezier(new D2D1.BezierSegment {
                            Point1 = Conversions.ToVector2(ct.Control1),
                            Point2 = Conversions.ToVector2(ct.Control2),
                            Point3 = Conversions.ToVector2(ct.Point),
                        });
                        bb.Add(ct.Point);
                        bb.Add(ct.Control1);
                        bb.Add(ct.Control2);
                    }
                    else if (op is ClosePath)
                    {
                        sink.EndFigure(D2D1.FigureEnd.Closed);
                        figureDepth--;
                    }
                    else
                    {
                        // TODO: More path operations
                    }
                }
                while (figureDepth > 0)
                {
                    sink.EndFigure(D2D1.FigureEnd.Open);
                    figureDepth--;
                }
                sink.Close();
            }

            var p = GetBrush(pen);
            var b = GetBrush(bb.BoundingBox, brush);

            if (b != null)
            {
                renderTarget.FillGeometry(s, b);
            }
            if (p != null)
            {
                renderTarget.DrawGeometry(s, p, (float)pen.Width, GetStrokeStyle(pen));
            }
        }
Пример #16
0
        private static void Main()
        {
            var form = new RenderForm("SharpDX - MiniTri Direct2D - Direct3D 10 Sample");

            // SwapChain description
            var desc = new SwapChainDescription()
                           {
                               BufferCount = 1,
                               ModeDescription = 
                                   new ModeDescription(form.ClientSize.Width, form.ClientSize.Height,
                                                       new Rational(60, 1), Format.R8G8B8A8_UNorm),
                               IsWindowed = true,
                               OutputHandle = form.Handle,
                               SampleDescription = new SampleDescription(1, 0),
                               SwapEffect = SwapEffect.Discard,
                               Usage = Usage.RenderTargetOutput
                           };

            // Create Device and SwapChain
            Device1 device;
            SwapChain swapChain;
            Device1.CreateWithSwapChain(DriverType.Hardware, DeviceCreationFlags.BgraSupport, desc, FeatureLevel.Level_10_0, out device, out swapChain);

            var d2dFactory = new SharpDX.Direct2D1.Factory();

            int width = form.ClientSize.Width;
            int height = form.ClientSize.Height;

            var rectangleGeometry = new RoundedRectangleGeometry(d2dFactory, new RoundedRectangle() { RadiusX = 32, RadiusY = 32, Rect = new RectangleF(128, 128, width - 128 * 2, height-128 * 2) });

            // Ignore all windows events
            Factory factory = swapChain.GetParent<Factory>();
            factory.MakeWindowAssociation(form.Handle, WindowAssociationFlags.IgnoreAll);

            // New RenderTargetView from the backbuffer
            Texture2D backBuffer = Texture2D.FromSwapChain<Texture2D>(swapChain, 0);
            var renderView = new RenderTargetView(device, backBuffer);

            Surface surface = backBuffer.QueryInterface<Surface>();


            var d2dRenderTarget = new RenderTarget(d2dFactory, surface,
                                                            new RenderTargetProperties(new PixelFormat(Format.Unknown, AlphaMode.Premultiplied)));

            var solidColorBrush = new SolidColorBrush(d2dRenderTarget, Color.White);

            Stopwatch stopwatch = new Stopwatch();
            stopwatch.Start();

            // Main loop
            RenderLoop.Run(form, () =>
                                      {
                                          d2dRenderTarget.BeginDraw();
                                          d2dRenderTarget.Clear(Color.Black);
                                          solidColorBrush.Color = new Color4(1, 1, 1, (float)Math.Abs(Math.Cos(stopwatch.ElapsedMilliseconds * .001)));
                                          d2dRenderTarget.FillGeometry(rectangleGeometry, solidColorBrush, null);
                                          d2dRenderTarget.EndDraw();

                                          swapChain.Present(0, PresentFlags.None);
                                      });

            // Release all resources
            renderView.Dispose();
            backBuffer.Dispose();
            device.ClearState();
            device.Flush();
            device.Dispose();
            device.Dispose();
            swapChain.Dispose();
            factory.Dispose();
        }
Пример #17
0
        public override void Render(RenderTarget renderTarget)
        {
            if (!IsVisible) return;

            CurrentBorderBrush.Resource.Opacity = this.Opacity;
            CurrentBackgroundBrush.Resource.Opacity = this.Opacity;

            renderTarget.Transform = this.Transform;

            //TODO: Check if we need a second rect for this...
            renderTarget.PushAxisAlignedClip(this.ClippingRectangle, AntialiasMode.Aliased);

            try {
                if (DrawBackground) {
                    renderTarget.FillGeometry(_backgroundGeometry, CurrentBackgroundBrush.Resource);
                    //if (CurrentBitmap != null)
                    //	renderTarget.DrawBitmap(CurrentBitmap.Resource, Opacity, BitmapInterpolationMode.Linear);
                }

                if (DrawBorder)
                    renderTarget.DrawGeometry(_backgroundGeometry, CurrentBorderBrush.Resource);

                if (DrawText && !String.IsNullOrEmpty(_text))
                    renderTarget.DrawTextLayout(new DrawingPointF(TextIndent, 0f), RenderedText, CurrentFontBrush.Resource);

                base.Render(renderTarget);
            } finally {
                renderTarget.PopAxisAlignedClip();
            }
        }