Beispiel #1
0
        public static void DrawGeometry(this ID2D1RenderTarget renderTarget,
                                        ID2D1Geometry geometry,
                                        ID2D1Brush brush,
                                        float strokeWidth,
                                        ID2D1StrokeStyle strokeStyle = null)
        {
            if (renderTarget == null)
            {
                throw new ArgumentNullException(nameof(renderTarget));
            }

            if (brush == null)
            {
                throw new ArgumentNullException(nameof(brush));
            }

            renderTarget.DrawGeometry(geometry, brush, strokeWidth, strokeStyle);
        }
 internal D2D1StrokeStyle(ID2D1StrokeStyle strokeStyle)
 {
     this.strokeStyle = strokeStyle;
 }
Beispiel #3
0
        public static void DrawRectangle(this ID2D1RenderTarget context, D2D_RECT_F rect, ID2D1Brush brush, float strokeWidth, ID2D1StrokeStyle strokeStyle = null)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            if (brush == null)
            {
                throw new ArgumentNullException(nameof(brush));
            }

            context.DrawRectangle(ref rect, brush, strokeWidth, strokeStyle);
        }
Beispiel #4
0
        public static void DrawEllipse(this ID2D1RenderTarget context, D2D1_ELLIPSE ellipse, ID2D1Brush brush, float strokeWidth, ID2D1StrokeStyle strokeStyle = null)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            if (brush == null)
            {
                throw new ArgumentNullException(nameof(brush));
            }

            context.DrawEllipse(ref ellipse, brush, strokeWidth, strokeStyle);
        }
 /// <summary>
 /// Draws the outline of the specified rounded rectangle using the specified stroke style.
 /// </summary>
 /// <param name="roundedRect">The dimensions of the rounded rectangle to draw, in device-independent pixels.</param>
 /// <param name="brush">The brush used to paint the rounded rectangle's outline.</param>
 /// <param name="strokeWidth">The width of the rounded rectangle's stroke. The stroke is centered on the rounded rectangle's outline. The default value is 1.0f.</param>
 /// <param name="strokeStyle">The style of the rounded rectangle's stroke, or NULL to paint a solid stroke. The default value is NULL. </param>
 public void DrawRoundedRectangle(RoundedRectangle roundedRect, ID2D1Brush brush, float strokeWidth, ID2D1StrokeStyle strokeStyle)
 {
     DrawRoundedRectangle(ref roundedRect, brush, strokeWidth, strokeStyle);
 }
Beispiel #6
0
        public static void DrawLine(this ID2D1RenderTarget context, D2D_POINT_2F point0, D2D_POINT_2F point1, ID2D1Brush brush, float strokeWidth, ID2D1StrokeStyle strokeStyle = null)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            if (brush == null)
            {
                throw new ArgumentNullException(nameof(brush));
            }

            context.DrawLine(point0, point1, brush, strokeWidth, strokeStyle);
        }
Beispiel #7
0
 /// <summary>
 /// Widens the geometry by the specified stroke and writes the result to an <see cref="ID2D1SimplifiedGeometrySink"/> after it has been transformed by the specified matrix and flattened using the specified tolerance.
 /// </summary>
 /// <param name="strokeWidth">The amount by which to widen the geometry.</param>
 /// <param name="strokeStyle">The style of stroke to apply to the geometry, or NULL.</param>
 /// <param name="flatteningTolerance">The maximum bounds on the distance between points in the polygonal approximation of the geometry. Smaller values produce more accurate results but cause slower execution.</param>
 /// <param name="geometrySink">The <see cref="ID2D1SimplifiedGeometrySink"/> to which the widened geometry is appended.</param>
 /// <returns>If the method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.</returns>
 /// <unmanaged>HRESULT Widen([None] FLOAT strokeWidth,[In, Optional] ID2D1StrokeStyle* strokeStyle,[In, Optional] const D2D1_MATRIX_3X2_F* worldTransform,[None] FLOAT flatteningTolerance,[In] ID2D1SimplifiedGeometrySink* geometrySink)</unmanaged>
 public void Widen(float strokeWidth, ID2D1StrokeStyle strokeStyle, float flatteningTolerance, ID2D1GeometrySink geometrySink)
 {
     Widen(strokeWidth, strokeStyle, null, flatteningTolerance, geometrySink);
 }
 internal D2D1StrokeStyle(ID2D1StrokeStyle strokeStyle)
 {
     this.strokeStyle = strokeStyle;
 }
