[]
        
(Showing Draft Content)

GrapeCity.Documents.Svg.GcSvgGraphics

Class GcSvgGraphics

Namespace
GrapeCity.Documents.Svg
Assembly
GcDocs.Imaging.dll

Represents a graphics object that can be used to draw on a GcSvgDocument.

public class GcSvgGraphics : GcGraphics, IDisposable
Inheritance
object
GcSvgGraphics
Implements
System.IDisposable
Inherited Members
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()

Constructors

GcSvgGraphics(float, float)

Initializes a new instance of the GcSvgGraphics class.

public GcSvgGraphics(float width, float height)

Parameters

width float

The width of the SVG viewport, in device-independent pixels (1/96ths of an inch).

height float

The height of the SVG viewport, in device-independent pixels (1/96ths of an inch).

Properties

Description

Gets or sets the description of the SVG document.

public string Description { get; set; }

Property Value

string

EmbedFonts

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; }

Property Value

bool

Height

Gets or sets the height of the image, in device-independent pixels (1/96ths of an inch).

public float Height { get; set; }

Property Value

float

IDSuffix

Gets or sets a string to be appended to the auto-generated ID values.

public string IDSuffix { get; set; }

Property Value

string

ImageRendering

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; }

Property Value

SvgImageRendering

OwnImages

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; }

Property Value

bool

PreciseCharPositions

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; }

Property Value

bool

Resolution

Gets the resolution of the current graphics, which is always 96 DPI for GcSvgGraphics.

public override float Resolution { get; set; }

Property Value

float

ShapeRendering

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; }

Property Value

SvgShapeRendering

Title

Gets or sets the title of the SVG document.

public string Title { get; set; }

Property Value

string

Transform

Gets or sets the transformation matrix of the current graphics.

public override Matrix3x2 Transform { get; set; }

Property Value

System.Numerics.Matrix3x2

Width

Gets or sets the width of the image, in device-independent pixels (1/96ths of an inch).

public float Width { get; set; }

Property Value

float

Methods

ApplyLicenseKey(string)

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)

Parameters

key string

The license key to apply.

Dispose(bool)

Performs cleanup operations on managed and unmanaged resources.

protected override void Dispose(bool disposing)

Parameters

disposing bool

GetInterpolationMode()

For internal use.

protected override InterpolationMode GetInterpolationMode()

Returns

InterpolationMode

InternalCreateClipRegion(IPath)

For internal use.

protected override IClipRegion InternalCreateClipRegion(IPath graphicsPath)

Parameters

graphicsPath IPath

Returns

IClipRegion

InternalCreateClipRegion(RectangleF)

For internal use.

protected override IClipRegion InternalCreateClipRegion(RectangleF bounds)

Parameters

bounds System.Drawing.RectangleF

Returns

IClipRegion

InternalCreatePath()

For internal use.

protected override IPath InternalCreatePath()

Returns

IPath

InternalDrawEllipse(RectangleF, Pen)

For internal use.

protected override void InternalDrawEllipse(RectangleF bounds, Pen pen)

Parameters

bounds System.Drawing.RectangleF
pen Pen

InternalDrawImage(RectangleF, IImage, float)

For internal use.

protected override void InternalDrawImage(RectangleF dstRect, IImage image, float opacity)

Parameters

dstRect System.Drawing.RectangleF
image IImage
opacity float

InternalDrawLine(PointF, PointF, Pen)

For internal use.

protected override void InternalDrawLine(PointF p1, PointF p2, Pen pen)

Parameters

p1 System.Drawing.PointF
p2 System.Drawing.PointF
pen Pen

InternalDrawLines(PointF[], Pen)

For internal use.

protected override void InternalDrawLines(PointF[] points, Pen pen)

Parameters

points System.Drawing.PointF[]
pen Pen

InternalDrawPath(IPath, Pen)

For internal use.

protected override void InternalDrawPath(IPath path, Pen pen)

Parameters

path IPath
pen Pen

InternalDrawPolygon(PointF[], Pen)

For internal use.

protected override void InternalDrawPolygon(PointF[] points, Pen pen)

Parameters

points System.Drawing.PointF[]
pen Pen

InternalDrawRectangle(RectangleF, Pen)

For internal use.

protected override void InternalDrawRectangle(RectangleF bounds, Pen pen)

Parameters

bounds System.Drawing.RectangleF
pen Pen

InternalDrawRoundRect(RectangleF, float, float, Pen)

For internal use.

protected override void InternalDrawRoundRect(RectangleF bounds, float radiusX, float radiusY, Pen pen)

Parameters

bounds System.Drawing.RectangleF
radiusX float
radiusY float
pen Pen

InternalDrawTextLayout(TextLayout, PointF)

For internal use.

protected override void InternalDrawTextLayout(TextLayout layout, PointF location)

Parameters

layout TextLayout
location System.Drawing.PointF

InternalDrawTextLayoutAsPath(TextLayout, PointF)

Draws a TextLayout at a specified location using graphic primitives.

protected override void InternalDrawTextLayoutAsPath(TextLayout layout, PointF location)

Parameters

layout TextLayout

The TextLayout to draw.

location System.Drawing.PointF

