public static void AddLine(this ID2D1SimplifiedGeometrySink sink, D2D_POINT_2F point)
        {
            if (sink == null)
            {
                throw new ArgumentNullException(nameof(sink));
            }

            sink.AddLines(new[] { point }, 1);
        }
        public static void AddLines(this ID2D1SimplifiedGeometrySink sink, IEnumerable <D2D_POINT_2F> points)
        {
            if (sink == null)
            {
                throw new ArgumentNullException(nameof(sink));
            }

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

            var array = points.ToArray();

            if (array.Length == 0)
            {
                throw new ArgumentException(null, nameof(points));
            }

            sink.AddLines(array, array.Length);
        }
 /// <summary>
 /// Return a pointer to the unmanaged version of this callback.
 /// </summary>
 /// <param name="callback">The callback.</param>
 /// <returns>A pointer to a shadow c++ callback</returns>
 public static IntPtr ToIntPtr(ID2D1SimplifiedGeometrySink callback)
 {
     return(ToCallbackPtr <ID2D1SimplifiedGeometrySink>(callback));
 }
Beispiel #4
0
 /// <summary>
 /// Creates a simplified version of the geometry that contains only lines and (optionally) cubic Bezier curves and writes the result to an <see cref="ID2D1SimplifiedGeometrySink"/>.
 /// </summary>
 /// <param name="simplificationOption">A value that specifies whether the simplified geometry should contain curves.</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 simplified geometry is appended. </param>
 /// <returns>If the method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.</returns>
 /// <unmanaged>HRESULT Simplify([None] D2D1_GEOMETRY_SIMPLIFICATION_OPTION simplificationOption,[In, Optional] const D2D1_MATRIX_3X2_F* worldTransform,[None] FLOAT flatteningTolerance,[In] ID2D1SimplifiedGeometrySink* geometrySink)</unmanaged>
 public void Simplify(GeometrySimplificationOption simplificationOption, float flatteningTolerance, ID2D1SimplifiedGeometrySink geometrySink)
 {
     Simplify(simplificationOption, null, flatteningTolerance, geometrySink);
 }