VectSharp  2.2.1
A light library for C# vector graphics
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 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)
 Intersect the current clipping path with the specified GraphicsPath. More...
 
void SetClippingPath (double leftX, double topY, double width, double height)
 Intersect the current clipping path with the specified rectangle. More...
 
void SetClippingPath (Point topLeft, Size size)
 Intersect the current clipping path with the specified rectangle. More...
 
void Rotate (double angle)
 Rotate the coordinate system around the origin. More...
 
void RotateAt (double angle, Point pivot)
 Rotate the coordinate system around a pivot point. More...
 
void Transform (double a, double b, double c, double d, double e, double f)
 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)
 Translate the coordinate system origin. More...
 
void Translate (Point delta)
 Translate the coordinate system origin. More...
 
void Scale (double scaleX, double scaleY)
 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)
 Draws a Graphics object on the current Graphics object. More...
 
void DrawGraphics (Point origin, Graphics graphics, IFilter filter)
 Draws a Graphics object on the current Graphics object, applying the specified filter . More...
 
void DrawGraphics (double originX, double originY, Graphics graphics, IFilter filter)
 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 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...
 

Detailed Description

Represents an abstract drawing surface.

Definition at line 261 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 599 of file Graphics.cs.

◆ DrawGraphics() [1/4]

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 820 of file Graphics.cs.

◆ DrawGraphics() [2/4]

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

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.

Definition at line 852 of file Graphics.cs.

◆ DrawGraphics() [3/4]

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 802 of file Graphics.cs.

◆ DrawGraphics() [4/4]

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

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.

Definition at line 831 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 504 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 479 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 467 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 490 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 516 of file Graphics.cs.

◆ FillPath()

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 276 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 415 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 401 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 485 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 392 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 37 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 125 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 707 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 639 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 720 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 653 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 1313 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 1257 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 622 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 611 of file Graphics.Text.cs.

◆ Restore()

void VectSharp.Graphics.Restore ( )

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

Definition at line 532 of file Graphics.cs.

◆ Rotate()

void VectSharp.Graphics.Rotate ( double  angle)

Rotate the coordinate system around the origin.

Parameters
angleThe angle (in radians) by which to rotate the coordinate system.

Definition at line 332 of file Graphics.cs.

◆ RotateAt()

void VectSharp.Graphics.RotateAt ( double  angle,
Point  pivot 
)

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.

Definition at line 342 of file Graphics.cs.

◆ Save()

void VectSharp.Graphics.Save ( )

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

Definition at line 524 of file Graphics.cs.

◆ Scale()

void VectSharp.Graphics.Scale ( double  scaleX,
double  scaleY 
)

Scale the coordinate system with respect to the origin.

Parameters
scaleXThe horizontal scale.
scaleYThe vertical scale.

Definition at line 389 of file Graphics.cs.

◆ SetClippingPath() [1/3]

void VectSharp.Graphics.SetClippingPath ( double  leftX,
double  topY,
double  width,
double  height 
)

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.

Definition at line 313 of file Graphics.cs.

◆ SetClippingPath() [2/3]

void VectSharp.Graphics.SetClippingPath ( GraphicsPath  path)

Intersect the current clipping path with the specified GraphicsPath.

Parameters
pathThe GraphicsPath to intersect with the current clipping path.

Definition at line 301 of file Graphics.cs.

◆ SetClippingPath() [3/3]

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

Intersect the current clipping path with the specified rectangle.

Parameters
topLeftThe top-left corner of the rectangle.
sizeThe size of the rectangle.

Definition at line 323 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 292 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 449 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 431 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 599 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 104 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 502 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 80 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 262 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 817 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 673 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 834 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 691 of file Graphics.Text.cs.

◆ Transform() [1/3]

void VectSharp.Graphics.Transform ( double  a,
double  b,
double  c,
double  d,
double  e,
double  f 
)

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.

Definition at line 359 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 930 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 1128 of file Graphics.cs.

◆ Translate() [1/2]

void VectSharp.Graphics.Translate ( double  x,
double  y 
)

Translate the coordinate system origin.

Parameters
xThe horizontal translation.
yThe vertical translation.

Definition at line 370 of file Graphics.cs.

◆ Translate() [2/2]

void VectSharp.Graphics.Translate ( Point  delta)

Translate the coordinate system origin.

Parameters
deltaThe new origin point.

Definition at line 379 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 1404 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 1394 of file Graphics.cs.

Property Documentation

◆ 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 266 of file Graphics.cs.


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