Class SvgImage
An image: a raster drawn into a rectangle, or another SVG document drawn as a group.
public sealed record SvgImage : SvgNode, IEquatable<SvgNode>, IEquatable<SvgImage>
- Inheritance
-
SvgImage
- Implements
- Inherited Members
Examples
// The resolved tree: groups, paths with their paints and strokes, images; styles applied and units in pixels.
static void Walk(SvgNode node, int depth)
{
string what = node switch
{
SvgPath path => $"path {path.Path.Bounds} fill {path.Fill}",
SvgGroup group => $"group of {group.Children.Count}",
SvgImage image => $"image {image.Destination}",
_ => node.GetType().Name,
};
Console.WriteLine($"{new string(' ', depth * 2)}{node.Id} {what} opacity {node.Opacity}");
if (node is SvgGroup g)
{
foreach (SvgNode child in g.Children)
{
Walk(child, depth + 1);
}
}
}
Walk(document.RenderTree, 0);
Properties
ClipRect
Gets a rectangle the image is clipped to (the image element's viewport), or null.
public RectF? ClipRect { get; init; }
Property Value
Destination
Gets where the image's view is drawn, after preserveAspectRatio, in this node's coordinates.
public RectF Destination { get; init; }
Property Value
Document
Gets the SVG document, or null for a raster image.
public SvgDocument? Document { get; init; }
Property Value
Raster
Gets the raster, still encoded, or null for an SVG image.
public EncodedImage? Raster { get; init; }
Property Value
Sampling
Gets how the raster is sampled (image-rendering).
public SamplingOptions? Sampling { get; init; }
Property Value
Source
Gets the part of the image drawn into Destination, in the image's pixels (or the document's user units).
public RectF Source { get; init; }