API Reference
OfficeSvgImageRenderer
Shared dependency-free SVG renderer for projected bitmap/vector images.
Inheritance
- Object
- OfficeSvgImageRenderer
Methods
public static StringBuilder AppendImage(StringBuilder builder, String href, Double x, Double y, Double width, Double height, String clipPathId = null, Double clipX = 0, Double clipY = 0, Double clipWidth = 0, Double clipHeight = 0, Double sourceLeft = 0, Double sourceTop = 0, Double sourceWidth = 1, Double sourceHeight = 1, Double rotationDegrees = 0, Boolean flipHorizontal = false, Boolean flipVertical = false, String preserveAspectRatio = null) #StringBuilderAppends an SVG image using normalized source cropping, optional clipping, rotation, and flips.
Parameters
- builder System.Text.StringBuilder
- Markup builder.
- href System.String
- Resolved SVG image reference, such as a data URI.
- x System.Double
- Destination left coordinate.
- y System.Double
- Destination top coordinate.
- width System.Double
- Destination width.
- height System.Double
- Destination height.
- clipPathId System.String = null
- Optional clip-path identifier. Required when source crop should be clipped to the destination rectangle.
- clipX System.Double = 0
- Clip rectangle left coordinate.
- clipY System.Double = 0
- Clip rectangle top coordinate.
- clipWidth System.Double = 0
- Clip rectangle width.
- clipHeight System.Double = 0
- Clip rectangle height.
- sourceLeft System.Double = 0
- Normalized source left crop ratio.
- sourceTop System.Double = 0
- Normalized source top crop ratio.
- sourceWidth System.Double = 1
- Normalized visible source width ratio.
- sourceHeight System.Double = 1
- Normalized visible source height ratio.
- rotationDegrees System.Double = 0
- Clockwise SVG rotation in degrees.
- flipHorizontal System.Boolean = false
- Whether to mirror the image horizontally around the destination center.
- flipVertical System.Boolean = false
- Whether to mirror the image vertically around the destination center.
- preserveAspectRatio System.String = null
- Optional SVG preserveAspectRatio value.
Returns
The supplied builder for call chaining.
public static StringBuilder AppendImage(StringBuilder builder, String href, OfficeImageProjection projection, String clipPathId = null, Nullable<OfficeImagePlacement> clipRectangle = null, String preserveAspectRatio = null) #StringBuilderAppends an SVG image using a shared projection that carries placement, source crop, rotation, and flips.
Parameters
- builder System.Text.StringBuilder
- Markup builder.
- href System.String
- Resolved SVG image reference, such as a data URI.
- projection OfficeIMO.Drawing.OfficeImageProjection
- Shared image projection.
- clipPathId System.String = null
- Optional clip-path identifier. Required when the projection has a source crop.
- clipRectangle System.Nullable{OfficeIMO.Drawing.OfficeImagePlacement} = null
- Optional clip rectangle. Defaults to the projection placement when source crop is used.
- preserveAspectRatio System.String = null
- Optional SVG preserveAspectRatio value.
Returns
The supplied builder for call chaining.
public static StringBuilder AppendImageInViewport(StringBuilder builder, String href, OfficeImageProjection projection, String clipPathId, OfficeImagePlacement viewport, String preserveAspectRatio = null) #StringBuilderAppends an SVG image inside a viewport, using the projection placement as the clip for source-cropped images and the viewport as the clip for uncropped images.
Parameters
- builder System.Text.StringBuilder
- Markup builder.
- href System.String
- Resolved SVG image reference, such as a data URI.
- projection OfficeIMO.Drawing.OfficeImageProjection
- Shared image projection.
- clipPathId System.String
- Clip-path identifier used for the viewport or crop clip.
- viewport OfficeIMO.Drawing.OfficeImagePlacement
- Viewport rectangle that clips uncropped images.
- preserveAspectRatio System.String = null
- Optional SVG preserveAspectRatio value.
Returns
The supplied builder for call chaining.
public static String CreateDataUri(String contentType, Byte[] bytes) #StringBuilds a data URI image reference from a known-safe content type and image bytes.
Parameters
- contentType System.String
- Image MIME content type.
- bytes System.Byte[]
- Image bytes.
Returns
SVG data URI image reference.
public static Boolean TryCreateDataUri(String declaredContentType, Byte[] bytes, String fileName, out String dataUri) #BooleanCreates an SVG-safe data URI for image bytes that can either be embedded directly or transcoded through the shared raster decoder.
Parameters
- declaredContentType System.String
- Optional content type from the source package or caller.
- bytes System.Byte[]
- Image bytes.
- fileName System.String
- Optional file name or extension used when metadata is absent or generic.
- dataUri System.String@
- SVG data URI when the image can be represented in SVG output.
Returns
true when the image can be embedded in SVG output.
public static Boolean TryCreateDataUri(String declaredContentType, Byte[] bytes, String fileName, IOfficeRasterImageCodec imageCodec, out String dataUri) #BooleanCreates an SVG-safe data URI, using an optional shared raster codec when Drawing cannot decode the source format.
Parameters
- declaredContentType System.String
- bytes System.Byte[]
- fileName System.String
- imageCodec OfficeIMO.Drawing.IOfficeRasterImageCodec
- dataUri System.String@
public static Boolean TryGetEmbeddableContentType(OfficeImageFormat format, out String contentType) #BooleanResolves the MIME content type for image formats that can be embedded directly in SVG image elements.
Parameters
- format OfficeIMO.Drawing.OfficeImageFormat
- Detected image format.
- contentType System.String@
- Resolved MIME content type when supported.
Returns
true when the format can be embedded as an SVG image href.
public static Boolean TryGetEmbeddableContentType(String contentType, out String normalizedContentType) #BooleanResolves and normalizes a MIME content type when it can be embedded directly in an SVG image element.
Parameters
- contentType System.String
- MIME content type, optionally with parameters.
- normalizedContentType System.String@
- Canonical MIME content type when supported.
Returns
true when the content type can be embedded as an SVG image href.
public static Boolean TryResolveEmbeddableContentType(String declaredContentType, Byte[] bytes, String fileName, out String contentType) #BooleanResolves an SVG-embeddable image content type from declared package metadata, image bytes, or a file name.
Parameters
- declaredContentType System.String
- Optional content type from the source package or caller.
- bytes System.Byte[]
- Optional image bytes used for dependency-free signature sniffing.
- fileName System.String
- Optional file name or extension used when metadata is absent or generic.
- contentType System.String@
- Resolved MIME content type when supported.
Returns
true when the image can be embedded directly in an SVG image href.
public static Void WriteImage(XmlWriter writer, String svgNamespace, String href, Double x, Double y, Double width, Double height, Double rotationDegrees = 0, Nullable<Double> rotationCenterX = null, Nullable<Double> rotationCenterY = null, Boolean flipHorizontal = false, Boolean flipVertical = false, String preserveAspectRatio = null, Action<XmlWriter> writeAdditionalAttributes = null) #VoidWrites an SVG image element using shared numeric formatting, optional preserve-aspect behavior, rotation, and flips.
Parameters
- writer System.Xml.XmlWriter
- SVG writer.
- svgNamespace System.String
- SVG namespace URI.
- href System.String
- Resolved SVG image reference, such as a data URI.
- x System.Double
- Destination left coordinate.
- y System.Double
- Destination top coordinate.
- width System.Double
- Destination width.
- height System.Double
- Destination height.
- rotationDegrees System.Double = 0
- Clockwise SVG rotation in degrees.
- rotationCenterX System.Nullable{System.Double} = null
- Rotation center X coordinate. When omitted, the destination center is used.
- rotationCenterY System.Nullable{System.Double} = null
- Rotation center Y coordinate. When omitted, the destination center is used.
- flipHorizontal System.Boolean = false
- Whether to mirror the image horizontally around the rotation center.
- flipVertical System.Boolean = false
- Whether to mirror the image vertically around the rotation center.
- preserveAspectRatio System.String = null
- Optional SVG preserveAspectRatio value.
- writeAdditionalAttributes System.Action{System.Xml.XmlWriter} = null
- Optional callback for adapter-specific attributes.
public static Void WriteImage(XmlWriter writer, String svgNamespace, String href, OfficeImageProjection projection, String preserveAspectRatio = null, Action<XmlWriter> writeAdditionalAttributes = null, String clipPathId = null, Nullable<OfficeImagePlacement> clipRectangle = null) #VoidWrites an SVG image element using a shared projection that carries placement, rotation, and flips.
Parameters
- writer System.Xml.XmlWriter
- SVG writer.
- svgNamespace System.String
- SVG namespace URI.
- href System.String
- Resolved SVG image reference, such as a data URI.
- projection OfficeIMO.Drawing.OfficeImageProjection
- Shared image projection.
- preserveAspectRatio System.String = null
- Optional SVG preserveAspectRatio value.
- writeAdditionalAttributes System.Action{System.Xml.XmlWriter} = null
- Optional callback for adapter-specific attributes.
- clipPathId System.String = null
- Optional clip-path identifier. Required when the projection has a source crop.
- clipRectangle System.Nullable{OfficeIMO.Drawing.OfficeImagePlacement} = null
- Optional clip rectangle. Defaults to the projection placement when source crop is used.
public static Void WriteImageInViewport(XmlWriter writer, String svgNamespace, String href, OfficeImageProjection projection, String clipPathId, OfficeImagePlacement viewport, String preserveAspectRatio = null, Action<XmlWriter> writeAdditionalAttributes = null) #VoidWrites an SVG image inside a viewport, using the projection placement as the clip for source-cropped images and the viewport as the clip for uncropped images.
Parameters
- writer System.Xml.XmlWriter
- SVG writer.
- svgNamespace System.String
- SVG namespace URI.
- href System.String
- Resolved SVG image reference, such as a data URI.
- projection OfficeIMO.Drawing.OfficeImageProjection
- Shared image projection.
- clipPathId System.String
- Clip-path identifier used for the viewport or crop clip.
- viewport OfficeIMO.Drawing.OfficeImagePlacement
- Viewport rectangle that clips uncropped images.
- preserveAspectRatio System.String = null
- Optional SVG preserveAspectRatio value.
- writeAdditionalAttributes System.Action{System.Xml.XmlWriter} = null
- Optional callback for adapter-specific attributes.
Inherited Methods
public override Boolean Equals(Object obj) #BooleanParameters
- obj Object