コード例 #1
0
        public void DrawGeometry(Brush brush, Shapes.Geometry geometry, float strokeWidth)
        {
            m_drawStateManagement.DrawPreamble();

            geometry.Draw(this, brush, strokeWidth);
        }
コード例 #2
0
        public void FillGeometry(Brush brush, Shapes.Geometry geometry)
        {
            m_drawStateManagement.DrawPreamble();

            geometry.Fill(this, brush);
        }
コード例 #3
0
 public void DrawRoundedRectangle(Brush brush, RoundedRectangleF rectangle, float strokeWidth)
 {
     DrawRoundedRectangle(brush, rectangle, strokeWidth, Matrix3x2.Identity, Matrix3x2.Identity);
 }
コード例 #4
0
        public void DrawRoundedRectangle(Brush brush, RoundedRectangleF rectangle, float strokeWidth, GeneralTransform transform)
        {
            var localTransform = transform.GetTransform();

            DrawRoundedRectangle(brush, rectangle, strokeWidth, Matrix3x2.Identity, localTransform);
        }
コード例 #5
0
        public void DrawRectangle(Brush brush, RectangleF rect, float strokeWidth, GeneralTransform transform)
        {
            var matrixTransform = transform.GetTransform();

            DrawRectangle(brush, rect, strokeWidth, Matrix3x2.Identity, matrixTransform);
        }
コード例 #6
0
        private void DrawRoundedRectangle(Brush brush, RoundedRectangleF rectangle, float strokeWidth, Matrix3x2 localTransform, Matrix3x2 worldTransform)
        {
            m_drawStateManagement.DrawPreamble();

            /* Save our state */
            PushState();

            /* Set our D2D render target to use the transform */
            D2DRenderTarget.InternalRenderTarget.Transform = worldTransform;

            /* Prepare our brush to be used */
            BrushHelper.PrepareBrush(brush, this, rectangle.GetBounds(), localTransform, worldTransform);

            D2DRenderTarget.InternalRenderTarget.DrawRoundedRectangle(brush.InternalBrush, rectangle.InternalRoundedRectangle, strokeWidth);

            /* Restore our state */
            PopState();
        }
コード例 #7
0
 /// <summary>
 /// Draws an ellipse on the DrawingLayer with the given brush
 /// </summary>
 /// <param name="brush">The brush to fill</param>
 /// <param name="ellipse">The ellipse area</param>
 /// <param name="strokeWidth">The width of the stroke</param>
 public void DrawEllipse(Brush brush, Shapes.Ellipse ellipse, float strokeWidth)
 {
     DrawEllipse(brush, ellipse, strokeWidth, Matrix3x2.Identity, Matrix3x2.Identity);
 }
コード例 #8
0
        /// <summary>
        /// Fills an opacity mask on the DrawingLayer
        /// </summary>
        /// <param name="brush">The brush containing the content to fill</param>
        /// <param name="mask">The opacity mask</param>
        /// <param name="sourceRect">The source rectangle to use</param>
        /// <param name="destinationRect">The destination rectangle to use</param>
        private void FillOpacityMaskInternal(Brush brush, SlimDX.Direct2D.Bitmap mask, RectangleF destinationRect, RectangleF sourceRect)
        {
            m_drawStateManagement.DrawPreamble();

            /* Save our state */
            PushState();

            /* Prepare our brush to be used */
            BrushHelper.PrepareBrush(brush, this, destinationRect, Matrix3x2.Identity, Matrix3x2.Identity);

            D2DRenderTarget.InternalRenderTarget.AntialiasMode = AntialiasMode.Aliased;

            D2DRenderTarget.InternalRenderTarget.FillOpacityMask(mask,
                                                                 brush.InternalBrush,
                                                                 OpacityMaskContent.Graphics,
                                                                 sourceRect.InternalRectangleF,
                                                                 destinationRect.InternalRectangleF);
            /* Restore our state */
            PopState();
        }
コード例 #9
0
        /// <summary>
        /// Fills an ellipse on the DrawingLayer with the given brush
        /// </summary>
        /// <param name="brush">The brush to fill</param>
        /// <param name="ellipse">The ellipse area</param>
        /// <param name="transform">The transformation to apply to the ellipse</param>
        public void FillEllipse(Brush brush, Shapes.Ellipse ellipse, GeneralTransform transform)
        {
            var worldTransform = transform.GetTransform();

            FillEllipse(brush, ellipse, Matrix3x2.Identity, worldTransform);
        }
