Class SvgImage
A vector image backed by a VectorScene, loadable from and savable to SVG, EMF, WMF, and raster formats. Mirrors Metafile.
Implements
Inherited Members
Namespace: DRIT.Drawing.Imaging
Assembly: DRIT.Drawing.dll
Syntax
public sealed class SvgImage : Image, IDisposable
Constructors
SvgImage(Stream)
Initializes a new SvgImage by loading an SVG document from the specified stream.
Declaration
public SvgImage(Stream stream)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | stream | The stream to load from. |
SvgImage(int, int)
Initializes a new empty SvgImage with the specified dimensions.
Declaration
public SvgImage(int width, int height)
Parameters
| Type | Name | Description |
|---|---|---|
| int | width | The canvas width in pixels. |
| int | height | The canvas height in pixels. |
SvgImage(int, int, float, float)
Initializes a new empty SvgImage with the specified dimensions and resolution.
Declaration
public SvgImage(int width, int height, float dpiX, float dpiY)
Parameters
| Type | Name | Description |
|---|---|---|
| int | width | The canvas width in pixels. |
| int | height | The canvas height in pixels. |
| float | dpiX | The horizontal resolution in dots per inch. |
| float | dpiY | The vertical resolution in dots per inch. |
SvgImage(string)
Initializes a new SvgImage by loading an SVG document from the specified file.
Declaration
public SvgImage(string filename)
Parameters
| Type | Name | Description |
|---|---|---|
| string | filename | The SVG file to load. |
Properties
EmfOutputMode
Gets or sets the EMF output mode used when saving this image as EMF. The Excel-compatible coordinate option always enables dual mode.
Declaration
public EmfOutputMode EmfOutputMode { get; set; }
Property Value
| Type | Description |
|---|---|
| EmfOutputMode |
Flags
Gets the flags for this image.
Declaration
public override int Flags { get; }
Property Value
| Type | Description |
|---|---|
| int |
Overrides
Height
Gets the height of this image in pixels.
Declaration
public override int Height { get; }
Property Value
| Type | Description |
|---|---|
| int |
Overrides
PixelFormat
Gets the pixel format of this image.
Declaration
public override PixelFormat PixelFormat { get; }
Property Value
| Type | Description |
|---|---|
| PixelFormat |
Overrides
RawFormat
Gets the format of this image.
Declaration
public override ImageFormat RawFormat { get; }
Property Value
| Type | Description |
|---|---|
| ImageFormat |
Overrides
UseClassicEmfOutput
Gets or sets whether EMF output omits EMF+ comments and uses only the classic EMF fallback records.
Declaration
public bool UseClassicEmfOutput { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
UseExcelCompatibleEmfCoordinates
Gets or sets whether EMF output uses Excel-compatible logical path coordinates: path points are written at sixteen times their effective coordinates and bracketed by a 1/16 world transform.
Declaration
public bool UseExcelCompatibleEmfCoordinates { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
Width
Gets the width of this image in pixels.
Declaration
public override int Width { get; }
Property Value
| Type | Description |
|---|---|
| int |
Overrides
Methods
Clone()
Creates an exact copy of this image.
Declaration
public override Image Clone()
Returns
| Type | Description |
|---|---|
| Image | A new Image with the same content. |
Overrides
CreateGraphics()
Creates a Graphics surface for drawing onto this SVG
image. Drawing operations are recorded as vector commands; no
rasterization occurs until RenderToBitmap is called.
Declaration
public Graphics CreateGraphics()
Returns
| Type | Description |
|---|---|
| Graphics | A Graphics backed by a RecordingGraphics. |
RenderToBitmap()
Renders this SVG image to a Bitmap by replaying the recorded commands onto a raster Graphics surface.
Declaration
public Bitmap RenderToBitmap()
Returns
| Type | Description |
|---|---|
| Bitmap | The rendered bitmap. |
RenderToBitmap(int, int)
Renders this SVG image to a Bitmap of the specified size by replaying the recorded commands onto a scaled raster surface.
Declaration
public Bitmap RenderToBitmap(int width, int height)
Parameters
| Type | Name | Description |
|---|---|---|
| int | width | The output bitmap width. |
| int | height | The output bitmap height. |
Returns
| Type | Description |
|---|---|
| Bitmap | The rendered bitmap. |
RotateFlip(RotateFlipType)
Rotates and flips the image.
Declaration
public override void RotateFlip(RotateFlipType rotateFlipType)
Parameters
| Type | Name | Description |
|---|---|---|
| RotateFlipType | rotateFlipType | The rotation and flip type. |
Overrides
Save(Stream, ImageFormat)
Saves this image to the specified stream in the specified format.
Declaration
public override void Save(Stream stream, ImageFormat format)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | stream | The stream to save to. |
| ImageFormat | format | The format to save in. |
Overrides
Save(Stream, ImageFormat, EncoderParameters?)
Saves this image to the specified stream in the specified format with encoder parameters.
Declaration
public override void Save(Stream stream, ImageFormat format, EncoderParameters? encoderParams)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | stream | The stream to save to. |
| ImageFormat | format | The format to save in. |
| EncoderParameters | encoderParams | The encoder parameters. |
Overrides
Save(string)
Saves this image to the specified file.
Declaration
public override void Save(string filename)
Parameters
| Type | Name | Description |
|---|---|---|
| string | filename | The file name to save to. |
Overrides
Save(string, ImageFormat)
Saves this image to the specified file in the specified format.
Declaration
public override void Save(string filename, ImageFormat format)
Parameters
| Type | Name | Description |
|---|---|---|
| string | filename | The file name to save to. |
| ImageFormat | format | The format to save in. |