VectSharp 2.5.0
A light library for C# vector graphics
Loading...
Searching...
No Matches
VectSharp.Graphics Class Reference

Represents an abstract drawing surface. More...

Public Member Functions

void FillPath (GraphicsPath path, Brush fillColour, string tag=null)
 Fill a GraphicsPath. More...
 
void FillPath (GraphicsPath path, Brush fillColour, FillRule fillRule, string tag=null)
 Fill a GraphicsPath. More...
 
void StrokePath (GraphicsPath path, Brush strokeColour, double lineWidth=1, LineCaps lineCap=LineCaps.Butt, LineJoins lineJoin=LineJoins.Miter, LineDash? lineDash=null, string tag=null)
 Stroke a GraphicsPath. More...
 
void SetClippingPath (GraphicsPath path, string tag=null)
 Intersect the current clipping path with the specified GraphicsPath. More...
 
void SetClippingPath (double leftX, double topY, double width, double height, string tag=null)
 Intersect the current clipping path with the specified rectangle. More...
 
void SetClippingPath (Point topLeft, Size size, string tag=null)
 Intersect the current clipping path with the specified rectangle. More...
 
void Rotate (double angle, string tag=null)
 Rotate the coordinate system around the origin. More...
 
void RotateAt (double angle, Point pivot, string tag=null)
 Rotate the coordinate system around a pivot point. More...
 
void Transform (double a, double b, double c, double d, double e, double f, string tag=null)
 Transform the coordinate system with the specified transformation matrix [ [a, c, e], [b, d, f], [0, 0, 1] ]. More...
 
void Translate (double x, double y, string tag=null)
 Translate the coordinate system origin. More...
 
void Translate (Point delta, string tag=null)
 Translate the coordinate system origin. More...
 
void Scale (double scaleX, double scaleY, string tag=null)
 Scale the coordinate system with respect to the origin. More...
 
void FillRectangle (Point topLeft, Size size, Brush fillColour, string tag=null)
 Fill a rectangle. More...
 
void FillRectangle (double leftX, double topY, double width, double height, Brush fillColour, string tag=null)
 Fill a rectangle. More...
 
void StrokeRectangle (Point topLeft, Size size, Brush strokeColour, double lineWidth=1, LineCaps lineCap=LineCaps.Butt, LineJoins lineJoin=LineJoins.Miter, LineDash? lineDash=null, string tag=null)
 Stroke a rectangle. More...
 
void StrokeRectangle (double leftX, double topY, double width, double height, Brush strokeColour, double lineWidth=1, LineCaps lineCap=LineCaps.Butt, LineJoins lineJoin=LineJoins.Miter, LineDash? lineDash=null, string tag=null)
 Stroke a rectangle. More...
 
void DrawRasterImage (int sourceX, int sourceY, int sourceWidth, int sourceHeight, double destinationX, double destinationY, double destinationWidth, double destinationHeight, RasterImage image, string tag=null)
 Draw a raster image. More...
 
void DrawRasterImage (double x, double y, RasterImage image, string tag=null)
 Draw a raster image. More...
 
void DrawRasterImage (Point position, RasterImage image, string tag=null)
 Draw a raster image. More...
 
void DrawRasterImage (double x, double y, double width, double height, RasterImage image, string tag=null)
 Draw a raster image. More...
 
void DrawRasterImage (Point position, Size size, RasterImage image, string tag=null)
 Draw a raster image. More...
 
void Save ()
 Save the current transform state (rotation, translation, scale). More...
 
void Restore ()
 Restore the previous transform state (rotation, translation scale). More...
 
void CopyToIGraphicsContext (IGraphicsContext destinationContext)
 Copy the current graphics to an instance of a class implementing IGraphicsContext. More...
 
void DrawGraphics (Point origin, Graphics graphics)
 Draws a Graphics object on the current Graphics object. More...
 
void DrawGraphics (double originX, double originY, Graphics graphics, string tag)
 Draws a Graphics object on the current Graphics object, prepending the supplied tag to the tags contained in the Graphics object being drawn. More...
 
void DrawGraphics (Point origin, Graphics graphics, string tag)
 Draws a Graphics object on the current Graphics object, prepending the supplied tag to the tags contained in the Graphics object being drawn. More...
 
void DrawGraphics (double originX, double originY, Graphics graphics)
 Draws a Graphics object on the current Graphics object. More...
 
void DrawGraphics (Point origin, Graphics graphics, IFilter filter, string tag=null)
 Draws a Graphics object on the current Graphics object, applying the specified filter . More...
 
void DrawGraphics (double originX, double originY, Graphics graphics, IFilter filter, string tag=null)
 Draws a Graphics object on the current Graphics object, applying the specified filter . More...
 
Graphics Transform (Func< Point, Point > transformationFunction, double linearisationResolution)
 Creates a new Graphics object in which all the graphics actions have been transformed using an arbitrary transformation function. Raster images are replaced by grey rectangles. More...
 
Graphics Transform (Func< Point, Point > transformationFunction, double linearisationResolution, double maxSegmentLength)
 Creates a new Graphics object in which all the graphics actions have been transformed using an arbitrary transformation function. Raster images are replaced by grey rectangles. More...
 
Graphics Linearise (double resolution)
 Creates a new Graphics object by linearising all of the elements of the current instance, i.e. replacing curve segments with series of line segments that approximate them. Raster images are left unchanged. More...
 
Rectangle GetBounds ()
 Computes the rectangular bounds of the region affected by the drawing operations performed on the Graphics object. More...
 
bool TryRasterise (Rectangle region, double scale, bool interpolate, out RasterImage output)
 Tries to rasterise specified region of this Graphics object using the default rasterisation method. More...
 
void Crop (Rectangle region)
 Removes graphics actions that fall completely outside of the specified region . More...
 
void Crop (Point topLeft, Size size)
 Removes graphics actions that fall completely outside of the specified region. More...
 
IEnumerable< string > GetTags ()
 Gets all the tags that have been defined in the Graphics. More...
 
void FillText (Point origin, string text, Font font, Brush fillColour, TextBaselines textBaseline=TextBaselines.Top, string tag=null)
 Fill a text string. More...
 
