[]
Represents a graphics object that can be used to draw on a GcSvgDocument.
public class GcSvgGraphics : GcGraphics, IDisposable
Initializes a new instance of the GcSvgGraphics class.
public GcSvgGraphics(float width, float height)
width
floatThe width of the SVG viewport, in device-independent pixels (1/96ths of an inch).
height
floatThe height of the SVG viewport, in device-independent pixels (1/96ths of an inch).
Gets or sets the description of the SVG document.
public string Description { get; set; }
Gets or sets a value indicating whether fonts used in 'text' elements should be embedded.
Changing this property only affects subsequent calls to DrawTextLayout(TextLayout, PointF), DrawString(string, TextFormat, PointF) and DrawString(string, TextFormat, RectangleF, TextAlignment, ParagraphAlignment, bool) methods. Already rendered text is not affected.
This property is ignored if DrawTextAsPath is true.
The default is false.
public bool EmbedFonts { get; set; }
Gets or sets the height of the image, in device-independent pixels (1/96ths of an inch).
public float Height { get; set; }
Gets or sets a string to be appended to the auto-generated ID values.
public string IDSuffix { get; set; }
Gets or sets a hint to the implementation about how to make speed vs. quality tradeoffs as it performs image processing.
Setting this property affects the subsequent calls of the DrawImage methods. It does not affect the previous calls.
The default is Auto.public SvgImageRendering ImageRendering { get; set; }
Gets or sets a value indicating whether the images drawn with DrawImage methods should be disposed when disposing the resulting GcSvgDocument.
Setting this property affects the subsequent calls of the DrawImage methods. It does not affect the previous calls.
The default is false.public bool OwnImages { get; set; }
Gets or sets a value indicating whether the positions are set for each individual character within the 'text' element.
Setting this property to true makes the resulting SVG file larger but provides more precise positioning of individual characters.
Changing this property only affects subsequent calls to DrawTextLayout(TextLayout, PointF), DrawString(string, TextFormat, PointF) and DrawString(string, TextFormat, RectangleF, TextAlignment, ParagraphAlignment, bool) methods. Already rendered text is not affected.
This property is ignored if DrawTextAsPath is true.
The default is false.
public bool PreciseCharPositions { get; set; }
Gets the resolution of the current graphics, which is always 96 DPI for GcSvgGraphics.
public override float Resolution { get; set; }
Gets or sets a hint to the implementation about what tradeoffs to make as it renders vector graphics elements.
Setting this property affects the subsequent calls of the Draw/Fill methods. It does not affect the previous calls.
The default is Auto.public SvgShapeRendering ShapeRendering { get; set; }
Gets or sets the title of the SVG document.
public string Title { get; set; }
Gets or sets the transformation matrix of the current graphics.
public override Matrix3x2 Transform { get; set; }
Gets or sets the width of the image, in device-independent pixels (1/96ths of an inch).
public float Width { get; set; }
Applies a license key to the current instance of GcSvgGraphics.
A license key is required to use the ToSvgDocument() method.
public void ApplyLicenseKey(string key)
key
stringThe license key to apply.
Performs cleanup operations on managed and unmanaged resources.
protected override void Dispose(bool disposing)
disposing
boolFor internal use.
protected override InterpolationMode GetInterpolationMode()
For internal use.
protected override IClipRegion InternalCreateClipRegion(IPath graphicsPath)
graphicsPath
IPathFor internal use.
protected override IClipRegion InternalCreateClipRegion(RectangleF bounds)
bounds
System.Drawing.RectangleFFor internal use.
protected override IPath InternalCreatePath()
For internal use.
protected override void InternalDrawEllipse(RectangleF bounds, Pen pen)
bounds
System.Drawing.RectangleFpen
PenFor internal use.
protected override void InternalDrawImage(RectangleF dstRect, IImage image, float opacity)
dstRect
System.Drawing.RectangleFimage
IImageopacity
floatFor internal use.
protected override void InternalDrawLine(PointF p1, PointF p2, Pen pen)
p1
System.Drawing.PointFp2
System.Drawing.PointFpen
PenFor internal use.
protected override void InternalDrawLines(PointF[] points, Pen pen)
points
System.Drawing.PointF[]pen
PenFor internal use.
protected override void InternalDrawPath(IPath path, Pen pen)
For internal use.
protected override void InternalDrawPolygon(PointF[] points, Pen pen)
points
System.Drawing.PointF[]pen
PenFor internal use.
protected override void InternalDrawRectangle(RectangleF bounds, Pen pen)
bounds
System.Drawing.RectangleFpen
PenFor internal use.
protected override void InternalDrawRoundRect(RectangleF bounds, float radiusX, float radiusY, Pen pen)
bounds
System.Drawing.RectangleFradiusX
floatradiusY
floatpen
PenFor internal use.
protected override void InternalDrawTextLayout(TextLayout layout, PointF location)
layout
TextLayoutlocation
System.Drawing.PointFDraws a TextLayout at a specified location using graphic primitives.
protected override void InternalDrawTextLayoutAsPath(TextLayout layout, PointF location)
layout
TextLayoutThe TextLayout to draw.
location
System.Drawing.PointFThe location at which to draw the layout.
For internal use.
protected override void InternalFillEllipse(RectangleF bounds, Brush brush, RectangleF? brushBounds, Matrix3x2? brushTransform)
bounds
System.Drawing.RectangleFbrush
BrushbrushBounds
System.Drawing.RectangleF?brushTransform
System.Numerics.Matrix3x2?For internal use.
protected override void InternalFillEllipse(RectangleF bounds, Color color)
bounds
System.Drawing.RectangleFcolor
System.Drawing.ColorFor internal use.
protected override void InternalFillPath(IPath path, Brush brush, RectangleF? brushBounds, Matrix3x2? brushTransform)
path
IPathbrush
BrushbrushBounds
System.Drawing.RectangleF?brushTransform
System.Numerics.Matrix3x2?For internal use.
protected override void InternalFillPath(IPath path, Color color)
path
IPathcolor
System.Drawing.ColorFor internal use.
protected override void InternalFillPolygon(PointF[] points, Brush brush, FillMode fillMode, RectangleF? brushBounds, Matrix3x2? brushTransform)
points
System.Drawing.PointF[]brush
BrushfillMode
FillModebrushBounds
System.Drawing.RectangleF?brushTransform
System.Numerics.Matrix3x2?For internal use.
protected override void InternalFillPolygon(PointF[] points, Color color, FillMode fillMode)
points
System.Drawing.PointF[]color
System.Drawing.ColorfillMode
FillModeFor internal use.
protected override void InternalFillRectangle(RectangleF bounds, Brush brush, RectangleF? brushBounds, Matrix3x2? brushTransform)
bounds
System.Drawing.RectangleFbrush
BrushbrushBounds
System.Drawing.RectangleF?brushTransform
System.Numerics.Matrix3x2?For internal use.
protected override void InternalFillRectangle(RectangleF bounds, Color color)
bounds
System.Drawing.RectangleFcolor
System.Drawing.ColorFor internal use.
protected override void InternalFillRoundRect(RectangleF bounds, float radiusX, float radiusY, Brush brush, RectangleF? brushBounds, Matrix3x2? brushTransform)
bounds
System.Drawing.RectangleFradiusX
floatradiusY
floatbrush
BrushbrushBounds
System.Drawing.RectangleF?brushTransform
System.Numerics.Matrix3x2?For internal use.
protected override void InternalFillRoundRect(RectangleF bounds, float radiusX, float radiusY, Color color)
bounds
System.Drawing.RectangleFradiusX
floatradiusY
floatcolor
System.Drawing.ColorFor internal use.
protected override void InternalRemoveClip(IClipRegion clipRegion)
clipRegion
IClipRegionFor internal use.
protected override void InternalSetClip(IClipRegion clipRegion)
clipRegion
IClipRegionIndicates whether this graphics implementation supports a specified interpolation mode.
The following interpolation modes are supported by GcSvgGraphics:
public override bool IsInterpolationModeSupported(InterpolationMode interpolationMode)
interpolationMode
InterpolationModeThe interpolation mode to check.
true if the specified interpolation mode is supported by GcSvgGraphics, false otherwise.
Ends the group that was created by the last PushGroup(List<SvgCustomAttribute>) call.
public void PopGroup()
Stops redirecting drawing operations to the transparency layer that was created by the last PushTransparencyLayer(RectangleF?, float) call.
public override void PopTransparencyLayer()
Starts a group ('g') element with custom attributes in the SVG document. Call the PopGroup() method to end the group.
public void PushGroup(List<SvgCustomAttribute> customAttributes)
customAttributes
System.Collections.Generic.List<T><SvgCustomAttribute>The list of attributes to be associated with the group.
Adds a transparency layer to the GcSvgGraphics so that it receives all subsequent drawing operations until PopTransparencyLayer() is called.
public override void PushTransparencyLayer(RectangleF? contentBounds, float opacity)
contentBounds
System.Drawing.RectangleF?The content bounds of the transparency layer. Content won't render outside these bounds. When set to null, the content bounds are effectively taken to be the bounds of the current GcSvgGraphics.
opacity
floatAn opacity value that is applied uniformly to all drawings in the layer when compositing to the backplate.
For internal use.
protected override void SetInterpolationMode(InterpolationMode value)
value
InterpolationModeSets the license key.
A license key is required to use the ToSvgDocument() method.
public static void SetLicenseKey(string key)
key
stringThe license key to set.
Generates a GcSvgDocument from this graphics, and clears its command list afterwards.
Note that if a license key has not been applied (see SetLicenseKey(string) and ApplyLicenseKey(string) methods), only a few calls of ToSvgDocument() are allowed, after which an exception will be thrown.
public GcSvgDocument ToSvgDocument()
The generated SVG document.