Beispiel #9
0
 /// <summary>
 /// Determines whether the geometry's stroke contains the specified point given the specified stroke thickness, style, and transform.
 /// </summary>
 /// <param name="point">The point to test for containment. </param>
 /// <param name="strokeWidth">The thickness of the stroke to apply. </param>
 /// <param name="strokeStyle">The style of stroke to apply. </param>
 /// <param name="transform">The transform to apply to the stroked geometry.  </param>
 /// <param name="flatteningTolerance">The numeric accuracy with which the precise geometric path and path intersection is calculated. Points missing the stroke by less than the tolerance are still considered inside.  Smaller values produce more accurate results but cause slower execution. </param>
 /// <returns>When this method returns, contains a boolean value set to true if the geometry's stroke contains the specified point; otherwise, false. You must allocate storage for this parameter. </returns>
 /// <unmanaged>HRESULT ID2D1Geometry::StrokeContainsPoint([None] D2D1_POINT_2F point,[None] float strokeWidth,[In, Optional] ID2D1StrokeStyle* strokeStyle,[In, Optional] const D2D1_MATRIX_3X2_F* worldTransform,[None] float flatteningTolerance,[Out] BOOL* contains)</unmanaged>
 public bool StrokeContainsPoint(Vector2 point, float strokeWidth, ID2D1StrokeStyle strokeStyle, Matrix3x2 transform, float flatteningTolerance)
 {
     return(StrokeContainsPoint(point, strokeWidth, strokeStyle, transform, flatteningTolerance));
 }
Beispiel #10
0
 /// <summary>
 /// Determines whether the geometry's stroke contains the specified point given the specified stroke thickness, style, and transform.
 /// </summary>
 /// <param name="point">The point to test for containment. </param>
 /// <param name="strokeWidth">The thickness of the stroke to apply. </param>
 /// <param name="strokeStyle">The style of stroke to apply. </param>
 /// <returns>When this method returns, contains a boolean value set to true if the geometry's stroke contains the specified point; otherwise, false. You must allocate storage for this parameter. </returns>
 /// <unmanaged>HRESULT ID2D1Geometry::StrokeContainsPoint([None] D2D1_POINT_2F point,[None] float strokeWidth,[In, Optional] ID2D1StrokeStyle* strokeStyle,[In, Optional] const D2D1_MATRIX_3X2_F* worldTransform,[None] float flatteningTolerance,[Out] BOOL* contains)</unmanaged>
 public bool StrokeContainsPoint(Vector2 point, float strokeWidth, ID2D1StrokeStyle strokeStyle)
 {
     return(StrokeContainsPoint(point, strokeWidth, strokeStyle, null, FlatteningTolerance));
 }
Beispiel #11
0
 /// <summary>
 /// Gets the bounds of the geometry after it has been widened by the specified stroke width and style and transformed by the specified matrix.
 /// </summary>
 /// <param name="strokeWidth">The amount by which to widen the geometry by stroking its outline. </param>
 /// <param name="strokeStyle">The style of the stroke that widens the geometry. </param>
 /// <param name="flatteningTolerance">The maximum bounds on the distance between points in the polygonal approximation of the geometry. Smaller values produce more accurate results but cause slower execution.  </param>
 /// <returns>When this method returns, contains the bounds of the widened geometry. You must allocate storage for this parameter. </returns>
 /// <unmanaged>HRESULT ID2D1Geometry::GetWidenedBounds([None] float strokeWidth,[In, Optional] ID2D1StrokeStyle* strokeStyle,[In, Optional] const D2D1_MATRIX_3X2_F* worldTransform,[None] float flatteningTolerance,[Out] D2D1_RECT_F* bounds)</unmanaged>
 public RawRectF GetWidenedBounds(float strokeWidth, ID2D1StrokeStyle strokeStyle, float flatteningTolerance)
 {
     return(GetWidenedBounds(strokeWidth, strokeStyle, null, flatteningTolerance));
 }
        public static void DrawRoundedRectangle(this ID2D1DeviceContext context, D2D1_ROUNDED_RECT roundedRect, ID2D1Brush brush, float strokeWidth, ID2D1StrokeStyle strokeStyle = null)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            if (brush == null)
            {
                throw new ArgumentNullException(nameof(brush));
            }

            context.DrawRoundedRectangle(ref roundedRect, brush, strokeWidth, strokeStyle);
        }
        public static void DrawGeometry(this ID2D1DeviceContext context, ID2D1Geometry geometry, ID2D1Brush brush, float strokeWidth, ID2D1StrokeStyle strokeStyle = null)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            if (geometry == null)
            {
                throw new ArgumentNullException(nameof(geometry));
            }

            if (brush == null)
            {
                throw new ArgumentNullException(nameof(brush));
            }

            context.DrawGeometry(geometry, brush, strokeWidth, strokeStyle);
        }