void FillText (double originX, double originY, string text, Font font, Brush fillColour, TextBaselines textBaseline=TextBaselines.Top, string tag=null)
 Fill a text string. More...
 
void StrokeText (Point origin, string text, Font font, Brush strokeColour, TextBaselines textBaseline=TextBaselines.Top, double lineWidth=1, LineCaps lineCap=LineCaps.Butt, LineJoins lineJoin=LineJoins.Miter, LineDash? lineDash=null, string tag=null)
 Stroke a text string. More...
 
void StrokeText (double originX, double originY, string text, Font font, Brush strokeColour, TextBaselines textBaseline=TextBaselines.Top, double lineWidth=1, LineCaps lineCap=LineCaps.Butt, LineJoins lineJoin=LineJoins.Miter, LineDash? lineDash=null, string tag=null)
 Stroke a text string. More...
 
void FillTextOnPath (GraphicsPath path, string text, Font font, Brush fillColour, double reference=0, TextAnchors anchor=TextAnchors.Left, TextBaselines textBaseline=TextBaselines.Top, string tag=null)
 Fill a text string along a GraphicsPath. More...
 
void StrokeTextOnPath (GraphicsPath path, string text, Font font, Brush strokeColour, double reference=0, TextAnchors anchor=TextAnchors.Left, TextBaselines textBaseline=TextBaselines.Top, double lineWidth=1, LineCaps lineCap=LineCaps.Butt, LineJoins lineJoin=LineJoins.Miter, LineDash? lineDash=null, string tag=null)
 Stroke a text string along a GraphicsPath. More...
 
void FillText (Point origin, IEnumerable< FormattedText > text, Brush fillColour, TextBaselines textBaseline=TextBaselines.Top, string tag=null)
 Fill a formatted text string. More...
 
void FillText (double originX, double originY, IEnumerable< FormattedText > text, Brush fillColour, TextBaselines textBaseline=TextBaselines.Top, string tag=null)
 Fill a formatted text string. More...
 
void StrokeText (Point origin, IEnumerable< FormattedText > text, Brush strokeColour, TextBaselines textBaseline=TextBaselines.Top, double lineWidth=1, LineCaps lineCap=LineCaps.Butt, LineJoins lineJoin=LineJoins.Miter, LineDash? lineDash=null, string tag=null)
 Stroke a formatted text string. More...
 
void StrokeText (double originX, double originY, IEnumerable< FormattedText > text, Brush strokeColour, TextBaselines textBaseline=TextBaselines.Top, double lineWidth=1, LineCaps lineCap=LineCaps.Butt, LineJoins lineJoin=LineJoins.Miter, LineDash? lineDash=null, string tag=null)
 Stroke a formatted text string. More...
 
Size MeasureText (string text, Font font)
 Measure a text string. See also

See also
Font.MeasureText(string), Font.MeasureTextAdvanced(string)

and . More...

 
Size MeasureText (IEnumerable< FormattedText > text)
 Measure a formatted text string. See also

See also
FormattedTextExtensions.Measure(IEnumerable<FormattedText>)

. More...

 
void FillTextUnderline (double originX, double originY, string text, Font font, Brush fillColour, TextBaselines textBaseline=TextBaselines.Top, string tag=null)
 Fills the underline of the specified text string. More...
 
void FillTextUnderline (Point origin, string text, Font font, Brush fillColour, TextBaselines textBaseline=TextBaselines.Top, string tag=null)
 Fills the underline of the specified text string. More...
 
void StrokeTextUnderline (double originX, double originY, string text, Font font, Brush strokeColour, TextBaselines textBaseline=TextBaselines.Top, double lineWidth=1, LineCaps lineCap=LineCaps.Butt, LineJoins lineJoin=LineJoins.Miter, LineDash? lineDash=null, string tag=null)
 Stroke the underline of the specified text string. More...
 
void StrokeTextUnderline (Point origin, string text, Font font, Brush strokeColour, TextBaselines textBaseline=TextBaselines.Top, double lineWidth=1, LineCaps lineCap=LineCaps.Butt, LineJoins lineJoin=LineJoins.Miter, LineDash? lineDash=null, string tag=null)
 Stroke the underline of the specified text string. More...
 
void FillTextUnderline (double originX, double originY, IEnumerable< FormattedText > text, Brush fillColour, TextBaselines textBaseline=TextBaselines.Top, string tag=null)
 Fill the underline of the specified formatted text string. More...
 
void FillTextUnderline (Point origin, IEnumerable< FormattedText > text, Brush fillColour, TextBaselines textBaseline=TextBaselines.Top, string tag=null)
 Fill the underline of the specified formatted text string. More...
 
void StrokeTextUnderline (double originX, double originY, IEnumerable< FormattedText > text, Brush strokeColour, TextBaselines textBaseline=TextBaselines.Top, double lineWidth=1, LineCaps lineCap=LineCaps.Butt, LineJoins lineJoin=LineJoins.Miter, LineDash? lineDash=null, string tag=null)
 Stroke the underline of the specified formatted text string. More...
 
void StrokeTextUnderline (Point origin, IEnumerable< FormattedText > text, Brush strokeColour, TextBaselines textBaseline=TextBaselines.Top, double lineWidth=1, LineCaps lineCap=LineCaps.Butt, LineJoins lineJoin=LineJoins.Miter, LineDash? lineDash=null, string tag=null)
 Stroke the underline of the specified formatted text string. More...
 

Static Public Attributes

static Func< Graphics, Rectangle, double, bool, RasterImageRasterisationMethod = null
 A method that is used to rasterise a region of a Graphics object. Set this to null if you wish to use the default rasterisation methods (implemented by either VectSharp.Raster, or VectSharp.Raster.ImageSharp). You will have to provide your own implementation of this method if neither VectSharp.Raster nor VectSharp.Raster.ImageSharp are referenced by your project. The first argument of this method is the Graphics to be rasterised, the second is a Rectangle representing the region to rasterise, the third is a double representing the scale, and the third is a boolean value indicating whether the resulting RasterImage should be interpolated. More...
 

