コード例 #1
0
        public override void DrawRoundedRectangle(Brush brush, Pen pen, Rect rectangle, double radiusX, double radiusY)
        {
            RoundedRectangle roundedRect = new RoundedRectangle
            {
                Rect    = rectangle.ToSharpDX(),
                RadiusX = (float)radiusX,
                RadiusY = (float)radiusY,
            };

            if (brush != null)
            {
                using (var brush2D = brush.ToSharpDX(this.target))
                {
                    this.target.FillRoundedRectangle(roundedRect, brush2D);
                }
            }

            if (pen != null)
            {
                using (var brush2D = pen.Brush.ToSharpDX(this.target))
                {
                    this.target.DrawRoundedRectangle(roundedRect, brush2D, (float)pen.Thickness);
                }
            }
        }
コード例 #2
0
ファイル: FormattedText.cs プロジェクト: modulexcite/Avalonia
 public FormattedText(
     string textToFormat,
     CultureInfo culture,
     FlowDirection flowDirection,
     Typeface typeface,
     double emSize,
     Brush foreground)
 {
     this.Foreground = foreground;
     this.PlatformImpl = PlatformInterface.Instance.CreateFormattedText(
         textToFormat, 
         typeface, 
         emSize);
     this.Text = textToFormat;
 }
コード例 #3
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);
            }
        }
コード例 #4
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);
            }
        }
コード例 #5
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);
                }
            }
        }
コード例 #6
0
        public override void DrawRectangle(Brush brush, Pen pen, Rect rectangle)
        {
            if (brush != null)
            {
                using (var brush2D = brush.ToSharpDX(this.target))
                {
                    this.target.FillRectangle(
                        rectangle.ToSharpDX(),
                        brush2D);
                }
            }

            if (pen != null)
            {
                using (var brush2D = pen.Brush.ToSharpDX(this.target))
                {
                    this.target.DrawRectangle(
                        rectangle.ToSharpDX(),
                        brush2D,
                        (float)pen.Thickness);
                }
            }
        }
コード例 #7
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);
                }
            }
        }
コード例 #8
0
ファイル: Pen.cs プロジェクト: modulexcite/Avalonia
 public Pen(Brush brush, double thickness)
 {
     this.Brush = brush;
     this.Thickness = thickness;
 }
コード例 #9
0
 public abstract void DrawRoundedRectangle(Brush brush, Pen pen, Rect rectangle, double radiusX, double radiusY);
コード例 #10
0
 public abstract void DrawRectangle(Brush brush, Pen pen, Rect rectangle);
コード例 #11
0
 public abstract void DrawGeometry(Brush brush, Pen pen, Geometry geometry, Matrix transform);
コード例 #12
0
 public abstract void DrawGeometry(Brush brush, Pen pen, Geometry geometry);
コード例 #13
0
        public override void DrawRoundedRectangle(Brush brush, Pen pen, Rect rectangle, double radiusX, double radiusY)
        {
            RoundedRectangle roundedRect = new RoundedRectangle
            {
                Rect = rectangle.ToSharpDX(),
                RadiusX = (float)radiusX,
                RadiusY = (float)radiusY,
            };

            if (brush != null)
            {
                using (var brush2D = brush.ToSharpDX(this.target))
                {
                    this.target.FillRoundedRectangle(roundedRect, brush2D);
                }
            }

            if (pen != null)
            {
                using (var brush2D = pen.Brush.ToSharpDX(this.target))
                {
                    this.target.DrawRoundedRectangle(roundedRect, brush2D, (float)pen.Thickness);
                }
            }
        }
コード例 #14
0
        public override void DrawRectangle(Brush brush, Pen pen, Rect rectangle)
        {
            if (brush != null)
            {
                using (var brush2D = brush.ToSharpDX(this.target))
                {
                    this.target.FillRectangle(
                        rectangle.ToSharpDX(),
                        brush2D);
                }
            }

            if (pen != null)
            {
                using (var brush2D = pen.Brush.ToSharpDX(this.target))
                {
                    this.target.DrawRectangle(
                        rectangle.ToSharpDX(),
                        brush2D,
                        (float)pen.Thickness);
                }
            }
        }