// Token: 0x06006DC8 RID: 28104 RVA: 0x001F8E30 File Offset: 0x001F7030
        internal static Cursor GetPointEraserCursor(StylusShape stylusShape, Matrix tranform, double dpiScaleX, double dpiScaleY)
        {
            DrawingAttributes drawingAttributes = new DrawingAttributes();

            if (stylusShape.GetType() == typeof(RectangleStylusShape))
            {
                drawingAttributes.StylusTip = StylusTip.Rectangle;
            }
            else
            {
                drawingAttributes.StylusTip = StylusTip.Ellipse;
            }
            drawingAttributes.Height = stylusShape.Height;
            drawingAttributes.Width  = stylusShape.Width;
            drawingAttributes.Color  = Colors.Black;
            if (!tranform.IsIdentity)
            {
                drawingAttributes.StylusTipTransform *= tranform;
            }
            if (!DoubleUtil.IsZero(stylusShape.Rotation))
            {
                Matrix identity = Matrix.Identity;
                identity.Rotate(stylusShape.Rotation);
                drawingAttributes.StylusTipTransform *= identity;
            }
            return(PenCursorManager.GetPenCursor(drawingAttributes, true, false, dpiScaleX, dpiScaleY));
        }
Example #2
0
        /// <summary>
        /// Create a point eraser cursor from StylusShape
        /// </summary>
        /// <param name="stylusShape">Eraser Shape</param>
        /// <param name="tranform">Transform</param>
        /// <returns></returns>
        internal static Cursor GetPointEraserCursor(StylusShape stylusShape, Matrix tranform, double dpiScaleX, double dpiScaleY)
        {
            Debug.Assert(DoubleUtil.IsZero(tranform.OffsetX) && DoubleUtil.IsZero(tranform.OffsetY), "The EraserShape cannot be translated.");
            Debug.Assert(tranform.HasInverse, "The transform has to be invertable.");

            // Create a DA with IsHollow being set. A point eraser will be rendered to a hollow stroke.
            DrawingAttributes da = new DrawingAttributes();

            if (stylusShape.GetType() == typeof(RectangleStylusShape))
            {
                da.StylusTip = StylusTip.Rectangle;
            }
            else
            {
                da.StylusTip = StylusTip.Ellipse;
            }

            da.Height = stylusShape.Height;
            da.Width  = stylusShape.Width;
            da.Color  = Colors.Black;

            if (!tranform.IsIdentity)
            {
                // Apply the LayoutTransform and/or RenderTransform
                da.StylusTipTransform *= tranform;
            }

            if (!DoubleUtil.IsZero(stylusShape.Rotation))
            {
                // Apply the tip rotation
                Matrix rotationMatrix = Matrix.Identity;
                rotationMatrix.Rotate(stylusShape.Rotation);
                da.StylusTipTransform *= rotationMatrix;
            }

            // Forward to GetPenCursor.
            return(GetPenCursor(da, true, false /*isRightToLeft*/, dpiScaleX, dpiScaleY));
        }