Properties

static UnbalancedStackActions UnbalancedStackAction = UnbalancedStackActions.Throw [get, set]
 Determines how an unbalanced graphics state stack (which occurs if the number of calls to Save and Restore is not equal) will be treated. The default is UnbalancedStackActions.Throw. More...
 
FillRule DefaultFillRule = FillRule.NonZeroWinding [get, set]
 The default fill rule. More...
 
bool UseUniqueTags = true [get, set]
 Determines whether unique tags should be used for graphics actions that create multiple objects (e.g. drawing text). More...
 

Detailed Description

Represents an abstract drawing surface.

Definition at line 278 of file Graphics.cs.

Member Function Documentation

◆ CopyToIGraphicsContext()

void VectSharp.Graphics.CopyToIGraphicsContext ( IGraphicsContext  destinationContext)

Copy the current graphics to an instance of a class implementing IGraphicsContext.

Parameters
destinationContextThe IGraphicsContext on which the graphics are to be copied.

Definition at line 666 of file Graphics.cs.

◆ Crop() [1/2]

void VectSharp.Graphics.Crop ( Point  topLeft,
Size  size 
)

Removes graphics actions that fall completely outside of the specified region.

Parameters
topLeftThe top-left corner of the area to preserve.
sizeThe size of the area to preserve.

Definition at line 1695 of file Graphics.cs.

◆ Crop() [2/2]

void VectSharp.Graphics.Crop ( Rectangle  region)

Removes graphics actions that fall completely outside of the specified region .

Parameters
regionThe area to preserve.

Definition at line 1606 of file Graphics.cs.

◆ DrawGraphics() [1/6]

void VectSharp.Graphics.DrawGraphics ( double  originX,
double  originY,
Graphics  graphics 
)

Draws a Graphics object on the current Graphics object.

Parameters
originXThe horizontal coordinate at which to place the origin of graphics .
originYThe vertical coordinate at which to place the origin of graphics .
graphicsThe Graphics object to draw on the current Graphics object.

Definition at line 950 of file Graphics.cs.

◆ DrawGraphics() [2/6]

void VectSharp.Graphics.DrawGraphics ( double  originX,
double  originY,
Graphics  graphics,
IFilter  filter,
string  tag = null 
)

Draws a Graphics object on the current Graphics object, applying the specified filter .

Parameters
originXThe horizontal coordinate at which to place the origin of graphics .
originYThe vertical coordinate at which to place the origin of graphics .
graphicsThe Graphics object to draw on the current Graphics object.
filterAn IFilter object, representing the filter to apply to the graphics object.
tagA tag to identify the filter.

Definition at line 992 of file Graphics.cs.

◆ DrawGraphics() [3/6]

void VectSharp.Graphics.DrawGraphics ( double  originX,
double  originY,
Graphics  graphics,
string  tag 
)

Draws a Graphics object on the current Graphics object, prepending the supplied tag to the tags contained in the Graphics object being drawn.

Parameters
originXThe horizontal coordinate at which to place the origin of graphics .
originYThe vertical coordinate at which to place the origin of graphics .
graphicsThe Graphics object to draw on the current Graphics object.
tagThe tag to prepend to the tags contained in the graphics object.

Definition at line 893 of file Graphics.cs.

◆ DrawGraphics() [4/6]

void VectSharp.Graphics.DrawGraphics ( Point  origin,
Graphics  graphics 
)

Draws a Graphics object on the current Graphics object.

Parameters
originThe point at which to place the origin of graphics .
graphicsThe Graphics object to draw on the current Graphics object.

Definition at line 874 of file Graphics.cs.

◆ DrawGraphics() [5/6]

void VectSharp.Graphics.DrawGraphics ( Point  origin,
Graphics  graphics,
IFilter  filter,
string  tag = null 
)

Draws a Graphics object on the current Graphics object, applying the specified filter .

Parameters
originThe point at which to place the origin of graphics .
graphicsThe Graphics object to draw on the current Graphics object.
filterAn IFilter object, representing the filter to apply to the graphics object.
tagA tag to identify the filter.

Definition at line 962 of file Graphics.cs.

◆ DrawGraphics() [6/6]

void VectSharp.Graphics.DrawGraphics ( Point  origin,
Graphics  graphics,
string  tag 
)

Draws a Graphics object on the current Graphics object, prepending the supplied tag to the tags contained in the Graphics object being drawn.

Parameters
originThe point at which to place the origin of graphics .
graphicsThe Graphics object to draw on the current Graphics object.
tagThe tag to prepend to the tags contained in the graphics object.

Definition at line 904 of file Graphics.cs.

◆ DrawRasterImage() [1/5]

void VectSharp.Graphics.DrawRasterImage ( double  x,
double  y,
double  width,
double  height,
RasterImage  image,
string  tag = null 
)

Draw a raster image.

Parameters
xThe horizontal coordinate of the top-left corner of the rectangle delimiting the destination area of the image.
yThe vertical coordinate of the top-left corner of the rectangle delimiting the destination area of the image.
widthThe width of the rectangle delimiting the destination area of the image.
heightThe height of the rectangle delimiting the destination area of the image.
imageThe image to draw.
tagA tag to identify the drawn image.

Definition at line 571 of file Graphics.cs.

◆ DrawRasterImage() [2/5]

void VectSharp.Graphics.DrawRasterImage ( double  x,
double  y,
RasterImage  image,
string  tag = null 
)

Draw a raster image.

Parameters
xThe horizontal coordinate of the top-left corner of the rectangle delimiting the destination area of the image.
yThe vertical coordinate of the top-left corner of the rectangle delimiting the destination area of the image.
imageThe image to draw.
tagA tag to identify the drawn image.

Definition at line 546 of file Graphics.cs.

◆ DrawRasterImage() [3/5]

void VectSharp.Graphics.DrawRasterImage ( int  sourceX,
int  sourceY,
int  sourceWidth,
int  sourceHeight,
double  destinationX,
double  destinationY,
double  destinationWidth,
double  destinationHeight,
RasterImage  image,
string  tag = null 
)

Draw a raster image.

