Namespace: PdfSharp.Drawing
Represents a drawing surface for a fixed size page.
public sealed class XGraphics : System.IDisposable
Inheritance Object → XGraphics
Implements IDisposable
Gets or sets the unit of measure used for page coordinates. CURRENTLY ONLY POINT IS IMPLEMENTED.
public XGraphicsUnit PageUnit { get; }
Gets or sets the value indicating in which direction y-value grow.
public XPageDirection PageDirection { get; set; }
Gets the current page origin. Setting the origin is not yet implemented.
public XPoint PageOrigin { get; set; }
Gets the current size of the page.
public XSize PageSize { get; }
Gets the current graphics state level. The default value is 0. Each call of Save or BeginContainer increased and each call of Restore or EndContainer decreased the value by 1.
public int GraphicsStateLevel { get; }
Gets or sets the smoothing mode.
public XSmoothingMode SmoothingMode { get; set; }
XSmoothingMode
The smoothing mode.
Gets the current transformation matrix. The transformation matrix cannot be set. Instead use Save/Restore or BeginContainer/EndContainer to save the state before Transform is called and later restore to the previous transform.
public XMatrix Transform { get; }
Permits access to internal data.
public XGraphicsInternals Internals { get; }
(Under construction. May change in future versions.)
public SpaceTransformer Transformer { get; }
Gets the PDF page that serves as drawing surface if PDF is rendered, or null if no such object exists.
public PdfPage PdfPage { get; }
Draws the specified image.
public void DrawImage(XImage image, double x, double y)
image
XImage
x
Double
y
Double
Draws the specified image.
public void DrawImage(XImage image, XRect rect)
image
XImage
rect
XRect
Draws the specified image.
public void DrawImage(XImage image, double x, double y, double width, double height)
image
XImage
x
Double
y
Double
width
Double
height
Double
Draws the specified image.
public void DrawImage(XImage image, XRect destRect, XRect srcRect, XGraphicsUnit srcUnit)
image
XImage
destRect
XRect
srcRect
XRect
srcUnit
XGraphicsUnit
Draws the specified bar code.
public void DrawBarCode(BarCode barcode, XPoint position)
barcode
BarCode
position
XPoint
Draws the specified bar code.
public void DrawBarCode(BarCode barcode, XBrush brush, XPoint position)
barcode
BarCode
brush
XBrush
position
XPoint
Draws the specified bar code.
public void DrawBarCode(BarCode barcode, XBrush brush, XFont font, XPoint position)
barcode
BarCode
brush
XBrush
font
XFont
position
XPoint
Draws the specified data matrix code.
public void DrawMatrixCode(MatrixCode matrixcode, XPoint position)
matrixcode
MatrixCode
position
XPoint
Draws the specified data matrix code.
public void DrawMatrixCode(MatrixCode matrixcode, XBrush brush, XPoint position)
matrixcode
MatrixCode
brush
XBrush
position
XPoint
Saves the current state of this XGraphics object and identifies the saved state with the returned XGraphicsState object.
public XGraphicsState Save()
Restores the state of this XGraphics object to the state represented by the specified XGraphicsState object.
public void Restore(XGraphicsState state)
state
XGraphicsState
Restores the state of this XGraphics object to the state before the most recently call of Save.
public void Restore()
Saves a graphics container with the current state of this XGraphics and opens and uses a new graphics container.
public XGraphicsContainer BeginContainer()
Saves a graphics container with the current state of this XGraphics and opens and uses a new graphics container.
public XGraphicsContainer BeginContainer(XRect dstrect, XRect srcrect, XGraphicsUnit unit)
dstrect
XRect
srcrect
XRect
unit
XGraphicsUnit
Closes the current graphics container and restores the state of this XGraphics to the state saved by a call to the BeginContainer method.
public void EndContainer(XGraphicsContainer container)
container
XGraphicsContainer
Applies the specified translation operation to the transformation matrix of this object by prepending it to the object’s transformation matrix.
public void TranslateTransform(double dx, double dy)
dx
Double
dy
Double
Applies the specified translation operation to the transformation matrix of this object in the specified order.
public void TranslateTransform(double dx, double dy, XMatrixOrder order)
dx
Double
dy
Double
order
XMatrixOrder
Applies the specified scaling operation to the transformation matrix of this object by prepending it to the object’s transformation matrix.
public void ScaleTransform(double scaleX, double scaleY)
scaleX
Double
scaleY
Double
Applies the specified scaling operation to the transformation matrix of this object in the specified order.
public void ScaleTransform(double scaleX, double scaleY, XMatrixOrder order)
scaleX
Double
scaleY
Double
order
XMatrixOrder
Applies the specified scaling operation to the transformation matrix of this object by prepending it to the object’s transformation matrix.
public void ScaleTransform(double scaleXY)
scaleXY
Double
Applies the specified scaling operation to the transformation matrix of this object in the specified order.
public void ScaleTransform(double scaleXY, XMatrixOrder order)
scaleXY
Double
order
XMatrixOrder
Applies the specified scaling operation to the transformation matrix of this object by prepending it to the object’s transformation matrix.
public void ScaleAtTransform(double scaleX, double scaleY, double centerX, double centerY)
scaleX
Double
scaleY
Double
centerX
Double
centerY
Double
Applies the specified scaling operation to the transformation matrix of this object by prepending it to the object’s transformation matrix.
public void ScaleAtTransform(double scaleX, double scaleY, XPoint center)
scaleX
Double
scaleY
Double
center
XPoint
Applies the specified rotation operation to the transformation matrix of this object by prepending it to the object’s transformation matrix.
public void RotateTransform(double angle)
angle
Double
Applies the specified rotation operation to the transformation matrix of this object in the specified order. The angle unit of measure is degree.
public void RotateTransform(double angle, XMatrixOrder order)
angle
Double
order
XMatrixOrder
Applies the specified rotation operation to the transformation matrix of this object by prepending it to the object’s transformation matrix.
public void RotateAtTransform(double angle, XPoint point)
angle
Double
point
XPoint
Applies the specified rotation operation to the transformation matrix of this object by prepending it to the object’s transformation matrix.
public void RotateAtTransform(double angle, XPoint point, XMatrixOrder order)
angle
Double
point
XPoint
order
XMatrixOrder
Applies the specified shearing operation to the transformation matrix of this object by prepending it to the object’s transformation matrix. ShearTransform is a synonym for SkewAtTransform. Parameter shearX specifies the horizontal skew which is measured in degrees counterclockwise from the y-axis. Parameter shearY specifies the vertical skew which is measured in degrees counterclockwise from the x-axis.
public void ShearTransform(double shearX, double shearY)
shearX
Double
shearY
Double
Applies the specified shearing operation to the transformation matrix of this object in the specified order. ShearTransform is a synonym for SkewAtTransform. Parameter shearX specifies the horizontal skew which is measured in degrees counterclockwise from the y-axis. Parameter shearY specifies the vertical skew which is measured in degrees counterclockwise from the x-axis.
public void ShearTransform(double shearX, double shearY, XMatrixOrder order)
shearX
Double
shearY
Double
order
XMatrixOrder
Applies the specified shearing operation to the transformation matrix of this object by prepending it to the object’s transformation matrix. ShearTransform is a synonym for SkewAtTransform. Parameter shearX specifies the horizontal skew which is measured in degrees counterclockwise from the y-axis. Parameter shearY specifies the vertical skew which is measured in degrees counterclockwise from the x-axis.
public void SkewAtTransform(double shearX, double shearY, double centerX, double centerY)
shearX
Double
shearY
Double
centerX
Double
centerY
Double
Applies the specified shearing operation to the transformation matrix of this object by prepending it to the object’s transformation matrix. ShearTransform is a synonym for SkewAtTransform. Parameter shearX specifies the horizontal skew which is measured in degrees counterclockwise from the y-axis. Parameter shearY specifies the vertical skew which is measured in degrees counterclockwise from the x-axis.
public void SkewAtTransform(double shearX, double shearY, XPoint center)
shearX
Double
shearY
Double
center
XPoint
Multiplies the transformation matrix of this object and specified matrix.
public void MultiplyTransform(XMatrix matrix)
matrix
XMatrix
Multiplies the transformation matrix of this object and specified matrix in the specified order.
public void MultiplyTransform(XMatrix matrix, XMatrixOrder order)
matrix
XMatrix
order
XMatrixOrder
Updates the clip region of this XGraphics to the intersection of the current clip region and the specified rectangle.
public void IntersectClip(XRect rect)
rect
XRect
Updates the clip region of this XGraphics to the intersection of the current clip region and the specified graphical path.
public void IntersectClip(XGraphicsPath path)
path
XGraphicsPath
Writes a comment to the output stream. Comments have no effect on the rendering of the output. They may be useful to mark a position in a content stream of a page in a PDF document.
public void WriteComment(string comment)
comment
String
internal void DisassociateImage()
internal void AppendToContentStream(string str)
str
String
Creates the measure context. This is a graphics context created only for querying measures of text. Drawing on a measure context has no effect.
public static XGraphics CreateMeasureContext(XSize size, XGraphicsUnit pageUnit, XPageDirection pageDirection)
size
XSize
pageUnit
XGraphicsUnit
pageDirection
XPageDirection
Creates a new instance of the XGraphics class from a PdfSharp.Pdf.PdfPage object.
public static XGraphics FromPdfPage(PdfPage page)
page
PdfPage
Creates a new instance of the XGraphics class from a PdfSharp.Pdf.PdfPage object.
public static XGraphics FromPdfPage(PdfPage page, XGraphicsUnit unit)
page
PdfPage
unit
XGraphicsUnit
Creates a new instance of the XGraphics class from a PdfSharp.Pdf.PdfPage object.
public static XGraphics FromPdfPage(PdfPage page, XPageDirection pageDirection)
page
PdfPage
pageDirection
XPageDirection
Creates a new instance of the XGraphics class from a PdfSharp.Pdf.PdfPage object.
public static XGraphics FromPdfPage(PdfPage page, XGraphicsPdfPageOptions options)
page
PdfPage
options
XGraphicsPdfPageOptions
Creates a new instance of the XGraphics class from a PdfSharp.Pdf.PdfPage object.
public static XGraphics FromPdfPage(PdfPage page, XGraphicsPdfPageOptions options, XPageDirection pageDirection)
page
PdfPage
options
XGraphicsPdfPageOptions
pageDirection
XPageDirection
Creates a new instance of the XGraphics class from a PdfSharp.Pdf.PdfPage object.
public static XGraphics FromPdfPage(PdfPage page, XGraphicsPdfPageOptions options, XGraphicsUnit unit)
page
PdfPage
options
XGraphicsPdfPageOptions
unit
XGraphicsUnit
Creates a new instance of the XGraphics class from a PdfSharp.Pdf.PdfPage object.
public static XGraphics FromPdfPage(PdfPage page, XGraphicsPdfPageOptions options, XGraphicsUnit unit, XPageDirection pageDirection)
page
PdfPage
options
XGraphicsPdfPageOptions
unit
XGraphicsUnit
pageDirection
XPageDirection
Creates a new instance of the XGraphics class from a PdfSharp.Drawing.XPdfForm object.
public static XGraphics FromPdfForm(XPdfForm form)
form
XPdfForm
Creates a new instance of the XGraphics class from a PdfSharp.Drawing.XForm object.
public static XGraphics FromForm(XForm form)
form
XForm
Creates a new instance of the XGraphics class from a PdfSharp.Drawing.XForm object.
public static XGraphics FromImage(XImage image)
image
XImage
Creates a new instance of the XGraphics class from a PdfSharp.Drawing.XImage object.
public static XGraphics FromImage(XImage image, XGraphicsUnit unit)
image
XImage
unit
XGraphicsUnit
Releases all resources used by this object.
public void Dispose()
Draws a line connecting two XPoint structures.
public void DrawLine(XPen pen, XPoint pt1, XPoint pt2)
pen
XPen
pt1
XPoint
pt2
XPoint
Draws a line connecting the two points specified by coordinate pairs.
public void DrawLine(XPen pen, double x1, double y1, double x2, double y2)
pen
XPen
x1
Double
y1
Double
x2
Double
y2
Double
Draws a series of line segments that connect an array of points.
public void DrawLines(XPen pen, XPoint[] points)
pen
XPen
points
XPoint[]
Draws a series of line segments that connect an array of x and y pairs.
public void DrawLines(XPen pen, double x, double y, Double[] value)
pen
XPen
x
Double
y
Double
value
Double[]
Draws a Bézier spline defined by four points.
public void DrawBezier(XPen pen, XPoint pt1, XPoint pt2, XPoint pt3, XPoint pt4)
pen
XPen
pt1
XPoint
pt2
XPoint
pt3
XPoint
pt4
XPoint
Draws a Bézier spline defined by four points.
public void DrawBezier(XPen pen, double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4)
pen
XPen
x1
Double
y1
Double
x2
Double
y2
Double
x3
Double
y3
Double
x4
Double
y4
Double
Draws a series of Bézier splines from an array of points.
public void DrawBeziers(XPen pen, XPoint[] points)
pen
XPen
points
XPoint[]
Draws a cardinal spline through a specified array of points.
public void DrawCurve(XPen pen, XPoint[] points)
pen
XPen
points
XPoint[]
Draws a cardinal spline through a specified array of point using a specified tension. The drawing begins offset from the beginning of the array.
public void DrawCurve(XPen pen, XPoint[] points, int offset, int numberOfSegments, double tension)
pen
XPen
points
XPoint[]
offset
Int32
numberOfSegments
Int32
tension
Double
Draws a cardinal spline through a specified array of points using a specified tension.
public void DrawCurve(XPen pen, XPoint[] points, double tension)
pen
XPen
points
XPoint[]
tension
Double
Draws an arc representing a portion of an ellipse.
public void DrawArc(XPen pen, XRect rect, double startAngle, double sweepAngle)
pen
XPen
rect
XRect
startAngle
Double
sweepAngle
Double
Draws an arc representing a portion of an ellipse.
public void DrawArc(XPen pen, double x, double y, double width, double height, double startAngle, double sweepAngle)
pen
XPen
x
Double
y
Double
width
Double
height
Double
startAngle
Double
sweepAngle
Double
Draws a rectangle.
public void DrawRectangle(XPen pen, XRect rect)
pen
XPen
rect
XRect
Draws a rectangle.
public void DrawRectangle(XPen pen, double x, double y, double width, double height)
pen
XPen
x
Double
y
Double
width
Double
height
Double
Draws a rectangle.
public void DrawRectangle(XBrush brush, XRect rect)
brush
XBrush
rect
XRect
Draws a rectangle.
public void DrawRectangle(XBrush brush, double x, double y, double width, double height)
brush
XBrush
x
Double
y
Double
width
Double
height
Double
Draws a rectangle.
public void DrawRectangle(XPen pen, XBrush brush, XRect rect)
pen
XPen
brush
XBrush
rect
XRect
Draws a rectangle.
public void DrawRectangle(XPen pen, XBrush brush, double x, double y, double width, double height)
pen
XPen
brush
XBrush
x
Double
y
Double
width
Double
height
Double
Draws a series of rectangles.
public void DrawRectangles(XPen pen, XRect[] rectangles)
pen
XPen
rectangles
XRect[]
Draws a series of rectangles.
public void DrawRectangles(XBrush brush, XRect[] rectangles)
brush
XBrush
rectangles
XRect[]
Draws a series of rectangles.
public void DrawRectangles(XPen pen, XBrush brush, XRect[] rectangles)
pen
XPen
brush
XBrush
rectangles
XRect[]
Draws a rectangle with rounded corners.
public void DrawRoundedRectangle(XPen pen, XRect rect, XSize ellipseSize)
pen
XPen
rect
XRect
ellipseSize
XSize
Draws a rectangle with rounded corners.
public void DrawRoundedRectangle(XPen pen, double x, double y, double width, double height, double ellipseWidth, double ellipseHeight)
pen
XPen
x
Double
y
Double
width
Double
height
Double
ellipseWidth
Double
ellipseHeight
Double
Draws a rectangle with rounded corners.
public void DrawRoundedRectangle(XBrush brush, XRect rect, XSize ellipseSize)
brush
XBrush
rect
XRect
ellipseSize
XSize
Draws a rectangle with rounded corners.
public void DrawRoundedRectangle(XBrush brush, double x, double y, double width, double height, double ellipseWidth, double ellipseHeight)
brush
XBrush
x
Double
y
Double
width
Double
height
Double
ellipseWidth
Double
ellipseHeight
Double
Draws a rectangle with rounded corners.
public void DrawRoundedRectangle(XPen pen, XBrush brush, XRect rect, XSize ellipseSize)
pen
XPen
brush
XBrush
rect
XRect
ellipseSize
XSize
Draws a rectangle with rounded corners.
public void DrawRoundedRectangle(XPen pen, XBrush brush, double x, double y, double width, double height, double ellipseWidth, double ellipseHeight)
pen
XPen
brush
XBrush
x
Double
y
Double
width
Double
height
Double
ellipseWidth
Double
ellipseHeight
Double
Draws an ellipse defined by a bounding rectangle.
public void DrawEllipse(XPen pen, XRect rect)
pen
XPen
rect
XRect
Draws an ellipse defined by a bounding rectangle.
public void DrawEllipse(XPen pen, double x, double y, double width, double height)
pen
XPen
x
Double
y
Double
width
Double
height
Double
Draws an ellipse defined by a bounding rectangle.
public void DrawEllipse(XBrush brush, XRect rect)
brush
XBrush
rect
XRect
Draws an ellipse defined by a bounding rectangle.
public void DrawEllipse(XBrush brush, double x, double y, double width, double height)
brush
XBrush
x
Double
y
Double
width
Double
height
Double
Draws an ellipse defined by a bounding rectangle.
public void DrawEllipse(XPen pen, XBrush brush, XRect rect)
pen
XPen
brush
XBrush
rect
XRect
Draws an ellipse defined by a bounding rectangle.
public void DrawEllipse(XPen pen, XBrush brush, double x, double y, double width, double height)
pen
XPen
brush
XBrush
x
Double
y
Double
width
Double
height
Double
Draws a polygon defined by an array of points.
public void DrawPolygon(XPen pen, XPoint[] points)
pen
XPen
points
XPoint[]
Draws a polygon defined by an array of points.
public void DrawPolygon(XBrush brush, XPoint[] points, XFillMode fillMode)
brush
XBrush
points
XPoint[]
fillMode
XFillMode
Draws a polygon defined by an array of points.
public void DrawPolygon(XPen pen, XBrush brush, XPoint[] points, XFillMode fillMode)
pen
XPen
brush
XBrush
points
XPoint[]
fillMode
XFillMode
Draws a pie defined by an ellipse.
public void DrawPie(XPen pen, XRect rect, double startAngle, double sweepAngle)
pen
XPen
rect
XRect
startAngle
Double
sweepAngle
Double
Draws a pie defined by an ellipse.
public void DrawPie(XPen pen, double x, double y, double width, double height, double startAngle, double sweepAngle)
pen
XPen
x
Double
y
Double
width
Double
height
Double
startAngle
Double
sweepAngle
Double
Draws a pie defined by an ellipse.
public void DrawPie(XBrush brush, XRect rect, double startAngle, double sweepAngle)
brush
XBrush
rect
XRect
startAngle
Double
sweepAngle
Double
Draws a pie defined by an ellipse.
public void DrawPie(XBrush brush, double x, double y, double width, double height, double startAngle, double sweepAngle)
brush
XBrush
x
Double
y
Double
width
Double
height
Double
startAngle
Double
sweepAngle
Double
Draws a pie defined by an ellipse.
public void DrawPie(XPen pen, XBrush brush, XRect rect, double startAngle, double sweepAngle)
pen
XPen
brush
XBrush
rect
XRect
startAngle
Double
sweepAngle
Double
Draws a pie defined by an ellipse.
public void DrawPie(XPen pen, XBrush brush, double x, double y, double width, double height, double startAngle, double sweepAngle)
pen
XPen
brush
XBrush
x
Double
y
Double
width
Double
height
Double
startAngle
Double
sweepAngle
Double
Draws a closed cardinal spline defined by an array of points.
public void DrawClosedCurve(XPen pen, XPoint[] points)
pen
XPen
points
XPoint[]
Draws a closed cardinal spline defined by an array of points.
public void DrawClosedCurve(XPen pen, XPoint[] points, double tension)
pen
XPen
points
XPoint[]
tension
Double
Draws a closed cardinal spline defined by an array of points.
public void DrawClosedCurve(XBrush brush, XPoint[] points)
brush
XBrush
points
XPoint[]
Draws a closed cardinal spline defined by an array of points.
public void DrawClosedCurve(XBrush brush, XPoint[] points, XFillMode fillMode)
brush
XBrush
points
XPoint[]
fillMode
XFillMode
Draws a closed cardinal spline defined by an array of points.
public void DrawClosedCurve(XBrush brush, XPoint[] points, XFillMode fillMode, double tension)
brush
XBrush
points
XPoint[]
fillMode
XFillMode
tension
Double
Draws a closed cardinal spline defined by an array of points.
public void DrawClosedCurve(XPen pen, XBrush brush, XPoint[] points)
pen
XPen
brush
XBrush
points
XPoint[]
Draws a closed cardinal spline defined by an array of points.
public void DrawClosedCurve(XPen pen, XBrush brush, XPoint[] points, XFillMode fillMode)
pen
XPen
brush
XBrush
points
XPoint[]
fillMode
XFillMode
Draws a closed cardinal spline defined by an array of points.
public void DrawClosedCurve(XPen pen, XBrush brush, XPoint[] points, XFillMode fillMode, double tension)
pen
XPen
brush
XBrush
points
XPoint[]
fillMode
XFillMode
tension
Double
Draws a graphical path.
public void DrawPath(XPen pen, XGraphicsPath path)
pen
XPen
path
XGraphicsPath
Draws a graphical path.
public void DrawPath(XBrush brush, XGraphicsPath path)
brush
XBrush
path
XGraphicsPath
Draws a graphical path.
public void DrawPath(XPen pen, XBrush brush, XGraphicsPath path)
pen
XPen
brush
XBrush
path
XGraphicsPath
Draws the specified text string.
public void DrawString(string s, XFont font, XBrush brush, XPoint point)
s
String
font
XFont
brush
XBrush
point
XPoint
Draws the specified text string.
public void DrawString(string s, XFont font, XBrush brush, XPoint point, XStringFormat format)
s
String
font
XFont
brush
XBrush
point
XPoint
format
XStringFormat
Draws the specified text string.
public void DrawString(string s, XFont font, XBrush brush, double x, double y)
s
String
font
XFont
brush
XBrush
x
Double
y
Double
Draws the specified text string.
public void DrawString(string s, XFont font, XBrush brush, double x, double y, XStringFormat format)
s
String
font
XFont
brush
XBrush
x
Double
y
Double
format
XStringFormat
Draws the specified text string.
public void DrawString(string s, XFont font, XBrush brush, XRect layoutRectangle)
s
String
font
XFont
brush
XBrush
layoutRectangle
XRect
Draws the specified text string.
public void DrawString(string text, XFont font, XBrush brush, XRect layoutRectangle, XStringFormat format)
text
String
font
XFont
brush
XBrush
layoutRectangle
XRect
format
XStringFormat
Measures the specified string when drawn with the specified font.
public XSize MeasureString(string text, XFont font, XStringFormat stringFormat)
text
String
font
XFont
stringFormat
XStringFormat
Measures the specified string when drawn with the specified font.
public XSize MeasureString(string text, XFont font)
text
String
font
XFont
Draws the specified image.
public void DrawImage(XImage image, XPoint point)
image
XImage
point
XPoint