CanvasGeometry Class |
Namespace: Microsoft.Graphics.Canvas.Geometry
public sealed class CanvasGeometry : IDisposable, IGeometrySource2D
The CanvasGeometry type exposes the following members.
Name | Description | |
---|---|---|
DefaultFlatteningTolerance | A suitable flattening tolerance for most situations. | |
Device | Gets the device associated with this CanvasGeometry. |
Name | Description | |
---|---|---|
CombineWith(CanvasGeometry, Matrix3x2, CanvasGeometryCombine) | Returns the combination of this geometry and the specified geometry according to the specified combine operation,
such as union, intersection, etc. | |
CombineWith(CanvasGeometry, Matrix3x2, CanvasGeometryCombine, Single) | Returns the combination of this geometry and the specified geometry according to the specified combine operation,
such as union, intersection, etc. | |
CompareWith(CanvasGeometry) | Returns a value describing the intersection between this geometry and the specified geometry. | |
CompareWith(CanvasGeometry, Matrix3x2, Single) | Returns a value describing the intersection between this geometry and the specified geometry. | |
ComputeArea | Returns the area of this geometry. | |
ComputeArea(Matrix3x2, Single) | Returns the area of this geometry. | |
ComputeBounds | Returns the bounds of the geometry. | |
ComputeBounds(Matrix3x2) | Returns the bounds of the geometry. | |
ComputeFlatteningTolerance(Single, Single) | Computes the correct flattening tolerance given the specified DPI, and maximum zoom level. | |
ComputeFlatteningTolerance(Single, Single, Matrix3x2) | Computes the correct flattening tolerance given the specified DPI, maximum zoom level, and geometry transform. | |
ComputePathLength | Returns the length of the geometry as though the entire path were unrolled into a single straight line. | |
ComputePathLength(Matrix3x2, Single) | Returns the length of the geometry as though the entire path were unrolled into a single straight line. | |
ComputePointOnPath(Single) | Returns the point at the specified distance along the segments of the geometry. | |
ComputePointOnPath(Single, Vector2) | Returns the point and tangent vector at the specified distance along the segments of the geometry. | |
ComputePointOnPath(Single, Matrix3x2, Single, Vector2) | Returns the point and tangent vector at the specified distance along the segments of the geometry. | |
ComputeStrokeBounds(Single) | Returns the bounds of a stroked area of this geometry, with the specified stroke width. | |
ComputeStrokeBounds(Single, CanvasStrokeStyle) | Returns the bounds of a stroked area of this geometry, with the specified stroke width and stroke style. | |
ComputeStrokeBounds(Single, CanvasStrokeStyle, Matrix3x2, Single) | Returns the bounds of a stroked area of this geometry, with the specified stroke width and stroke style. | |
CreateCircle(ICanvasResourceCreator, Vector2, Single) | Creates a new circle geometry object with the specified extents. | |
CreateCircle(ICanvasResourceCreator, Single, Single, Single) | Creates a new circle geometry object with the specified extents. | |
CreateEllipse(ICanvasResourceCreator, Vector2, Single, Single) | Creates a new ellipse geometry object with the specified extents. | |
CreateEllipse(ICanvasResourceCreator, Single, Single, Single, Single) | Creates a new ellipse geometry object with the specified extents. | |
CreateGlyphRun | Creates a geometry based on a glyph run. | |
CreateGroup(ICanvasResourceCreator, CanvasGeometry) | Returns a geometry containing the specified geometries, grouped together. | |
CreateGroup(ICanvasResourceCreator, CanvasGeometry, CanvasFilledRegionDetermination) | Returns a geometry containing the specified geometries, grouped together. | |
CreateInk(ICanvasResourceCreator, IEnumerableInkStroke) | Creates a geometry from a collection of ink strokes. | |
CreateInk(ICanvasResourceCreator, IEnumerableInkStroke, Matrix3x2, Single) | Creates a geometry from a collection of ink strokes. | |
CreatePath | Creates a new path geometry, populated with data from the specified path builder. | |
CreatePolygon | Creates a new polygon geometry (triangle, quadrilateral, etc.), connecting the specified points. | |
CreateRectangle(ICanvasResourceCreator, Rect) | Creates a new rectangle geometry object with the specified extents. | |
CreateRectangle(ICanvasResourceCreator, Single, Single, Single, Single) | Creates a rectangular geometry primitive with the specified extents. | |
CreateRoundedRectangle(ICanvasResourceCreator, Rect, Single, Single) | Creates a new rounded rectangle geometry object with the specified extents. | |
CreateRoundedRectangle(ICanvasResourceCreator, Single, Single, Single, Single, Single, Single) | Creates a new rounded rectangle geometry object with the specified extents. | |
CreateText | Creates a geometry based on a text layout. | |
Dispose | Releases all resources used by the CanvasGeometry. | |
FillContainsPoint(Vector2) | Returns whether the area filled by the geometry contains the specified point. | |
FillContainsPoint(Vector2, Matrix3x2, Single) | Returns whether the area filled by the geometry contains the specified point. | |
Outline | Returns a geometry with equivalent fill, but no self-intersections, and figures are all oriented counterclockwise. | |
Outline(Matrix3x2, Single) | Returns a geometry with equivalent fill, but no self-intersections, and figures are all oriented counterclockwise. | |
SendPathTo | Sends all of this geometry's path data to an application-implemented interface. | |
Simplify(CanvasGeometrySimplification) | Returns a version of the geometry that contains only lines, and, optionally, cubic Bezier curves. | |
Simplify(CanvasGeometrySimplification, Matrix3x2, Single) | Returns a version of the geometry that contains only lines, and, optionally, cubic Bezier curves. | |
Stroke(Single) | Returns a geometry equivalent to a stroked area of this geometry, with the specified stroke width and a default stroke style. | |
Stroke(Single, CanvasStrokeStyle) | Returns a geometry equivalent to a stroked area of this geometry, with the specified stroke width and a default stroke style. | |
Stroke(Single, CanvasStrokeStyle, Matrix3x2, Single) | Returns a geometry equivalent to a stroked area of this geometry, with the specified stroke width and a default stroke style. | |
StrokeContainsPoint(Vector2, Single) | Returns whether the stroked area of this geometry, with the specified stroke width and default stroke style, would contain the specified point. | |
StrokeContainsPoint(Vector2, Single, CanvasStrokeStyle) | Returns whether the stroked area of this geometry, with the specified stroke width and stroke style, would contain the specified point. | |
StrokeContainsPoint(Vector2, Single, CanvasStrokeStyle, Matrix3x2, Single) | Returns whether the stroked area of this geometry, with the specified stroke width and stroke style, would contain the specified point. | |
Tessellate | Returns an array of clockwise-wound triangles that cover the geometry. | |
Tessellate(Matrix3x2, Single) | Returns an array of clockwise-wound triangles that cover the geometry after it has
been transformed using the specified matrix and flattened using the specified tolerance. | |
Transform | Returns a transformed version of this geometry. |
A geometry is an arbitrary 2-D area, and a means of representing geometric shapes. It may consist of lines, polygons with multiple segments, bezier curves, or any number of open or closed figures comprised of these. There aren't any limits on how complex a geometry can be. It can be zero-sized, consist of one point, or be arbitrarily complex.
A geometry object can be drawn using CanvasDrawingSession's DrawGeometry Overload or FillGeometry Overload.
Geometry objects can be manipulated using methods like CombineWith Overload or Stroke Overload.
Some primitives that can be created using static CanvasGeometry methods, such as Rectangle, may also be drawn straightforwardly through CanvasDrawingSession's methods. In fact, for simple cases, CanvasDrawingSession's methods are recommended.
Complex geometries, sometimes those created through CanvasGeometry.CreatePath, can be costly to draw. It may be worth paying a one-time, up-front performance cost for a less expensive draw-time cost. To do this, consider using CanvasCachedGeometry.
When using Direct2D interop, this Win2D class corresponds to the Direct2D interface ID2D1Geometry. Depending on how the CanvasGeometry was created, its underlying Direct2D resource will also implement one of the derived interfaces ID2D1PathGeometry, ID2D1RectangleGeometry, ID2D1RoundedRectangleGeometry, ID2D1EllipseGeometry, ID2D1TransformedGeometry, or ID2D1GeometryGroup.