Parameters
sourceXThe horizontal coordinate of the top-left corner of the rectangle delimiting the source area of the image.
sourceYThe vertical coordinate of the top-left corner of the rectangle delimiting the source area of the image.
sourceWidthThe width of the rectangle delimiting the source area of the image.
sourceHeightThe height of the rectangle delimiting the source area of the image.
destinationXThe horizontal coordinate of the top-left corner of the rectangle delimiting the destination area of the image.
destinationYThe vertical coordinate of the top-left corner of the rectangle delimiting the destination area of the image.
destinationWidthThe width of the rectangle delimiting the destination area of the image.
destinationHeightThe height of the rectangle delimiting the destination area of the image.
imageThe image to draw.
tagA tag to identify the drawn image.

Definition at line 534 of file Graphics.cs.

◆ DrawRasterImage() [4/5]

void VectSharp.Graphics.DrawRasterImage ( Point  position,
RasterImage  image,
string  tag = null 
)

Draw a raster image.

Parameters
positionThe the top-left corner of the rectangle delimiting the destination area of the image.
imageThe image to draw.
tagA tag to identify the drawn image.

Definition at line 557 of file Graphics.cs.

◆ DrawRasterImage() [5/5]

void VectSharp.Graphics.DrawRasterImage ( Point  position,
Size  size,
RasterImage  image,
string  tag = null 
)

Draw a raster image.

Parameters
positionThe the top-left corner of the rectangle delimiting the destination area of the image.
sizeThe size of the rectangle delimiting the destination area of the image.
imageThe image to draw.
tagA tag to identify the drawn image.

Definition at line 583 of file Graphics.cs.

◆ FillPath() [1/2]

void VectSharp.Graphics.FillPath ( GraphicsPath  path,
Brush  fillColour,
FillRule  fillRule,
string  tag = null 
)

Fill a GraphicsPath.

Parameters
pathThe GraphicsPath to fill.
fillColourThe Brush with which to fill the GraphicsPath.
fillRuleThe FillRule that determines which parts of the path are filled.
tagA tag to identify the filled path.

Definition at line 310 of file Graphics.cs.

◆ FillPath() [2/2]

void VectSharp.Graphics.FillPath ( GraphicsPath  path,
Brush  fillColour,
string  tag = null 
)

Fill a GraphicsPath.

Parameters
pathThe GraphicsPath to fill.
fillColourThe Brush with which to fill the GraphicsPath.
tagA tag to identify the filled path.

Definition at line 298 of file Graphics.cs.

◆ FillRectangle() [1/2]

void VectSharp.Graphics.FillRectangle ( double  leftX,
double  topY,
double  width,
double  height,
Brush  fillColour,
string  tag = null 
)

Fill a rectangle.

Parameters
leftXThe horizontal coordinate of the top-left corner of the rectangle.
topYThe vertical coordinate of the top-left corner of the rectangle.
widthThe width of the rectangle.
heightThe height of the rectangle.
fillColourThe colour with which to fill the rectangle.
tagA tag to identify the filled rectangle.

Definition at line 482 of file Graphics.cs.

◆ FillRectangle() [2/2]

void VectSharp.Graphics.FillRectangle ( Point  topLeft,
Size  size,
Brush  fillColour,
string  tag = null 
)

Fill a rectangle.

Parameters
topLeftThe top-left corner of the rectangle.
sizeThe size of the rectangle.
fillColourThe colour with which to fill the rectangle.
tagA tag to identify the filled rectangle.

Definition at line 468 of file Graphics.cs.

◆ FillText() [1/4]

void VectSharp.Graphics.FillText ( double  originX,
double  originY,
IEnumerable< FormattedText text,
Brush  fillColour,
TextBaselines  textBaseline = TextBaselines.Top,
string  tag = null 
)

Fill a formatted text string.

Parameters
originXThe horizontal coordinate of the text origin.
originYThe vertical coordinate of the text origin. See textBaseline .
textThe FormattedText to draw.
fillColourThe default Brush to use to fill the text. This can be overridden by each text element.
textBaselineThe text baseline (determines what originY represents).
tagA tag to identify the filled text.

Definition at line 512 of file Graphics.Text.cs.

◆ FillText() [2/4]

void VectSharp.Graphics.FillText ( double  originX,
double  originY,
string  text,
Font  font,
Brush  fillColour,
TextBaselines  textBaseline = TextBaselines.Top,
string  tag = null 
)

Fill a text string.

Parameters
originXThe horizontal coordinate of the text origin.
originYThe vertical coordinate of the text origin. See textBaseline .
textThe string to draw.
fontThe font with which to draw the text.
fillColourThe Brush to use to fill the text.
textBaselineThe text baseline (determines what originY represents).
tagA tag to identify the filled text.

Definition at line 57 of file Graphics.Text.cs.

◆ FillText() [3/4]

void VectSharp.Graphics.FillText ( Point  origin,
IEnumerable< FormattedText text,
Brush  fillColour,
TextBaselines  textBaseline = TextBaselines.Top,
string  tag = null 
)

Fill a formatted text string.

Parameters
originThe text origin. See textBaseline .
textThe FormattedText to draw.
fillColourThe default Brush to use to fill the text. This can be overridden by each text element.
textBaselineThe text baseline (determines what the vertical component of origin represents).
tagA tag to identify the filled text.

Definition at line 411 of file Graphics.Text.cs.

◆ FillText() [4/4]

void VectSharp.Graphics.FillText ( Point  origin,
string  text,
Font  font,
Brush  fillColour,
TextBaselines  textBaseline = TextBaselines.Top,
string  tag = null 
)

Fill a text string.

Parameters
originThe text origin. See textBaseline .
textThe string to draw.
fontThe font with which to draw the text.
fillColourThe Brush to use to fill the text.
textBaselineThe text baseline (determines what the vertical component of origin represents).
tagA tag to identify the filled text.

Definition at line 34 of file Graphics.Text.cs.

◆ FillTextOnPath()

