예제 #1
0
        public override void DrawGeometry(Brush brush, Pen pen, Geometry geometry)
        {
            Direct2D1StreamGeometry platformGeometry = (Direct2D1StreamGeometry)geometry.PlatformImpl;
            PathGeometry            d2dGeometry      = platformGeometry.Direct2DGeometry;

            if (brush != null)
            {
                this.target.FillGeometry(d2dGeometry, brush.ToSharpDX(this.target));
            }

            if (pen != null)
            {
                this.target.DrawGeometry(
                    d2dGeometry,
                    pen.Brush.ToSharpDX(this.target),
                    (float)pen.Thickness);
            }
        }
예제 #2
0
        public override void DrawGeometry(Brush brush, Pen pen, Geometry geometry, Avalonia.Media.Matrix transform)
        {
            Direct2D1StreamGeometry platformGeometry = (Direct2D1StreamGeometry)geometry.PlatformImpl;

            using (TransformedGeometry d2dGeometry = new TransformedGeometry(
                       this.factory,
                       platformGeometry.Direct2DGeometry,
                       transform.ToSharpDX()))
            {
                if (brush != null)
                {
                    this.target.FillGeometry(d2dGeometry, brush.ToSharpDX(this.target));
                }

                if (pen != null)
                {
                    this.target.DrawGeometry(
                        d2dGeometry,
                        pen.Brush.ToSharpDX(this.target),
                        (float)pen.Thickness);
                }
            }
        }