コード例 #10
0
        /// <summary>
        /// Internal implementation to draw an ellipse
        /// </summary>
        /// <param name="brush">The brush to fill</param>
        /// <param name="ellipse">The ellipse area</param>
        /// <param name="strokeWidth">The width of the stroke</param>
        /// <param name="localTransform">The local transform</param>
        /// <param name="worldTransform">The world transform</param>
        private void DrawEllipse(Brush brush, Shapes.Ellipse ellipse, float strokeWidth, Matrix3x2 localTransform, Matrix3x2 worldTransform)
        {
            m_drawStateManagement.DrawPreamble();

            /* Save our state */
            PushState();

            /* Get the rectangular bounds of our ellipse */
            var bounds = ellipse.GetBounds();

            /* Set our D2D render target to use the transform */
            D2DRenderTarget.InternalRenderTarget.Transform = worldTransform;

            /* Prepare our brush to be used */
            BrushHelper.PrepareBrush(brush, this, bounds, localTransform, worldTransform);

            D2DRenderTarget.InternalRenderTarget.DrawEllipse(brush.InternalBrush,
                                                             ellipse.InternalEllipse,
                                                             strokeWidth);
            /* Restore our state */
            PopState();
        }
コード例 #11
0
 /// <summary>
 /// Fills an ellipse on the DrawingLayer with the given brush
 /// </summary>
 /// <param name="brush">The brush to fill</param>
 /// <param name="ellipse">The ellipse area</param>
 public void FillEllipse(Brush brush, Shapes.Ellipse ellipse)
 {
     FillEllipse(brush, ellipse, Matrix3x2.Identity, Matrix3x2.Identity);
 }
コード例 #12
0
        /// <summary>
        /// Fills a rounded rectangle on the DrawingLayer with the given brush
        /// </summary>
        /// <param name="brush">The brush to fill</param>
        /// <param name="rectangle">The rounded rectangle area</param>
        /// <param name="transform">The transformation to apply to the rounded rectangle</param>
        public void FillRoundedRectangle(Brush brush, RoundedRectangleF rectangle, GeneralTransform transform)
        {
            var localTransform = transform.GetTransform();

            FillRoundedRectangle(brush, rectangle, Matrix3x2.Identity, localTransform);
        }
コード例 #13
0
 /// <summary>
 /// Fills a rounded rectangle on the DrawingLayer with the given brush
 /// </summary>
 /// <param name="brush">The brush to fill</param>
 /// <param name="rectangle">The rounded rectangle area</param>
 public void FillRoundedRectangle(Brush brush, RoundedRectangleF rectangle)
 {
     FillRoundedRectangle(brush, rectangle, Matrix3x2.Identity, Matrix3x2.Identity);
 }
コード例 #14
0
 public void DrawText(Brush brush, string text, float x, float y)
 {
     DrawText(brush, text, x, y, 12);
 }
コード例 #15
0
        /// <summary>
        /// Draws an ellipse on the DrawingLayer with the given brush
        /// </summary>
        /// <param name="brush">The brush to fill</param>
        /// <param name="ellipse">The ellipse area</param>
        /// <param name="strokeWidth">The width of the stroke</param>
        /// <param name="transform">The transformation to apply to the ellipse</param>
        public void DrawEllipse(Brush brush, Shapes.Ellipse ellipse, float strokeWidth, GeneralTransform transform)
        {
            var matrixTransform = transform.GetTransform();

            DrawEllipse(brush, ellipse, strokeWidth, Matrix3x2.Identity, matrixTransform);
        }
コード例 #16
0
        public void DrawText(Brush brush, string text, float x, float y, float fontSize)
        {
            m_drawStateManagement.DrawPreamble();

            if (m_directWriteFactory == null)
            {
                m_directWriteFactory = new Factory(FactoryType.Isolated);
            }
            if (m_textFormat == null ||
                m_textFormat.FontSize != fontSize)
            {
                m_textFormat = new TextFormat(m_directWriteFactory, "Segoe UI", FontWeight.Bold, FontStyle.Normal, FontStretch.Normal, fontSize, "");
            }
            
            PushState();
            //var area2 = new RectangleF(0, 0, , );

            if (x > Width - 1 || y > Height - 1)
                return;

            var area = new RectangleF(x, y, Width, Height);

            var matrix = Matrix3x2.Identity;

            BrushHelper.PrepareBrush(brush, this, area, matrix, Matrix3x2.Identity);
 
            D2DRenderTarget.InternalRenderTarget.DrawText(text, 
                                                          m_textFormat,
                                                        area.InternalRectangleF,
                                                    brush.InternalBrush);
            

            PopState();
        }
コード例 #17
0
 /// <summary>
 /// Fills an opacity mask on the DrawingLayer
 /// </summary>
 /// <param name="brush">The brush containing the content to fill</param>
 /// <param name="mask">The opacity mask</param>
 /// <param name="sourceRect">The source rectangle to use</param>
 /// <param name="destinationRect">The destination rectangle to use</param>
 public void FillOpacityMask(Brush brush, DrawingLayer mask, RectangleF destinationRect, RectangleF sourceRect)
 {
     FillOpacityMaskInternal(brush, mask.D2DRenderTarget.InternalBitmap, destinationRect, sourceRect);
 }