void VectSharp.Graphics.FillTextOnPath ( GraphicsPath  path,
string  text,
Font  font,
Brush  fillColour,
double  reference = 0,
TextAnchors  anchor = TextAnchors.Left,
TextBaselines  textBaseline = TextBaselines.Top,
string  tag = null 
)

Fill a text string along a GraphicsPath.

Parameters
pathThe GraphicsPath along which the text will flow.
textThe string to draw.
fontThe font with which to draw the text.
fillColourThe Brush to use to fill the text.
referenceThe (relative) starting point on the path starting from which the text should be drawn (0 is the start of the path, 1 is the end of the path).
anchorThe anchor in the text string that will correspond to the point specified by the reference .
textBaselineThe text baseline (determines which the position of the text in relation to the path .
tagA tag to identify the filled text.

Definition at line 134 of file Graphics.Text.cs.

◆ FillTextUnderline() [1/4]

void VectSharp.Graphics.FillTextUnderline ( double  originX,
double  originY,
IEnumerable< FormattedText text,
Brush  fillColour,
TextBaselines  textBaseline = TextBaselines.Top,
string  tag = null 
)

Fill the underline of the specified formatted text string.

Parameters
originXThe horizontal coordinate of the text origin.
originYThe vertical coordinate of the text origin. See textBaseline .
textThe FormattedText whose underline will be drawn.
fillColourThe default Brush to use to fill the underline. This can be overridden by each text element.
textBaselineThe text baseline (determines what originY represents).
tagA tag to identify the filled underlined.

Definition at line 754 of file Graphics.Text.cs.

◆ FillTextUnderline() [2/4]

void VectSharp.Graphics.FillTextUnderline ( double  originX,
double  originY,
string  text,
Font  font,
Brush  fillColour,
TextBaselines  textBaseline = TextBaselines.Top,
string  tag = null 
)

Fills the underline of the specified text string.

Parameters
originXThe horizontal coordinate of the text origin.
originYThe vertical coordinate of the text origin. See textBaseline .
textThe string whose underline will be draw.
fontThe font with which to draw the text.
fillColourThe Brush to use to fill the underline.
textBaselineThe text baseline (determines what originY represents).
tagA tag to identify the filled underline.

Definition at line 680 of file Graphics.Text.cs.

◆ FillTextUnderline() [3/4]

void VectSharp.Graphics.FillTextUnderline ( Point  origin,
IEnumerable< FormattedText text,
Brush  fillColour,
TextBaselines  textBaseline = TextBaselines.Top,
string  tag = null 
)

Fill the underline of the specified formatted text string.

Parameters
originThe text origin. See textBaseline .
textThe FormattedText whose underline will be drawn.
fillColourThe default Brush to use to fill the underline. This can be overridden by each text element.
textBaselineThe text baseline (determines what the vertical component of origin represents).
tagA tag to identify the filled underlined.

Definition at line 767 of file Graphics.Text.cs.

◆ FillTextUnderline() [4/4]

void VectSharp.Graphics.FillTextUnderline ( Point  origin,
string  text,
Font  font,
Brush  fillColour,
TextBaselines  textBaseline = TextBaselines.Top,
string  tag = null 
)

Fills the underline of the specified text string.

Parameters
originThe text origin. See textBaseline .
textThe string whose underline will be draw.
fontThe font with which to draw the text.
fillColourThe Brush to use to fill the underline.
textBaselineThe text baseline (determines what the vertical component of origin represents).
tagA tag to identify the filled underline.

Definition at line 694 of file Graphics.Text.cs.

◆ GetBounds()

Rectangle VectSharp.Graphics.GetBounds ( )

Computes the rectangular bounds of the region affected by the drawing operations performed on the Graphics object.

Returns
The smallest rectangle that contains all the elements drawn on the Graphics.

Definition at line 1453 of file Graphics.cs.

◆ GetTags()

IEnumerable< string > VectSharp.Graphics.GetTags ( )

Gets all the tags that have been defined in the Graphics.

Returns
An IEnumerable<T> of strings that, when enumerated, returns all the tags that have been defined in the Graphics.

Definition at line 1705 of file Graphics.cs.

◆ Linearise()

Graphics VectSharp.Graphics.Linearise ( double  resolution)

Creates a new Graphics object by linearising all of the elements of the current instance, i.e. replacing curve segments with series of line segments that approximate them. Raster images are left unchanged.

Parameters
resolutionThe resolution that will be used to linearise curve segments.
Returns
A new Graphics object containing the linearised elements.

Definition at line 1397 of file Graphics.cs.

◆ MeasureText() [1/2]

Size VectSharp.Graphics.MeasureText ( IEnumerable< FormattedText text)

Measure a formatted text string. See also

See also
FormattedTextExtensions.Measure(IEnumerable<FormattedText>)

.

Parameters
textThe collection of FormattedText objects to measure.
Returns
The size of the measured text .

Definition at line 663 of file Graphics.Text.cs.

◆ MeasureText() [2/2]

Size VectSharp.Graphics.MeasureText ( string  text,
Font  font 
)

Measure a text string. See also

See also
Font.MeasureText(string), Font.MeasureTextAdvanced(string)

and .

Parameters
textThe string to measure.
fontThe font to use to measure the string.
Returns
The size of the measured text .

Definition at line 645 of file Graphics.Text.cs.

◆ Restore()

void VectSharp.Graphics.Restore ( )

Restore the previous transform state (rotation, translation scale).

Definition at line 599 of file Graphics.cs.

◆ Rotate()

void VectSharp.Graphics.Rotate ( double  angle,
string  tag = null 
)

Rotate the coordinate system around the origin.

Parameters
angleThe angle (in radians) by which to rotate the coordinate system.
tagA tag to identify the transform.

Definition at line 374 of file Graphics.cs.

◆ RotateAt()

void VectSharp.Graphics.RotateAt ( double  angle,
Point  pivot,
string  tag = null 
)

Rotate the coordinate system around a pivot point.

Parameters
angleThe angle (in radians) by which to rotate the coordinate system.
pivotThe pivot around which the coordinate system is to be rotated.
tagA tag to identify the transform.

Definition at line 385 of file Graphics.cs.

◆ Save()

void VectSharp.Graphics.Save ( )

Save the current transform state (rotation, translation, scale).

Definition at line 591 of file Graphics.cs.

◆ Scale()

void VectSharp.Graphics.Scale ( double  scaleX,
double  scaleY,
string  tag = null 
)

Scale the coordinate system with respect to the origin.

Parameters
scaleXThe horizontal scale.
scaleYThe vertical scale.
tagA tag to identify the transform.

Definition at line 456 of file Graphics.cs.

◆ SetClippingPath() [1/3]

void VectSharp.Graphics.SetClippingPath ( double  leftX,
double  topY,
double  width,
double  height,
string  tag = null 
)

Intersect the current clipping path with the specified rectangle.

Parameters
leftXThe horizontal coordinate of the top-left corner of the rectangle.
topYThe vertical coordinate of the top-left corner of the rectangle.
widthThe width of the rectangle.
heightThe height of the rectangle.
tagA tag to identify the clipping path.

Definition at line 353 of file Graphics.cs.

◆ SetClippingPath() [2/3]

void VectSharp.Graphics.SetClippingPath ( GraphicsPath  path,
string  tag = null 
)

Intersect the current clipping path with the specified GraphicsPath.

Parameters
pathThe GraphicsPath to intersect with the current clipping path.
tagA tag to identify the clipping path.

Definition at line 340 of file Graphics.cs.

◆ SetClippingPath() [3/3]

void VectSharp.Graphics.SetClippingPath ( Point  topLeft,
Size  size,
string  tag = null 
)

Intersect the current clipping path with the specified rectangle.

Parameters
topLeftThe top-left corner of the rectangle.
sizeThe size of the rectangle.
tagA tag to identify the clipping path.

Definition at line 364 of file Graphics.cs.

◆ StrokePath()

void VectSharp.Graphics.StrokePath ( GraphicsPath  path,
Brush  strokeColour,
double  lineWidth = 1,
LineCaps  lineCap = LineCaps.Butt,
LineJoins  lineJoin = LineJoins.Miter,
LineDash lineDash = null,
string  tag = null 
)

Stroke a GraphicsPath.

Parameters
pathThe GraphicsPath to stroke.
strokeColourThe Brush with which to stroke the GraphicsPath.
lineWidthThe width of the line with which the path is stroked.
lineCapThe line cap to use to stroke the path.
lineJoinThe line join to use to stroke the path.
lineDashThe line dash to use to stroke the path.
tagA tag to identify the stroked path.

Definition at line 330 of file Graphics.cs.

◆ StrokeRectangle() [1/2]

void VectSharp.Graphics.StrokeRectangle ( double  leftX,
double  topY,
double  width,
double  height,
Brush  strokeColour,
double  lineWidth = 1,
LineCaps  lineCap = LineCaps.Butt,
LineJoins  lineJoin = LineJoins.Miter,
LineDash lineDash = null,
string  tag = null 
)

Stroke a rectangle.

Parameters
leftXThe horizontal coordinate of the top-left corner of the rectangle.
topYThe vertical coordinate of the top-left corner of the rectangle.
widthThe width of the rectangle.
heightThe height of the rectangle.
strokeColourThe colour with which to stroke the rectangle.
lineWidthThe width of the line with which the rectangle is stroked.
lineCapThe line cap to use to stroke the rectangle.
lineJoinThe line join to use to stroke the rectangle.
lineDashThe line dash to use to stroke the rectangle.
tagA tag to identify the filled rectangle.

Definition at line 516 of file Graphics.cs.

◆ StrokeRectangle() [2/2]

void VectSharp.Graphics.StrokeRectangle ( Point  topLeft,
Size  size,
Brush  strokeColour,
double  lineWidth = 1,
LineCaps  lineCap = LineCaps.Butt,
LineJoins  lineJoin = LineJoins.Miter,
LineDash lineDash = null,
string  tag = null 
)

Stroke a rectangle.

Parameters
topLeftThe top-left corner of the rectangle.
sizeThe size of the rectangle.
strokeColourThe colour with which to stroke the rectangle.
lineWidthThe width of the line with which the rectangle is stroked.
lineCapThe line cap to use to stroke the rectangle.
lineJoinThe line join to use to stroke the rectangle.
lineDashThe line dash to use to stroke the rectangle.
tagA tag to identify the filled rectangle.

Definition at line 498 of file Graphics.cs.

◆ StrokeText() [1/4]

void VectSharp.Graphics.StrokeText ( double  originX,
double  originY,
IEnumerable< FormattedText text,
Brush  strokeColour,
TextBaselines  textBaseline = TextBaselines.Top,
double  lineWidth = 1,
LineCaps  lineCap = LineCaps.Butt,
LineJoins  lineJoin = LineJoins.Miter,
LineDash lineDash = null,
string  tag = null 
)

Stroke a formatted text string.

Parameters
originXThe horizontal coordinate of the text origin.
originYThe vertical coordinate of the text origin. See textBaseline .
textThe FormattedText to draw.
strokeColourThe default Brush with which to stroke the text.
lineWidthThe width of the line with which the text is stroked.
lineCapThe line cap to use to stroke the text.
lineJoinThe line join to use to stroke the text.
lineDashThe line dash to use to stroke the text.
textBaselineThe text baseline (determines what originY represents).
tagA tag to identify the stroked text.

Definition at line 633 of file Graphics.Text.cs.

◆ StrokeText() [2/4]

void VectSharp.Graphics.StrokeText ( double  originX,
double  originY,
string  text,
Font  font,
Brush  strokeColour,
TextBaselines  textBaseline = TextBaselines.Top,
double  lineWidth = 1,
LineCaps  lineCap = LineCaps.Butt,
LineJoins  lineJoin = LineJoins.Miter,
LineDash lineDash = null,
string  tag = null 
)

Stroke a text string.

Parameters
originXThe horizontal coordinate of the text origin.
originYThe vertical coordinate of the text origin. See textBaseline .
textThe string to draw.
fontThe font with which to draw the text.
strokeColourThe Brush with which to stroke the text.
lineWidthThe width of the line with which the text is stroked.
lineCapThe line cap to use to stroke the text.
lineJoinThe line join to use to stroke the text.
lineDashThe line dash to use to stroke the text.
textBaselineThe text baseline (determines what originY represents).
tagA tag to identify the stroked text.

Definition at line 110 of file Graphics.Text.cs.

◆ StrokeText() [3/4]

void VectSharp.Graphics.StrokeText ( Point  origin,
IEnumerable< FormattedText text,
Brush  strokeColour,
TextBaselines  textBaseline = TextBaselines.Top,
double  lineWidth = 1,
LineCaps  lineCap = LineCaps.Butt,
LineJoins  lineJoin = LineJoins.Miter,
LineDash lineDash = null,
string  tag = null 
)

Stroke a formatted text string.

Parameters
originThe text origin. See textBaseline .
textThe FormattedText to draw.
strokeColourThe default Brush with which to stroke the text.
lineWidthThe width of the line with which the text is stroked.
lineCapThe line cap to use to stroke the text.
lineJoinThe line join to use to stroke the text.
lineDashThe line dash to use to stroke the text.
textBaselineThe text baseline (determines what the vertical component of origin represents).
tagA tag to identify the stroked text.

Definition at line 529 of file Graphics.Text.cs.

◆ StrokeText() [4/4]

void VectSharp.Graphics.StrokeText ( Point  origin,
string  text,
Font  font,
Brush  strokeColour,
TextBaselines  textBaseline = TextBaselines.Top,
double  lineWidth = 1,
LineCaps  lineCap = LineCaps.Butt,
LineJoins  lineJoin = LineJoins.Miter,
LineDash lineDash = null,
string  tag = null 
)

Stroke a text string.

Parameters
originThe text origin. See textBaseline .
textThe string to draw.
fontThe font with which to draw the text.
strokeColourThe Brush with which to stroke the text.
lineWidthThe width of the line with which the text is stroked.
lineCapThe line cap to use to stroke the text.
lineJoinThe line join to use to stroke the text.
lineDashThe line dash to use to stroke the text.
textBaselineThe text baseline (determines what the vertical component of origin represents).
tagA tag to identify the stroked text.

Definition at line 83 of file Graphics.Text.cs.

◆ StrokeTextOnPath()

void VectSharp.Graphics.StrokeTextOnPath ( GraphicsPath  path,
string  text,
Font  font,
Brush  strokeColour,
double  reference = 0,
TextAnchors  anchor = TextAnchors.Left,
TextBaselines  textBaseline = TextBaselines.Top,
double  lineWidth = 1,
LineCaps  lineCap = LineCaps.Butt,
LineJoins  lineJoin = LineJoins.Miter,
LineDash lineDash = null,
string  tag = null 
)

Stroke a text string along a GraphicsPath.

Parameters
pathThe GraphicsPath along which the text will flow.
textThe string to draw.
fontThe font with which to draw the text.
strokeColourThe Brush with which to stroke the text.
lineWidthThe width of the line with which the text is stroked.
lineCapThe line cap to use to stroke the text.
lineJoinThe line join to use to stroke the text.
lineDashThe line dash to use to stroke the text.
referenceThe (relative) starting point on the path starting from which the text should be drawn (0 is the start of the path, 1 is the end of the path).
anchorThe anchor in the text string that will correspond to the point specified by the reference .
textBaselineThe text baseline (determines which the position of the text in relation to the path .
tagA tag to identify the stroked text.

Definition at line 276 of file Graphics.Text.cs.

◆ StrokeTextUnderline() [1/4]

void VectSharp.Graphics.StrokeTextUnderline ( double  originX,
double  originY,
IEnumerable< FormattedText text,
Brush  strokeColour,
TextBaselines  textBaseline = TextBaselines.Top,
double  lineWidth = 1,
LineCaps  lineCap = LineCaps.Butt,
LineJoins  lineJoin = LineJoins.Miter,
LineDash lineDash = null,
string  tag = null 
)

Stroke the underline of the specified formatted text string.

Parameters
originXThe horizontal coordinate of the text origin.
originYThe vertical coordinate of the text origin. See textBaseline .
textThe FormattedText to draw.
strokeColourThe default Brush with which to stroke the underline.
lineWidthThe width of the line with which the underline is stroked.
lineCapThe line cap to use to stroke the underline.
lineJoinThe line join to use to stroke the underline.
lineDashThe line dash to use to stroke the underline.
textBaselineThe text baseline (determines what originY represents).
tagA tag to identify the stroked underline.

Definition at line 874 of file Graphics.Text.cs.

◆ StrokeTextUnderline() [2/4]

void VectSharp.Graphics.StrokeTextUnderline ( double  originX,
double  originY,
string  text,
Font  font,
Brush  strokeColour,
TextBaselines  textBaseline = TextBaselines.Top,
double  lineWidth = 1,
LineCaps  lineCap = LineCaps.Butt,
LineJoins  lineJoin = LineJoins.Miter,
LineDash lineDash = null,
string  tag = null 
)

Stroke the underline of the specified text string.

Parameters
originXThe horizontal coordinate of the text origin.
originYThe vertical coordinate of the text origin. See textBaseline .
textThe string whose underline will be drawn.
fontThe font with which to draw the text.
strokeColourThe Brush with which to stroke the underline.
lineWidthThe width of the line with which the underline is stroked.
lineCapThe line cap to use to stroke the underline.
lineJoinThe line join to use to stroke the underline.
lineDashThe line dash to use to stroke the underline.
textBaselineThe text baseline (determines what originY represents).
tagA tag to identify the stroked underline.

Definition at line 717 of file Graphics.Text.cs.

◆ StrokeTextUnderline() [3/4]

void VectSharp.Graphics.StrokeTextUnderline ( Point  origin,
IEnumerable< FormattedText text,
Brush  strokeColour,
TextBaselines  textBaseline = TextBaselines.Top,
double  lineWidth = 1,
LineCaps  lineCap = LineCaps.Butt,
LineJoins  lineJoin = LineJoins.Miter,
LineDash lineDash = null,
string  tag = null 
)

Stroke the underline of the specified formatted text string.

Parameters
originThe text origin. See textBaseline .
textThe FormattedText to draw.
strokeColourThe default Brush with which to stroke the underline.
lineWidthThe width of the line with which the underline is stroked.
lineCapThe line cap to use to stroke the underline.
lineJoinThe line join to use to stroke the underline.
lineDashThe line dash to use to stroke the underline.
textBaselineThe text baseline (determines what the vertical component of origin represents).
tagA tag to identify the stroked underline.

Definition at line 891 of file Graphics.Text.cs.

◆ StrokeTextUnderline() [4/4]

void VectSharp.Graphics.StrokeTextUnderline ( Point  origin,
string  text,
Font  font,
Brush  strokeColour,
TextBaselines  textBaseline = TextBaselines.Top,
double  lineWidth = 1,
LineCaps  lineCap = LineCaps.Butt,
LineJoins  lineJoin = LineJoins.Miter,
LineDash lineDash = null,
string  tag = null 
)

Stroke the underline of the specified text string.

Parameters
originThe text origin. See textBaseline .
textThe string whose underline will be drawn.
fontThe font with which to draw the text.
strokeColourThe Brush with which to stroke the underline.
lineWidthThe width of the line with which the underline is stroked.
lineCapThe line cap to use to stroke the underline.
lineJoinThe line join to use to stroke the underline.
lineDashThe line dash to use to stroke the underline.
textBaselineThe text baseline (determines what the vertical component of origin represents).
tagA tag to identify the stroked underline.

Definition at line 735 of file Graphics.Text.cs.

◆ Transform() [1/3]

void VectSharp.Graphics.Transform ( double  a,
double  b,
double  c,
double  d,
double  e,
double  f,
string  tag = null 
)

Transform the coordinate system with the specified transformation matrix [ [a, c, e], [b, d, f], [0, 0, 1] ].

Parameters
aThe first element of the first column.
bThe second element of the first column.
cThe first element of the second column.
dThe second element of the second column.
eThe first element of the third column.
fThe second element of the third column.
tagA tag to identify the transform.

Definition at line 423 of file Graphics.cs.

◆ Transform() [2/3]

Graphics VectSharp.Graphics.Transform ( Func< Point, Point transformationFunction,
double  linearisationResolution 
)

Creates a new Graphics object in which all the graphics actions have been transformed using an arbitrary transformation function. Raster images are replaced by grey rectangles.

Parameters
transformationFunctionAn arbitrary transformation function.
linearisationResolutionThe resolution that will be used to linearise curve segments.
Returns
A new Graphics object in which all graphics actions have been linearised and transformed using the transformationFunction .

Definition at line 1070 of file Graphics.cs.

◆ Transform() [3/3]

Graphics VectSharp.Graphics.Transform ( Func< Point, Point transformationFunction,
double  linearisationResolution,
double  maxSegmentLength 
)

Creates a new Graphics object in which all the graphics actions have been transformed using an arbitrary transformation function. Raster images are replaced by grey rectangles.

Parameters
transformationFunctionAn arbitrary transformation function.
linearisationResolutionThe resolution that will be used to linearise curve segments.
maxSegmentLengthThe maximum length of line segments.
Returns
A new Graphics object in which all graphics actions have been linearised and transformed using the transformationFunction .

Definition at line 1268 of file Graphics.cs.

◆ Translate() [1/2]

void VectSharp.Graphics.Translate ( double  x,
double  y,
string  tag = null 
)

Translate the coordinate system origin.

Parameters
xThe horizontal translation.
yThe vertical translation.
tagA tag to identify the transform.

Definition at line 435 of file Graphics.cs.

◆ Translate() [2/2]

void VectSharp.Graphics.Translate ( Point  delta,
string  tag = null 
)

Translate the coordinate system origin.

Parameters
deltaThe new origin point.
tagA tag to identify the transform.

Definition at line 445 of file Graphics.cs.

◆ TryRasterise()

bool VectSharp.Graphics.TryRasterise ( Rectangle  region,
double  scale,
bool  interpolate,
out RasterImage  output 
)

Tries to rasterise specified region of this Graphics object using the default rasterisation method.

Parameters
regionThe region of the Graphics to rasterise.
scaleThe scale at which the image is rasterised.
interpolateDetermines whether the resulting RasterImage should be interpolated or not.
outputWhen this method returns, this will contain the rasterised image (or null if the image could not be rasterised.
Returns
true if the image could be rasterised; false if it could not be rasterised.

Definition at line 1561 of file Graphics.cs.

Member Data Documentation

◆ RasterisationMethod

Func<Graphics, Rectangle, double, bool, RasterImage> VectSharp.Graphics.RasterisationMethod = null
static

A method that is used to rasterise a region of a Graphics object. Set this to null if you wish to use the default rasterisation methods (implemented by either VectSharp.Raster, or VectSharp.Raster.ImageSharp). You will have to provide your own implementation of this method if neither VectSharp.Raster nor VectSharp.Raster.ImageSharp are referenced by your project. The first argument of this method is the Graphics to be rasterised, the second is a Rectangle representing the region to rasterise, the third is a double representing the scale, and the third is a boolean value indicating whether the resulting RasterImage should be interpolated.

Definition at line 1551 of file Graphics.cs.

Property Documentation

◆ DefaultFillRule

FillRule VectSharp.Graphics.DefaultFillRule = FillRule.NonZeroWinding
getset

The default fill rule.

Definition at line 290 of file Graphics.cs.

◆ UnbalancedStackAction

UnbalancedStackActions VectSharp.Graphics.UnbalancedStackAction = UnbalancedStackActions.Throw
staticgetset

Determines how an unbalanced graphics state stack (which occurs if the number of calls to Save and Restore is not equal) will be treated. The default is UnbalancedStackActions.Throw.

Definition at line 283 of file Graphics.cs.

◆ UseUniqueTags

bool VectSharp.Graphics.UseUniqueTags = true
getset

Determines whether unique tags should be used for graphics actions that create multiple objects (e.g. drawing text).

Definition at line 318 of file Graphics.cs.


The documentation for this class was generated from the following files: