示例#1
0
    public ID2D1Geometry[] GetSourceGeometry(int geometriesCount)
    {
        var geometries = new ID2D1Geometry[geometriesCount];

        GetSourceGeometries(geometries, geometriesCount);
        return(geometries);
    }
        public D2D1Geometry[] GetSourceGeometries()
        {
            uint count = this.geometry.GetSourceGeometryCount();

            ID2D1Geometry[] geometries = new ID2D1Geometry[count];
            this.geometry.GetSourceGeometries(geometries, count);

            return Array.ConvertAll(geometries, t => new D2D1GeometryBase(t));
        }
        public D2D1Geometry[] GetSourceGeometries()
        {
            uint count = this.geometry.GetSourceGeometryCount();

            ID2D1Geometry[] geometries = new ID2D1Geometry[count];
            this.geometry.GetSourceGeometries(geometries, count);

            return(Array.ConvertAll(geometries, t => new D2D1GeometryBase(t)));
        }
示例#4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="D2D1LayerParameters"/> struct.
 /// </summary>
 /// <param name="contentBounds">The content bounds of the layer. Content outside these bounds is not guaranteed to render.</param>
 /// <param name="geometricMask">The geometric mask specifies the area of the layer that is composited into the render target.</param>
 /// <param name="maskAntialiasMode">A value that specifies the antialiasing mode for the geometricMask.</param>
 /// <param name="maskTransform">A value that specifies the transform that is applied to the geometric mask when composing the layer.</param>
 /// <param name="opacity">An opacity value that is applied uniformly to all resources in the layer when compositing to the target.</param>
 /// <param name="opacityBrush">A brush that is used to modify the opacity of the layer. The brush is mapped to the layer, and the alpha channel of each mapped brush pixel is multiplied against the corresponding layer pixel.</param>
 /// <param name="layerOptions">A value that specifies whether the layer intends to render text with ClearType antialiasing.</param>
 public D2D1LayerParameters(
     D2D1RectF contentBounds,
     D2D1Geometry geometricMask,
     D2D1AntialiasMode maskAntialiasMode,
     D2D1Matrix3X2F maskTransform,
     float opacity,
     D2D1Brush opacityBrush,
     D2D1LayerOptions layerOptions)
 {
     this.contentBounds     = contentBounds;
     this.geometricMask     = geometricMask == null ? null : geometricMask.GetHandle <ID2D1Geometry>();
     this.maskAntialiasMode = maskAntialiasMode;
     this.maskTransform     = maskTransform;
     this.opacity           = opacity;
     this.opacityBrush      = opacityBrush == null ? null : opacityBrush.GetHandle <ID2D1Brush>();
     this.layerOptions      = layerOptions;
 }
示例#5
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);
        }
示例#6
0
        public static void FillGeometry(this ID2D1RenderTarget context, ID2D1Geometry geometry, ID2D1Brush brush, ID2D1Brush opacityBrush = 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.FillGeometry(geometry, brush, opacityBrush);
        }
        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);
        }
示例#8
0
 public ID2D1TransformedGeometry CreateTransformedGeometry(ID2D1Geometry sourceGeometry, Matrix3x2 transform)
 {
     return(CreateTransformedGeometry(sourceGeometry, ref transform));
 }
 /// <summary>
 /// Draws the outline of the specified geometry with given brush.
 /// </summary>
 /// <param name="geometry">The <see cref="ID2D1Geometry"/> to draw. </param>
 /// <param name="brush">The <see cref="ID2D1Brush"/> used to paint the geometry's stroke. </param>
 /// <param name="strokeWidth">The thickness of the geometry's stroke. The stroke is centered on the geometry's outline.</param>
 public void DrawGeometry(ID2D1Geometry geometry, ID2D1Brush brush, float strokeWidth)
 {
     DrawGeometry(geometry, brush, strokeWidth, null);
 }
 /// <summary>
 /// Draws the outline of the specified geometry.
 /// </summary>
 /// <param name="geometry">The <see cref="ID2D1Geometry"/> to draw.</param>
 /// <param name="brush">The brush used to paint the geometry's stroke.</param>
 public void DrawGeometry(ID2D1Geometry geometry, ID2D1Brush brush)
 {
     DrawGeometry(geometry, brush, 1.0f, null);
 }
 internal D2D1GeometryBase(ID2D1Geometry geometry)
 {
     this.geometry = geometry;
 }
示例#12
0
 /// <summary>
 /// Describes the intersection between this geometry and the specified geometry. The comparison is performed by using the specified flattening tolerance.
 /// </summary>
 /// <remarks>
 /// When interpreting the returned relation value, it is important to remember that the member <see cref="F:Vortice.Direct2D1.GeometryRelation.IsContained" /> of the  D2D1_GEOMETRY_RELATION enumeration type means that this geometry is contained  inside inputGeometry, not that this geometry contains inputGeometry.  For  more information about how to interpret other possible return values, see <see cref="T:Vortice.Direct2D1.GeometryRelation" />.
 /// </remarks>
 /// <param name="inputGeometry">The geometry to test.  </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>
 /// <returns>When this method returns, contains a reference to a value that describes how this geometry is related to inputGeometry. You must allocate storage for this parameter.   </returns>
 /// <unmanaged>HRESULT ID2D1Geometry::CompareWithGeometry([In] ID2D1Geometry* inputGeometry,[In, Optional] const D2D1_MATRIX_3X2_F* inputGeometryTransform,[None] float flatteningTolerance,[Out] D2D1_GEOMETRY_RELATION* relation)</unmanaged>
 public GeometryRelation CompareWithGeometry(ID2D1Geometry inputGeometry, float flatteningTolerance)
 {
     return(CompareWithGeometry(inputGeometry, null, flatteningTolerance));
 }
示例#13
0
 /// <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);
 }
 internal D2D1GeometryBase(ID2D1Geometry geometry)
 {
     this.geometry = geometry;
 }