The location at which to draw the layout.

InternalFillEllipse(RectangleF, Brush, RectangleF?, Matrix3x2?)

For internal use.

protected override void InternalFillEllipse(RectangleF bounds, Brush brush, RectangleF? brushBounds, Matrix3x2? brushTransform)

Parameters

bounds System.Drawing.RectangleF
brush Brush
brushBounds System.Drawing.RectangleF?
brushTransform System.Numerics.Matrix3x2?

InternalFillEllipse(RectangleF, Color)

For internal use.

protected override void InternalFillEllipse(RectangleF bounds, Color color)

Parameters

bounds System.Drawing.RectangleF
color System.Drawing.Color

InternalFillPath(IPath, Brush, RectangleF?, Matrix3x2?)

For internal use.

protected override void InternalFillPath(IPath path, Brush brush, RectangleF? brushBounds, Matrix3x2? brushTransform)

Parameters

path IPath
brush Brush
brushBounds System.Drawing.RectangleF?
brushTransform System.Numerics.Matrix3x2?

InternalFillPath(IPath, Color)

For internal use.

protected override void InternalFillPath(IPath path, Color color)

Parameters

path IPath
color System.Drawing.Color

InternalFillPolygon(PointF[], Brush, FillMode, RectangleF?, Matrix3x2?)

For internal use.

protected override void InternalFillPolygon(PointF[] points, Brush brush, FillMode fillMode, RectangleF? brushBounds, Matrix3x2? brushTransform)

Parameters

points System.Drawing.PointF[]
brush Brush
fillMode FillMode
brushBounds System.Drawing.RectangleF?
brushTransform System.Numerics.Matrix3x2?

InternalFillPolygon(PointF[], Color, FillMode)

For internal use.

protected override void InternalFillPolygon(PointF[] points, Color color, FillMode fillMode)

Parameters

points System.Drawing.PointF[]
color System.Drawing.Color
fillMode FillMode

InternalFillRectangle(RectangleF, Brush, RectangleF?, Matrix3x2?)

For internal use.

protected override void InternalFillRectangle(RectangleF bounds, Brush brush, RectangleF? brushBounds, Matrix3x2? brushTransform)

Parameters

bounds System.Drawing.RectangleF
brush Brush
brushBounds System.Drawing.RectangleF?
brushTransform System.Numerics.Matrix3x2?

InternalFillRectangle(RectangleF, Color)

For internal use.

protected override void InternalFillRectangle(RectangleF bounds, Color color)

Parameters

bounds System.Drawing.RectangleF
color System.Drawing.Color

InternalFillRoundRect(RectangleF, float, float, Brush, RectangleF?, Matrix3x2?)

For internal use.

protected override void InternalFillRoundRect(RectangleF bounds, float radiusX, float radiusY, Brush brush, RectangleF? brushBounds, Matrix3x2? brushTransform)

Parameters

bounds System.Drawing.RectangleF
radiusX float
radiusY float
brush Brush
brushBounds System.Drawing.RectangleF?
brushTransform System.Numerics.Matrix3x2?

InternalFillRoundRect(RectangleF, float, float, Color)

For internal use.

protected override void InternalFillRoundRect(RectangleF bounds, float radiusX, float radiusY, Color color)

Parameters

bounds System.Drawing.RectangleF
radiusX float
radiusY float
color System.Drawing.Color

InternalRemoveClip(IClipRegion)

For internal use.

protected override void InternalRemoveClip(IClipRegion clipRegion)

Parameters

clipRegion IClipRegion

InternalSetClip(IClipRegion)

For internal use.

protected override void InternalSetClip(IClipRegion clipRegion)

Parameters

clipRegion IClipRegion

IsInterpolationModeSupported(InterpolationMode)

Indicates whether this graphics implementation supports a specified interpolation mode.

The following interpolation modes are supported by GcSvgGraphics:

public override bool IsInterpolationModeSupported(InterpolationMode interpolationMode)

Parameters

interpolationMode InterpolationMode

The interpolation mode to check.

Returns

bool

true if the specified interpolation mode is supported by GcSvgGraphics, false otherwise.

PopGroup()

Ends the group that was created by the last PushGroup(List<SvgCustomAttribute>) call.

public void PopGroup()

PopTransparencyLayer()

Stops redirecting drawing operations to the transparency layer that was created by the last PushTransparencyLayer(RectangleF?, float) call.

public override void PopTransparencyLayer()

PushGroup(List<SvgCustomAttribute>)

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)

Parameters

customAttributes System.Collections.Generic.List<T><SvgCustomAttribute>

The list of attributes to be associated with the group.

PushTransparencyLayer(RectangleF?, float)

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)

Parameters

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 float

An opacity value that is applied uniformly to all drawings in the layer when compositing to the backplate.

SetInterpolationMode(InterpolationMode)

For internal use.

protected override void SetInterpolationMode(InterpolationMode value)

Parameters

value InterpolationMode

SetLicenseKey(string)

Sets the license key.

A license key is required to use the ToSvgDocument() method.

public static void SetLicenseKey(string key)

Parameters

key string

The license key to set.

ToSvgDocument()

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()

Returns

GcSvgDocument

The generated SVG document.