[]
Abstract base class that implements a drawing surface.
public abstract class GcGraphics : IDisposable
Initializes a new instance of the GcGraphics class.
public GcGraphics()
Gets or sets the current blend mode.
public BlendMode BlendMode { get; set; }
Gets a value indicating whether this instance of GcGraphics has been disposed and cannot be used anymore.
public bool Disposed { get; }
Gets or sets a value indicating if strings and TextLayout objects are rendered using the graphic primitives instead of the specialized text drawing services.
public bool DrawTextAsPath { get; set; }
Gets or sets a FontCollection used by MeasureString and DrawString methods.
public FontCollection FontCollection { get; set; }
Gets or sets the sampling mode to use when drawing images with resizing.
public InterpolationMode InterpolationMode { get; set; }
Gets or sets the resolution of the current graphics (pixels per inch).
public abstract float Resolution { get; set; }
Gets the resolution of the underlying drawing surface (pixels per inch).
public virtual float? SurfaceResolution { get; }
Gets or sets the transformation matrix of the current graphics.
public abstract Matrix3x2 Transform { get; set; }
Checks whether object was disposed and throws an exception in this case.
protected void CheckDisposed()
Creates a clip region from a graphics path.
Use PushClip(IClipRegion) and PopClip(IClipRegion) to set/remove clipping.
public IClipRegion CreateClipRegion(IPath graphicsPath)
graphicsPath
IPathThe path to create the clip region from.
The created clip region.
Creates a clip region from a rectangle.
public IClipRegion CreateClipRegion(RectangleF bounds)
bounds
System.Drawing.RectangleFThe rectangle to create the clip region from.
The created clip region.
Creates a graphics path.
public IPath CreatePath()
The created path.
Creates IPath object representing round border.
public IPath CreateRoundBordersPath(RectangleF bounds, CornerRadius cornerRadius)
bounds
System.Drawing.RectangleFThe border bounds.
cornerRadius
CornerRadiusThe CornerRadius structure.
Creates an instance of TextLayout with the same resolution as that of the current graphics.
This is the recommended way to create a TextLayout to use with a graphics.
public TextLayout CreateTextLayout()
The newly created text layout.
Releases all resources used by the current GcGraphics.
public void Dispose()
Disposes the current graphics.
protected virtual void Dispose(bool disposing)
disposing
boolDraws an ellipse using a specified pen.
public void DrawEllipse(RectangleF bounds, Pen pen)
bounds
System.Drawing.RectangleFA System.Drawing.RectangleF structure that specifies the ellipse to draw.
pen
PenThe pen used to draw the ellipse.
Draws an ellipse using a specified line color, width and style.
If the value of lineStyle parameter is not Solid, the ellipse is drawn with a Pen having LineCap set to Square instead of Flat.
public void DrawEllipse(RectangleF bounds, Color lineColor, float lineWidth, DashStyle lineStyle = DashStyle.Solid)
bounds
System.Drawing.RectangleFA System.Drawing.RectangleF structure that specifies the ellipse to draw.
lineColor
System.Drawing.ColorThe color of lines used to draw the ellipse.
lineWidth
floatThe width of lines used to draw the ellipse.
lineStyle
DashStyleThe line style (solid by default).
Draws an ellipse using a specified line color, width and dash pattern.
If the dashPattern array contains two or more items, the ellipse is drawn with a Pen having LineCap set to Square instead of Flat.
public void DrawEllipse(RectangleF bounds, Color lineColor, float lineWidth, float[] dashPattern)
bounds
System.Drawing.RectangleFA System.Drawing.RectangleF structure that specifies the ellipse to draw.
lineColor
System.Drawing.ColorThe color of lines used to draw the ellipse.
lineWidth
floatThe width of lines used to draw the ellipse.
dashPattern
float[]The dash pattern of lines used to draw the ellipse.
Draws an image using specified bounds, clipping and image alignment.
In an output parameter, returns the array of actual image bounds.
public void DrawImage(IImage image, RectangleF destBounds, RectangleF? clipBounds, ImageAlign align, out RectangleF[] imageBounds, float opacity = 1)
image
IImageThe image to draw.
destBounds
System.Drawing.RectangleFThe destination rectangle.
clipBounds
System.Drawing.RectangleF?The clipping rectangle, or null for no clipping.
align
ImageAlignThe image alignment.
imageBounds
System.Drawing.RectangleF[]OUT: The actual bounds of the drawn images (can be more than one if the image is tiled).
opacity
floatThe image opacity.
Draws an image using specified bounds, clipping and image alignment.
public void DrawImage(IImage image, RectangleF destBounds, RectangleF? clipBounds, ImageAlign align, float opacity = 1)
image
IImageThe image to draw.
destBounds
System.Drawing.RectangleFThe destination rectangle.
clipBounds
System.Drawing.RectangleF?The clipping rectangle, or null for no clipping.
align
ImageAlignThe image alignment.
opacity
floatThe image opacity.
Draws a line between two points, using the specified pen.
public void DrawLine(PointF p1, PointF p2, Pen pen)
p1
System.Drawing.PointFThe first point.
p2
System.Drawing.PointFThe second point.
pen
PenThe pen to use.
Draws a line between two points, using a specified line color, width and style.
If the value of lineStyle parameter is not Solid, the line is drawn with a Pen having LineCap set to Square instead of Flat.
public void DrawLine(PointF p1, PointF p2, Color lineColor, float lineWidth, DashStyle lineStyle = DashStyle.Solid)
p1
System.Drawing.PointFThe first point.
p2
System.Drawing.PointFThe second point.
lineColor
System.Drawing.ColorThe line color.
lineWidth
floatThe line width.
lineStyle
DashStyleThe line style (solid by default).
Draws a line between two points, using the specified line color, width and dash pattern.
If the dashPattern array contains two or more items, the line is drawn with a Pen having LineCap set to Square instead of Flat.
public void DrawLine(PointF p1, PointF p2, Color lineColor, float lineWidth, float[] dashPattern)
p1
System.Drawing.PointFThe first point.
p2
System.Drawing.PointFThe second point.
lineColor
System.Drawing.ColorThe line color.
lineWidth
floatThe line width.
dashPattern
float[]The dash pattern.
Draws a line between two points, using the specified pen.
public void DrawLine(float x1, float y1, float x2, float y2, Pen pen)
x1
floatThe X coordinate of the first point.
y1
floatThe Y coordinate of the first point.
x2
floatThe X coordinate of the second point.
y2
floatThe Y coordinate of the second point.
pen
PenThe pen to use.
Draws a line between two points, using a specified line color, width and style.
If the value of lineStyle parameter is not Solid, the line is drawn with a Pen having LineCap set to Square instead of Flat.
public void DrawLine(float x1, float y1, float x2, float y2, Color lineColor, float lineWidth, DashStyle lineStyle = DashStyle.Solid)
x1
floatThe X coordinate of the first point.
y1
floatThe Y coordinate of the first point.
x2
floatThe X coordinate of the second point.
y2
floatThe Y coordinate of the second point.
lineColor
System.Drawing.ColorThe line color.
lineWidth
floatThe line width.
lineStyle
DashStyleThe line style (solid by default).
Draws a line between two points, using the specified line color, width and dash pattern.
If the dashPattern array contains two or more items, the line is drawn with a Pen having LineCap set to Square instead of Flat.
public void DrawLine(float x1, float y1, float x2, float y2, Color lineColor, float lineWidth, float[] dashPattern)
x1
floatThe X coordinate of the first point.
y1
floatThe Y coordinate of the first point.
x2
floatThe X coordinate of the second point.
y2
floatThe Y coordinate of the second point.
lineColor
System.Drawing.ColorThe line color.
lineWidth
floatThe line width.
dashPattern
float[]The dash pattern.
Draws a series of connected lines, using a specified pen.
public void DrawLines(PointF[] points, Pen pen)
points
System.Drawing.PointF[]The array of points to connect.
pen
PenThe pen to use.
Draws a series of connected lines, using a specified line color, width and style.
If the value of lineStyle parameter is not Solid, the lines are drawn with a Pen having LineCap set to Square instead of Flat.
public void DrawLines(PointF[] points, Color lineColor, float lineWidth, DashStyle lineStyle = DashStyle.Solid)
points
System.Drawing.PointF[]The array of points to connect.
lineColor
System.Drawing.ColorThe line color.
lineWidth
floatThe line width.
lineStyle
DashStyleThe line style (solid by default).
Draws a series of connected lines, using a specified line style.
If the dashPattern array contains two or more items, the lines are drawn with a Pen having LineCap set to Square instead of Flat.
public void DrawLines(PointF[] points, Color lineColor, float lineWidth, float[] dashPattern)
points
System.Drawing.PointF[]The array of points to connect.
lineColor
System.Drawing.ColorThe line color.
lineWidth
floatThe line width.
dashPattern
float[]The dash pattern.
Draws a path using a specified pen.
public void DrawPath(IPath path, Pen pen)
path
IPathAn object implementing the IPath interface that represents the path to draw.
pen
PenThe pen used to draw the path.
Draws a path using a specified line color, width and style.
If the value of lineStyle parameter is not Solid, the path is drawn with a Pen having LineCap set to Square instead of Flat.
public void DrawPath(IPath path, Color lineColor, float lineWidth, DashStyle lineStyle = DashStyle.Solid)
path
IPathAn object implementing the IPath interface that represents the path to draw.
lineColor
System.Drawing.ColorThe color of lines used to draw the path.
lineWidth
floatThe width of lines used to draw the path.
lineStyle
DashStyleThe style of lines used to draw the path (solid by default).
Draws a path using a specified line color, width and dash pattern.
If the dashPattern array contains two or more items, the path is drawn with a Pen having LineCap set to Square instead of Flat.
public void DrawPath(IPath path, Color lineColor, float lineWidth, float[] dashPattern)
path
IPathAn object implementing the IPath interface that represents the path to draw.
lineColor
System.Drawing.ColorThe color of lines used to draw the path.
lineWidth
floatThe width of lines used to draw the path.
dashPattern
float[]The dash pattern of lines used to draw the path.
Draws a polygon specified by an array of points, using a specified pen.
public void DrawPolygon(Quadrilateral quadrilateral, Pen pen)
quadrilateral
QuadrilateralA quadrilateral specifying the polygon.
pen
PenThe pen to use.
Draws a polygon specified by an array of points, using a specified line color, width and style.
If the value of lineStyle parameter is not Solid, the polygon is drawn with a Pen having LineCap set to Square instead of Flat.
public void DrawPolygon(Quadrilateral quadrilateral, Color lineColor, float lineWidth, DashStyle lineStyle = DashStyle.Solid)
quadrilateral
QuadrilateralA quadrilateral specifying the polygon.
lineColor
System.Drawing.ColorThe line color.
lineWidth
floatThe line width.
lineStyle
DashStyleThe line style (solid by default).
Draws a polygon specified by an array of points, using a specified line color, width and dash pattern.
If the dashPattern array contains two or more items, the polygon is drawn with a Pen having LineCap set to Square instead of Flat.
public void DrawPolygon(Quadrilateral quadrilateral, Color lineColor, float lineWidth, float[] dashPattern)
quadrilateral
QuadrilateralA quadrilateral specifying the polygon.
lineColor
System.Drawing.ColorThe line color.
lineWidth
floatThe line width.
dashPattern
float[]The dash pattern.
Draws a polygon specified by an array of points, using a specified pen.
public void DrawPolygon(PointF[] points, Pen pen)
points
System.Drawing.PointF[]An array of points specifying the polygon.
pen
PenThe pen to use.
Draws a polygon specified by an array of points, using a specified line color, width and style.
If the value of lineStyle parameter is not Solid, the polygon is drawn with a Pen having LineCap set to Square instead of Flat.
public void DrawPolygon(PointF[] points, Color lineColor, float lineWidth, DashStyle lineStyle = DashStyle.Solid)
points
System.Drawing.PointF[]An array of points specifying the polygon.
lineColor
System.Drawing.ColorThe line color.
lineWidth
floatThe line width.
lineStyle
DashStyleThe line style (solid by default).
Draws a polygon specified by an array of points, using a specified line color, width and dash pattern.
If the dashPattern array contains two or more items, the polygon is drawn with a Pen having LineCap set to Square instead of Flat.
public void DrawPolygon(PointF[] points, Color lineColor, float lineWidth, float[] dashPattern)
points
System.Drawing.PointF[]An array of points specifying the polygon.
lineColor
System.Drawing.ColorThe line color.
lineWidth
floatThe line width.
dashPattern
float[]The dash pattern.
Draws a rectangle using a specified pen.
public void DrawRectangle(RectangleF bounds, Pen pen)
bounds
System.Drawing.RectangleFA System.Drawing.RectangleF structure that represents the rectangle to draw.
pen
PenThe pen used to draw the rectangle.
Draws a rectangle using a specified line color, width and style.
If the value of lineStyle parameter is not Solid, the rectangle is drawn with a Pen having LineCap set to Square instead of Flat.
public void DrawRectangle(RectangleF bounds, Color lineColor, float lineWidth, DashStyle lineStyle = DashStyle.Solid)
bounds
System.Drawing.RectangleFA System.Drawing.RectangleF structure that represents the rectangle to draw.
lineColor
System.Drawing.ColorThe color of lines used to draw the rectangle.
lineWidth
floatThe width of lines used to draw the rectangle.
lineStyle
DashStyleThe style of lines used to draw the rectangle (solid by default).
Draws a rectangle using a specified line color, width and dash pattern.
If the dashPattern array contains two or more items, the rectangle is drawn with a Pen having LineCap set to Square instead of Flat.
public void DrawRectangle(RectangleF bounds, Color lineColor, float lineWidth, float[] dashPattern)
bounds
System.Drawing.RectangleFA System.Drawing.RectangleF structure that represents the rectangle to draw.
lineColor
System.Drawing.ColorThe color of lines used to draw the rectangle.
lineWidth
floatThe width of lines used to draw the rectangle.
dashPattern
float[]The dash pattern lines used to draw the rectangle.
Draws rotated text inside an unrotated rectangle.
Note that the original textLayout
will be changed by this method. If necessary, create a clone in advance.
Also note that the values of the following properties are ignored: MaxWidth, MaxHeight, FlowDirection, CanSkipFirstLineWithIndentation, ObjectRects, ParagraphAlignment, MarginLeft, MarginRight, MarginTop, MarginBottom, ColumnWidth, RowHeight.
public void DrawRotatedText(TextLayout textLayout, int angle, bool verticalStacking, RectangleF rect, RotatedTextAlignment alignment)
textLayout
TextLayoutThe TextLayout to draw.
angle
intThe text rotation angle, in degrees. The expected range is [-90, +90].
verticalStacking
boolIf false, text lines are stacked horizontally along the top and bottom sides of rect
.
If true, the lines are stacked vertically along the left and right sides of the rectangle.
rect
System.Drawing.RectangleFThe target rectangle for the text.
alignment
RotatedTextAlignmentAlignment of the text in the target rectangle.
Draws a rounded border defined by four Pen objects and CornerRadius structure.
public void DrawRoundRect(RectangleF bounds, Pen left, Pen top, Pen right, Pen bottom, CornerRadius cornerRadius)
bounds
System.Drawing.RectangleFThe System.Drawing.RectangleF structure that represents the border bounds.
left
PenThe left border.
top
PenThe top border.
right
PenThe right border.
bottom
PenThe bottom border.
cornerRadius
CornerRadiusThe border's corner radius.
Draws a rounded rectangle using a specified pen.
public void DrawRoundRect(RectangleF bounds, float radius, Pen pen)
bounds
System.Drawing.RectangleFA System.Drawing.RectangleF structure that represents the rectangle to draw.
radius
floatThe radius for the quarter ellipse that is drawn to replace every corner of the rectangle.
pen
PenThe pen used to draw the rounded rectangle.
Draws a rounded rectangle using a specified line color, width and style.
If the value of lineStyle parameter is not Solid, the rounded rectangle is drawn with a Pen having LineCap set to Square instead of Flat.
public void DrawRoundRect(RectangleF bounds, float radius, Color lineColor, float lineWidth, DashStyle lineStyle = DashStyle.Solid)
bounds
System.Drawing.RectangleFA System.Drawing.RectangleF structure that represents the rectangle to draw.
radius
floatThe radius for the quarter ellipse that is drawn to replace every corner of the rectangle.
lineColor
System.Drawing.ColorThe color of lines used to draw the rounded rectangle.
lineWidth
floatThe width of lines used to draw the rounded rectangle.
lineStyle
DashStyleThe style of lines used to draw the rounded rectangle (solid by default).
Draws a rounded rectangle using a specified line color, width and dash pattern.
If the dashPattern array contains two or more items, the rounded rectangle is drawn with a Pen having LineCap set to Square instead of Flat.
public void DrawRoundRect(RectangleF bounds, float radius, Color lineColor, float lineWidth, float[] dashPattern)
bounds
System.Drawing.RectangleFA System.Drawing.RectangleF structure that represents the rectangle to draw.
radius
floatThe radius for the quarter ellipse that is drawn to replace every corner of the rectangle.
lineColor
System.Drawing.ColorThe color of lines used to draw the rounded rectangle.
lineWidth
floatThe width of lines used to draw the rounded rectangle.
dashPattern
float[]The dash pattern lines used to draw the rounded rectangle.
Draws a rounded rectangle using a specified pen.
public void DrawRoundRect(RectangleF bounds, float radiusX, float radiusY, Pen pen)
bounds
System.Drawing.RectangleFA System.Drawing.RectangleF structure that represents the rectangle to draw.
radiusX
floatThe x-radius for the quarter ellipse that is drawn to replace every corner of the rectangle.
radiusY
floatThe y-radius for the quarter ellipse that is drawn to replace every corner of the rectangle.
pen
PenThe pen used to draw the rounded rectangle.
Draws a rounded rectangle using a specified line color, width and style.
If the value of lineStyle parameter is not Solid, the rounded rectangle is drawn with a Pen having LineCap set to Square instead of Flat.
public void DrawRoundRect(RectangleF bounds, float radiusX, float radiusY, Color lineColor, float lineWidth, DashStyle lineStyle = DashStyle.Solid)
bounds
System.Drawing.RectangleFA System.Drawing.RectangleF structure that represents the rectangle to draw.
radiusX
floatThe x-radius for the quarter ellipse that is drawn to replace every corner of the rectangle.
radiusY
floatThe y-radius for the quarter ellipse that is drawn to replace every corner of the rectangle.
lineColor
System.Drawing.ColorThe color of lines used to draw the rounded rectangle.
lineWidth
floatThe width of lines used to draw the rounded rectangle.
lineStyle
DashStyleThe style of lines used to draw the rounded rectangle (solid by default).
Draws a rounded rectangle using a specified line color, width and dash pattern.
If the dashPattern array contains two or more items, the rounded rectangle is drawn with a Pen having LineCap set to Square instead of Flat.
public void DrawRoundRect(RectangleF bounds, float radiusX, float radiusY, Color lineColor, float lineWidth, float[] dashPattern)
bounds
System.Drawing.RectangleFA System.Drawing.RectangleF structure that represents the rectangle to draw.
radiusX
floatThe x-radius for the quarter ellipse that is drawn to replace every corner of the rectangle.
radiusY
floatThe y-radius for the quarter ellipse that is drawn to replace every corner of the rectangle.
lineColor
System.Drawing.ColorThe color of lines used to draw the rounded rectangle.
lineWidth
floatThe width of lines used to draw the rounded rectangle.
dashPattern
float[]The dash pattern lines used to draw the rounded rectangle.
Draws rotated text inside a slanted rectangle.
Note that the original textLayout
will be changed by this method. If necessary, create a clone in advance.
Also note that the values of the following properties are ignored: MaxWidth, MaxHeight, FlowDirection, CanSkipFirstLineWithIndentation, ObjectRects, ParagraphAlignment, MarginLeft, MarginRight, MarginTop, MarginBottom, ColumnWidth, RowHeight.
public void DrawSlantedText(TextLayout textLayout, int angle, bool verticalStacking, RectangleF rect, SlantedTextAlignment alignment)
textLayout
TextLayoutThe TextLayout to draw.
angle
intThe text rotation angle, in degrees. The expected range is [-90, +90].
verticalStacking
boolIf false, text lines are stacked horizontally along the top and bottom sides of rect
.
If true, the lines are stacked vertically along the left and right sides of the rectangle.
rect
System.Drawing.RectangleFThe target rectangle to be slanted with text.
alignment
SlantedTextAlignmentAlignment of the text in the slanted rectangle.
Draws a string using a specified attributes at a specified location.
public void DrawString(string text, Font font, float fontSize, Color foreColor, PointF location)
text
stringThe string to draw.
font
FontThe font.
fontSize
floatThe font size.
foreColor
System.Drawing.ColorThe text color.
location
System.Drawing.PointFThe location to draw at.
Draws a string using a specified TextFormat at a specified location.
public void DrawString(string text, TextFormat textFormat, PointF location)
text
stringThe string to draw.
textFormat
TextFormatThe text format to use.
location
System.Drawing.PointFThe location to draw at.
Draws a string using a specified TextFormat within a rectangle using a specified text alignment, paragraph alignment and word wrapping flag.
public void DrawString(string text, TextFormat textFormat, RectangleF rect, TextAlignment textAlignment = TextAlignment.Leading, ParagraphAlignment paragraphAlignment = ParagraphAlignment.Near, bool wordWrap = true)
text
stringThe string to draw.
textFormat
TextFormatThe text format to use.
rect
System.Drawing.RectangleFThe target rectangle.
textAlignment
TextAlignmentThe text alignment (Leading by default).
paragraphAlignment
ParagraphAlignmentThe paragraph alignment (Near by default).
wordWrap
boolWhether to use word wrapping (true by default).
Draws a specified SVG document at a point specifying the position of the SVG viewport.
To specify the position of the SVG content rather than viewport, see DrawSvgContent(GcSvgDocument, PointF, float).
public void DrawSvg(GcSvgDocument svgDocument, PointF viewportPosition, float opacity = 1)
svgDocument
GcSvgDocumentThe SVG document to draw.
viewportPosition
System.Drawing.PointFThe coordinates for drawing the top-left corner of the SVG viewport.
opacity
floatThe opacity factor to be applied to the SVG content.
Draws a specified SVG document, resizing its viewport to fit into a specified rectangle.
To draw just the content of the SVG ignoring viewport position, see DrawSvgContent(GcSvgDocument, RectangleF, float).
public void DrawSvg(GcSvgDocument svgDocument, RectangleF viewportRect, float opacity = 1)
svgDocument
GcSvgDocumentThe SVG document to draw.
viewportRect
System.Drawing.RectangleFThe target rectangle for the SVG viewport.
opacity
floatThe opacity factor to be applied to the SVG content.
Draws the content of a specified SVG document at a point specifying the top-left corner of the SVG content.
To specify the position of the SVG viewport rather than content, see DrawSvg(GcSvgDocument, PointF, float).
public void DrawSvgContent(GcSvgDocument svgDocument, PointF contentPosition, float opacity = 1)
svgDocument
GcSvgDocumentThe SVG document to draw.
contentPosition
System.Drawing.PointFThe coordinates for the top-left corner of the SVG content.
opacity
floatThe opacity factor to be applied to the SVG content.
Draws the content of a specified SVG document, resizing the content to fit into a specified rectangle.
To draw the SVG resizing its viewport rather than just the content, see DrawSvg(GcSvgDocument, RectangleF, float).
public void DrawSvgContent(GcSvgDocument svgDocument, RectangleF contentRect, float opacity = 1)
svgDocument
GcSvgDocumentThe SVG document to draw.
contentRect
System.Drawing.RectangleFThe target rectangle for the SVG content.
opacity
floatThe opacity factor to be applied to the SVG content.
Draws a TextLayout at a specified location.
If any part of the text does not fit in the layout bounds, it is truncated.
public void DrawTextLayout(TextLayout layout, PointF location)
layout
TextLayoutThe TextLayout to draw.
location
System.Drawing.PointFThe location at which to draw the layout.
Fills an ellipse with a specified brush.
public void FillEllipse(RectangleF bounds, Brush brush, RectangleF? brushBounds = null, Matrix3x2? brushTransform = null)
bounds
System.Drawing.RectangleFA System.Drawing.RectangleF structure that specifies the ellipse to fill.
brush
BrushThe fill brush.
brushBounds
System.Drawing.RectangleF?The optional bounds for a gradient brush.
brushTransform
System.Numerics.Matrix3x2?The transformation applied to the brush.
Fills an ellipse with a specified solid color.
public void FillEllipse(RectangleF bounds, Color color)
bounds
System.Drawing.RectangleFA System.Drawing.RectangleF structure that specifies the ellipse to fill.
color
System.Drawing.ColorThe fill color.
Fills a path using a specified brush.
public void FillPath(IPath path, Brush brush, RectangleF? brushBounds = null, Matrix3x2? brushTransform = null)
path
IPathAn object implementing the IPath interface that represents the path to fill.
brush
BrushThe brush used to fill the path.
brushBounds
System.Drawing.RectangleF?The optional bounds for a gradient brush.
brushTransform
System.Numerics.Matrix3x2?The transformation applied to the brush.
Fills a path using a specified color.
public void FillPath(IPath path, Color color)
path
IPathAn object implementing the IPath interface that represents the path to fill.
color
System.Drawing.ColorThe color used to fill the path.
Fills a polygon specified by an array of points, using a specified brush and fill mode.
public void FillPolygon(Quadrilateral quadrilateral, Brush brush, RectangleF? brushBounds = null, Matrix3x2? brushTransform = null)
quadrilateral
QuadrilateralA quadrilateral specifying the polygon.
brush
BrushThe fill brush.
brushBounds
System.Drawing.RectangleF?The optional bounds for a gradient brush.
brushTransform
System.Numerics.Matrix3x2?The transformation applied to the brush.
Fills a polygon specified by an array of points, using a specified color and fill mode.
public void FillPolygon(Quadrilateral quadrilateral, Color color)
quadrilateral
QuadrilateralA quadrilateral specifying the polygon.
color
System.Drawing.ColorThe fill color.
Fills a polygon specified by an array of points, using a specified brush and fill mode.
public void FillPolygon(PointF[] points, Brush brush, FillMode fillMode = FillMode.Alternate, RectangleF? brushBounds = null, Matrix3x2? brushTransform = null)
points
System.Drawing.PointF[]An array of points specifying the polygon.
brush
BrushThe fill brush.
fillMode
FillModeThe fill mode (alternate by default).
brushBounds
System.Drawing.RectangleF?The optional bounds for a gradient brush.
brushTransform
System.Numerics.Matrix3x2?The transformation applied to the brush.
Fills a polygon specified by an array of points, using a specified color and fill mode.
public void FillPolygon(PointF[] points, Color color, FillMode fillMode = FillMode.Alternate)
points
System.Drawing.PointF[]An array of points specifying the polygon.
color
System.Drawing.ColorThe fill color.
fillMode
FillModeThe fill mode (alternate by default).
Fills a rectangle using a specified brush.
public void FillRectangle(RectangleF bounds, Brush brush, RectangleF? brushBounds = null, Matrix3x2? brushTransform = null)
bounds
System.Drawing.RectangleFA System.Drawing.RectangleF structure that represents the rectangle to fill.
brush
BrushThe brush to use.
brushBounds
System.Drawing.RectangleF?The optional bounds for a gradient brush.
brushTransform
System.Numerics.Matrix3x2?The transformation applied to the brush.
Fills a rectangle with a solid color.
public void FillRectangle(RectangleF bounds, Color color)
bounds
System.Drawing.RectangleFA System.Drawing.RectangleF structure that represents the rectangle to fill.
color
System.Drawing.ColorThe fill color.
Fills a rounded rectangle using a specified brush.
public void FillRoundRect(RectangleF bounds, float radius, Brush brush, RectangleF? brushBounds = null, Matrix3x2? brushTransform = null)
bounds
System.Drawing.RectangleFA System.Drawing.RectangleF structure that represents the rectangle to fill.
radius
floatThe radius for the quarter ellipse that is drawn to replace every corner of the rectangle.
brush
BrushThe brush to use.
brushBounds
System.Drawing.RectangleF?The optional bounds for a gradient brush.
brushTransform
System.Numerics.Matrix3x2?The transformation applied to the brush.
Fills a rounded rectangle witih a solid color.
public void FillRoundRect(RectangleF bounds, float radius, Color color)
bounds
System.Drawing.RectangleFA System.Drawing.RectangleF structure that represents the rectangle to fill.
radius
floatThe radius for the quarter ellipse that is drawn to replace every corner of the rectangle.
color
System.Drawing.ColorThe fill color.
Fills a rounded rectangle using a specified brush.
public void FillRoundRect(RectangleF bounds, float radiusX, float radiusY, Brush brush, RectangleF? brushBounds = null, Matrix3x2? brushTransform = null)
bounds
System.Drawing.RectangleFA System.Drawing.RectangleF structure that represents the rectangle to fill.
radiusX
floatThe x-radius for the quarter ellipse that is drawn to replace every corner of the rectangle.
radiusY
floatThe y-radius for the quarter ellipse that is drawn to replace every corner of the rectangle.
brush
BrushThe brush to use.
brushBounds
System.Drawing.RectangleF?The optional bounds for a gradient brush.
brushTransform
System.Numerics.Matrix3x2?The transformation applied to the brush.
Fills a rounded rectangle witih a solid color.
public void FillRoundRect(RectangleF bounds, float radiusX, float radiusY, Color color)
bounds
System.Drawing.RectangleFA System.Drawing.RectangleF structure that represents the rectangle to fill.
radiusX
floatThe x-radius for the quarter ellipse that is drawn to replace every corner of the rectangle.
radiusY
floatThe y-radius for the quarter ellipse that is drawn to replace every corner of the rectangle.
color
System.Drawing.ColorThe fill color.
Destroys the current instance.
protected ~GcGraphics()
For internal use. Returns the current blend mode.
protected virtual BlendMode GetBlendMode()
Returns the size of an image in pixels using the resolution of the current graphics.
public SizeF GetImageSize(IImage image)
image
IImageThe image to get the size of.
The size of the image, in current resolution pixels.
For internal use. Returns the current interpolation mode.
protected virtual InterpolationMode GetInterpolationMode()
For internal use.
protected abstract IClipRegion InternalCreateClipRegion(IPath graphicsPath)
graphicsPath
IPathFor internal use.
protected abstract IClipRegion InternalCreateClipRegion(RectangleF bounds)
bounds
System.Drawing.RectangleFFor internal use.
protected abstract IPath InternalCreatePath()
For internal use.
protected abstract void InternalDrawEllipse(RectangleF bounds, Pen pen)
bounds
System.Drawing.RectangleFpen
PenFor internal use.
protected abstract void InternalDrawImage(RectangleF dstRect, IImage image, float opacity)
dstRect
System.Drawing.RectangleFimage
IImageopacity
floatFor internal use.
protected abstract void InternalDrawLine(PointF p1, PointF p2, Pen pen)
p1
System.Drawing.PointFp2
System.Drawing.PointFpen
PenFor internal use.
protected abstract void InternalDrawLines(PointF[] points, Pen pen)
points
System.Drawing.PointF[]pen
PenFor internal use.
protected abstract void InternalDrawPath(IPath path, Pen pen)
For internal use.
protected abstract void InternalDrawPolygon(PointF[] points, Pen pen)
points
System.Drawing.PointF[]pen
PenFor internal use.
protected abstract void InternalDrawRectangle(RectangleF bounds, Pen pen)
bounds
System.Drawing.RectangleFpen
PenFor internal use.
protected abstract void InternalDrawRoundRect(RectangleF bounds, float radiusX, float radiusY, Pen pen)
bounds
System.Drawing.RectangleFradiusX
floatradiusY
floatpen
PenFor internal use.
protected abstract void InternalDrawTextLayout(TextLayout layout, PointF location)
layout
TextLayoutlocation
System.Drawing.PointFDraws a TextLayout at a specified location using graphic primitives.
protected virtual void InternalDrawTextLayoutAsPath(TextLayout layout, PointF location)
layout
TextLayoutThe TextLayout to draw.
location
System.Drawing.PointFThe location at which to draw the layout.
Draws a TextLine within a TextLayout at the specified location using graphic primitives.
protected virtual void InternalDrawTextLineAsPath(TextLayout layout, float k, TextLine line, float x, float y, RectangleF brushBounds, List<GcGraphics.SU> listStrikethrough, List<GcGraphics.SU> listUnderline)
layout
TextLayoutk
floatline
TextLinex
floaty
floatbrushBounds
System.Drawing.RectangleFlistStrikethrough
System.Collections.Generic.List<T><GcGraphics.SU>listUnderline
System.Collections.Generic.List<T><GcGraphics.SU>Fills a background of the text line.
protected virtual void InternalDrawTextLineBackground(TextLayout layout, float k, TextLine line, float x, float y)
layout
TextLayoutk
floatline
TextLinex
floaty
floatFor internal use.
protected abstract void InternalFillEllipse(RectangleF bounds, Brush brush, RectangleF? brushBounds, Matrix3x2? brushTransform)
bounds
System.Drawing.RectangleFbrush
BrushbrushBounds
System.Drawing.RectangleF?brushTransform
System.Numerics.Matrix3x2?For internal use.
protected abstract void InternalFillEllipse(RectangleF bounds, Color color)
bounds
System.Drawing.RectangleFcolor
System.Drawing.ColorFor internal use.
protected abstract void InternalFillPath(IPath path, Brush brush, RectangleF? brushBounds, Matrix3x2? brushTransform)
path
IPathbrush
BrushbrushBounds
System.Drawing.RectangleF?brushTransform
System.Numerics.Matrix3x2?For internal use.
protected abstract void InternalFillPath(IPath path, Color color)
path
IPathcolor
System.Drawing.ColorFor internal use.
protected abstract void InternalFillPolygon(PointF[] points, Brush brush, FillMode fillMode, RectangleF? brushBounds, Matrix3x2? brushTransform)
points
System.Drawing.PointF[]brush
BrushfillMode
FillModebrushBounds
System.Drawing.RectangleF?brushTransform
System.Numerics.Matrix3x2?For internal use.
protected abstract void InternalFillPolygon(PointF[] points, Color color, FillMode fillMode)
points
System.Drawing.PointF[]color
System.Drawing.ColorfillMode
FillModeFor internal use.
protected abstract void InternalFillRectangle(RectangleF bounds, Brush brush, RectangleF? brushBounds, Matrix3x2? brushTransform)
bounds
System.Drawing.RectangleFbrush
BrushbrushBounds
System.Drawing.RectangleF?brushTransform
System.Numerics.Matrix3x2?For internal use.
protected abstract void InternalFillRectangle(RectangleF bounds, Color color)
bounds
System.Drawing.RectangleFcolor
System.Drawing.ColorFor internal use.
protected abstract void InternalFillRoundRect(RectangleF bounds, float radiusX, float radiusY, Brush brush, RectangleF? brushBounds, Matrix3x2? brushTransform)
bounds
System.Drawing.RectangleFradiusX
floatradiusY
floatbrush
BrushbrushBounds
System.Drawing.RectangleF?brushTransform
System.Numerics.Matrix3x2?For internal use.
protected abstract void InternalFillRoundRect(RectangleF bounds, float radiusX, float radiusY, Color color)
bounds
System.Drawing.RectangleFradiusX
floatradiusY
floatcolor
System.Drawing.ColorFor internal use.
protected abstract void InternalRemoveClip(IClipRegion clipRegion)
clipRegion
IClipRegionFor internal use.
protected abstract void InternalSetClip(IClipRegion clipRegion)
clipRegion
IClipRegionIndicates whether this graphics implementation supports a specified blend mode.
public virtual bool IsBlendModeSupported(BlendMode blendMode)
blendMode
BlendModeThe blend mode to check.
true if the specified blend mode is supported by the current graphics, false otherwise.
Indicates whether this graphics implementation supports a specified interpolation mode.
public virtual bool IsInterpolationModeSupported(InterpolationMode interpolationMode)
interpolationMode
InterpolationModeThe interpolation mode to check.
true if the specified interpolation mode is supported by the current graphics, false otherwise.
Measures how an image will be drawn using the specified bounds and image alignment.
public RectangleF[] MeasureImage(IImage image, RectangleF destBounds, ImageAlign align)
image
IImageThe image to draw.
destBounds
System.Drawing.RectangleFThe destination rectangle.
align
ImageAlignThe image alignment.
The array of image bounds (can contain multiple rectangles if the image is tiled.
Calculates the bounds of rotated text inside an unrotated rectangle.
Note that the original textLayout
will be changed by this method. If necessary, create a clone in advance.
Also note that the values of the following properties are ignored: MaxWidth, MaxHeight, FlowDirection, CanSkipFirstLineWithIndentation, ObjectRects, ParagraphAlignment, MarginLeft, MarginRight, MarginTop, MarginBottom, ColumnWidth, RowHeight.
public RectangleF MeasureRotatedText(TextLayout textLayout, int angle, bool verticalStacking, RectangleF rect, RotatedTextAlignment alignment)
textLayout
TextLayoutThe TextLayout to measure.
angle
intThe text rotation angle, in degrees. The expected range is [-90, +90].
verticalStacking
boolIf false, text lines are stacked horizontally along the top and bottom sides of rect
.
If true, the lines are stacked vertically along the left and right sides of the rectangle.
rect
System.Drawing.RectangleFThe target rectangle for the text.
alignment
RotatedTextAlignmentAlignment of the text in the target rectangle.
The rectangle occupied by the rotated text.
Measures a string using a specified font, font size and layout width.
public SizeF MeasureString(string text, Font font, float fontSize, float? width = null)
text
stringThe string to measure.
font
FontThe font to use.
fontSize
floatThe font size to use.
width
float?The width allocated to draw the string, or null to indicate unlimited width.
The size needed to draw the string.
Measures a string using a specified TextFormat, available layout size and TextSplitOptions. Also calculates and returns in an output parameter the number of chars that fit into the specified size.
public SizeF MeasureString(string text, TextFormat textFormat, SizeF layoutSize, TextSplitOptions splitOptions, out int fitCharCount)
text
stringThe string to measure.
textFormat
TextFormatThe text format to use.
layoutSize
System.Drawing.SizeFThe maximum available size for the layout.
splitOptions
TextSplitOptionsThe options controlling how to split the text if it does not fit into the specified size.
fitCharCount
intOUT: The number of chars that fit into the specified size.
The actual size needed to draw the string.
Measures a string using a specified TextFormat, available layout size and default split options (see TextSplitOptions). Also calculates and returns in an output parameter the number of chars that fit into the specified size.
public SizeF MeasureString(string text, TextFormat textFormat, SizeF layoutSize, out int fitCharCount)
text
stringThe string to measure.
textFormat
TextFormatThe text format to use.
layoutSize
System.Drawing.SizeFThe maximum available size for the layout.
fitCharCount
intOUT: The number of chars that fit into the specified size.
The actual size needed to draw the string.
Measures a string using a specified TextFormat.
public SizeF MeasureString(string text, TextFormat textFormat, float? width = null)
text
stringThe string to measure.
textFormat
TextFormatThe text format to use.
width
float?The width allocated to draw the string, or null to indicate unlimited width.
The size needed to draw the string.
Measures a string using a specified font, font size and layout width, taking into account the trailing whitespace at the end of each line.
public SizeF MeasureStringWithTrailingWhitespace(string text, Font font, float fontSize, float? width = null)
text
stringThe string to measure.
font
FontThe font to use.
fontSize
floatThe font size to use.
width
float?The width allocated to draw the string, or null to indicate unlimited width.
The size needed to draw the string with trailing whitespace.
Measures a string using a specified TextFormat, taking into account the trailing whitespace at the end of each line.
public SizeF MeasureStringWithTrailingWhitespace(string text, TextFormat textFormat, float? width = null)
text
stringThe string to measure.
textFormat
TextFormatThe text format to use.
width
float?The width allocated to draw the string, or null to indicate unlimited width.
The size needed to draw the string with trailing whitespace.
Calculates the content bounds of a specified SVG document when its viewport is drawn at a specified point.
public RectangleF MeasureSvg(GcSvgDocument svgDocument, PointF viewportPosition)
svgDocument
GcSvgDocumentThe SVG document to measure.
viewportPosition
System.Drawing.PointFThe coordinates for the top-left corner of SVG viewport.
The content bounds of the resulting image.
Removes the last clip. After this method is called, the clip is no longer applied to subsequent drawing operations.
public void PopClip(IClipRegion clipRegion)
clipRegion
IClipRegionThe clipping region.
Stops redirecting drawing operations to the transparency layer that was created by the last PushTransparencyLayer(RectangleF?, float) call.
public virtual void PopTransparencyLayer()
Specifies a clipping region to which all subsequent drawing operations are clipped.
public void PushClip(IClipRegion clipRegion)
clipRegion
IClipRegionThe clipping region.
Specifies a path to which all subsequent drawing operations are clipped.
The GcGraphics.Clip object returned by this method implements IDisposable, so this method can be used with the 'using' pattern:
using (g.PushClip(...)) ...
in which case the clipping region will be removed when the returned object is disposed.
public GcGraphics.Clip PushClip(IPath clipPath)
The GcGraphics.Clip object that removes the clipping when disposed.
Specifies a rectangle to which all subsequent drawing operations are clipped.
Clipping is applied only if containerRect
does not contain clipRect
.
The GcGraphics.Clip object returned by this method implements IDisposable, so this method can be used with the 'using' pattern:
using (g.PushClip(...)) ...
in which case the clipping region will be removed when the returned object is disposed.
public GcGraphics.Clip PushClip(RectangleF clipRect, RectangleF containerRect)
clipRect
System.Drawing.RectangleFThe clipping rectangle.
containerRect
System.Drawing.RectangleFThe container rectangle.
The GcGraphics.Clip object that removes the clipping when disposed.
Specifies a rectangle to which all subsequent drawing operations are clipped.
The GcGraphics.Clip object returned by this method implements IDisposable, so this method can be used with the 'using' pattern:
using (g.PushClip(...)) ...
in which case the clipping region will be removed when the returned object is disposed.
public GcGraphics.Clip PushClip(RectangleF clipRect)
clipRect
System.Drawing.RectangleFThe clipping rectangle.
The GcGraphics.Clip object that removes the clipping when disposed.
Specifies a rectangle to which all subsequent drawing operations are clipped.
The GcGraphics.Clip object returned by this method implements IDisposable, so this method can be used with the 'using' pattern:
using (g.PushClip(...)) ...
in which case the clipping region will be removed when the returned object is disposed.
public GcGraphics.Clip PushClip(RectangleF? clipRect)
clipRect
System.Drawing.RectangleF?The clipping rectangle. If this parameter is null, this method does nothing and returns null.
The GcGraphics.Clip object that removes the clipping when disposed, or null.
Adds a transparency layer to the current graphics. That layer receives all subsequent drawing operations until PopTransparencyLayer() is called.
public virtual void PushTransparencyLayer(RectangleF? contentBounds, float opacity)
contentBounds
System.Drawing.RectangleF?The content bounds of the transparency layer. Content won't render outside these bounds. When set to null, the content bounds are effectively taken to be the bounds of the current graphics.
opacity
floatAn opacity value that is applied uniformly to all drawings in the layer when compositing to the backplate.
For internal use. Sets the current blend mode.
protected virtual void SetBlendMode(BlendMode value)
value
BlendModeFor internal use. Sets the current interpolation mode.
protected virtual void SetInterpolationMode(InterpolationMode value)
value
InterpolationMode