private static void AddArcImpl(IntPtr thisPtr, IntPtr arc) { ID2D1GeometrySinkShadow shadow = ToShadow <ID2D1GeometrySinkShadow>(thisPtr); ID2D1GeometrySink callback = (ID2D1GeometrySink)shadow.Callback; callback.AddArc(*((ArcSegment *)arc)); }
private static void AddQuadraticBezierImpl(IntPtr thisPtr, IntPtr bezier) { ID2D1GeometrySinkShadow shadow = ToShadow <ID2D1GeometrySinkShadow>(thisPtr); ID2D1GeometrySink callback = (ID2D1GeometrySink)shadow.Callback; callback.AddQuadraticBezier(*((QuadraticBezierSegment *)bezier)); }
private static void AddLineImpl(IntPtr thisPtr, PointF point) { ID2D1GeometrySinkShadow shadow = ToShadow <ID2D1GeometrySinkShadow>(thisPtr); ID2D1GeometrySink callback = (ID2D1GeometrySink)shadow.Callback; callback.AddLine(point); }
private static void AddQuadraticBeziersImpl(IntPtr thisPtr, IntPtr beziers, int beziersCount) { ID2D1GeometrySinkShadow shadow = ToShadow <ID2D1GeometrySinkShadow>(thisPtr); ID2D1GeometrySink callback = (ID2D1GeometrySink)shadow.Callback; var managedBeziers = new QuadraticBezierSegment[beziersCount]; MemoryHelpers.Read(beziers, managedBeziers, 0, beziersCount); callback.AddQuadraticBeziers(managedBeziers); }
/// <summary> /// Get a native callback pointer from a managed callback. /// </summary> /// <param name="geometrySink">The geometry sink.</param> /// <returns>A pointer to the unmanaged geometry sink counterpart</returns> public static IntPtr ToIntPtr(ID2D1GeometrySink geometrySink) { return(ToCallbackPtr <ID2D1GeometrySink>(geometrySink)); }
/// <summary> /// Combines this geometry with the specified geometry and stores the result in an <see cref="ID2D1SimplifiedGeometrySink"/>. /// </summary> /// <param name="inputGeometry">The geometry to combine with this instance.</param> /// <param name="combineMode">The type of combine operation to perform.</param> /// <param name="flatteningTolerance">The maximum bounds on the distance between points in the polygonal approximation of the geometries. Smaller values produce more accurate results but cause slower execution. </param> /// <param name="geometrySink">The result of the combine operation.</param> /// <returns>If the method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.</returns> /// <unmanaged>HRESULT CombineWithGeometry([In] ID2D1Geometry* inputGeometry,[None] D2D1_COMBINE_MODE combineMode,[In, Optional] const D2D1_MATRIX_3X2_F* inputGeometryTransform,[None] FLOAT flatteningTolerance,[In] ID2D1SimplifiedGeometrySink* geometrySink)</unmanaged> public void CombineWithGeometry(ID2D1Geometry inputGeometry, CombineMode combineMode, float flatteningTolerance, ID2D1GeometrySink geometrySink) { CombineWithGeometry(inputGeometry, combineMode, null, flatteningTolerance, geometrySink); }
/// <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); }
/// <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="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, ID2D1GeometrySink geometrySink) { Widen(strokeWidth, null, null, FlatteningTolerance, geometrySink); }
/// <summary> /// Computes the outline of the geometry and writes the result to an <see cref="ID2D1SimplifiedGeometrySink"/>. /// </summary> /// <remarks> /// The {{Outline}} method allows the caller to produce a geometry with an equivalent fill to the input geometry, with the following additional properties: The output geometry contains no transverse intersections; that is, segments may touch, but they never cross.The outermost figures in the output geometry are all oriented counterclockwise. The output geometry is fill-mode invariant; that is, the fill of the geometry does not depend on the choice of the fill mode. For more information about the fill mode, see <see cref="Vortice.Direct2D1.FillMode"/>.Additionally, the {{Outline}} method can be useful in removing redundant portions of said geometries to simplify complex geometries. It can also be useful in combination with <see cref="ID2D1GeometryGroup"/> to create unions among several geometries simultaneously. /// </remarks> /// <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 geometry's transformed outline is appended. </param> /// <returns>If the method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.</returns> /// <unmanaged>HRESULT Outline([In, Optional] const D2D1_MATRIX_3X2_F* worldTransform,[None] FLOAT flatteningTolerance,[In] ID2D1SimplifiedGeometrySink* geometrySink)</unmanaged> public void Outline(float flatteningTolerance, ID2D1GeometrySink geometrySink) { Outline(null, flatteningTolerance, geometrySink); }
/// <summary> /// Computes the outline of the geometry and writes the result to an <see cref="ID2D1SimplifiedGeometrySink"/>. /// </summary> /// <remarks> /// The {{Outline}} method allows the caller to produce a geometry with an equivalent fill to the input geometry, with the following additional properties: The output geometry contains no transverse intersections; that is, segments may touch, but they never cross.The outermost figures in the output geometry are all oriented counterclockwise. The output geometry is fill-mode invariant; that is, the fill of the geometry does not depend on the choice of the fill mode. For more information about the fill mode, see <see cref="Vortice.Direct2D1.FillMode"/>.Additionally, the {{Outline}} method can be useful in removing redundant portions of said geometries to simplify complex geometries. It can also be useful in combination with <see cref="ID2D1GeometryGroup"/> to create unions among several geometries simultaneously. /// </remarks> /// <param name="geometrySink">The <see cref="ID2D1SimplifiedGeometrySink"/> to which the geometry's transformed outline is appended. </param> /// <returns>If the method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.</returns> /// <unmanaged>HRESULT Outline([In, Optional] const D2D1_MATRIX_3X2_F* worldTransform,[None] FLOAT flatteningTolerance,[In] ID2D1SimplifiedGeometrySink* geometrySink)</unmanaged> public void Outline(ID2D1GeometrySink geometrySink) { Outline(null, FlatteningTolerance, geometrySink); }
internal D2D1GeometrySink(ID2D1GeometrySink geometrySink) { this.geometrySink = geometrySink; }