forked from svg-net/SVG
-
Notifications
You must be signed in to change notification settings - Fork 0
Home
H1Gdev edited this page Nov 3, 2024
·
88 revisions
Scalable Vector Graphics
- svg
- File extension is
.svg
. - MIME type is
image/svg+xml
.
- File extension is
- svgz
- File extension is
.svgz
. - MIME type is
image/svg+xml
. - Encoding is
gzip
.
- File extension is
Combinator | |
---|---|
|| |
Concat |
Class | Element |
---|---|
SvgFragment |
<svg> |
SvgRectangle |
<rect> |
SvgCircle |
<circle> |
SvgEllipse |
<ellipse> |
SvgLine |
<line> |
SvgPolygon |
<polygon> |
SvgPolyline |
<polyline> |
SvgPath |
<path> |
SvgText |
<text> |
SvgTextSpan |
<tspan> |
SvgDefinitionList |
<defs> |
SvgUnknownElement |
|
NonSvgElement |
SvgElement |
|
---|---|
↑ | |
SvgVisualElement |
|
↑ | ↑ |
SvgPathBasedElement |
SvgTextBase |
↑ | |
SvgMarkerElement |
protected internal virtual SvgAttributeCollection Attributes { get; }
// -> SVG attributes
public SvgCustomAttributeCollection CustomAttributes { get; }
// -> User custom attributes
Method | |
---|---|
GetAttribute |
|
GetInheritedAttribute |
== Indexer |
attributeValue
> parentAttributeValue
> defaultValue
public abstract GraphicsPath Path(ISvgRenderer renderer);
// renderer
// null -> Boundary with stroke.
// other -> Boundary without stroke.
public RectangleF Bounds { get; }
// -> Boundary with stroke.
- Load
Open
-
FromSvg
FlushStyles
- Set
-
BaseUri
(if needed.)
-
- Render
-
Draw
Render
-
- Save
Write
Parameter | Description |
---|---|
ElementName |
Class | Type |
---|---|
SvgUnitConverter |
length |
SvgPaintServerFactory |
color |
SvgPathBuilder |
path data |
- do not use EnumConverter.
SvgElement |
|||||
---|---|---|---|---|---|
↑ | |||||
SvgPaintServer |
|||||
↑ | ↑ | ↑ | ↑ | ↑ | |
SvgColourServer |
SvgDeferredPaintServer |
SvgFallbackPaintServer |
SvgGradientServer |
SvgPatternServer |
|
↑ | ↑ | ||||
SvgLinearGradientServer |
SvgRadialGradientServer |
Parameter | Description |
---|---|
Name | |
NameSpace | Namespace URI.(svg, xml, xlink) |
- Implement
IGraphicsProvider
andISvgRenderer
. - Has
Graphics
.
public static ISvgRenderer FromImage(Image image)
{
g.PixelOffsetMode = PixelOffsetMode.Half;
g.CompositingQuality = CompositingQuality.HighQuality; // for compositing.
// for text.
g.TextRenderingHint = TextRenderingHint.AntiAlias;
g.TextContrast = 1;
}
g.SmoothingMode = SmoothingMode.AntiAlias;
// -> completely horizontal and one width lines are blurred...
Class | Command |
---|---|
SvgMoveToSegment |
M m
|
SvgClosePathSegment |
Z z
|
SvgLineSegment |
L l
|
H h
|
|
V v
|
|
SvgCubicCurveSegment |
C c
|
S s
|
|
SvgQuadraticCurveSegment |
Q q
|
T t
|
|
SvgArcSegment |
A a
|
Class | Element |
---|---|
SvgFilter |
<filter> |
SvgGaussianBlur |
<feGaussianBlur> |
SvgElement |
|
---|---|
↑ | ↑ |
SvgFilter |
SvgFilterPrimitive |
GDI+(Graphics Device Interface +)
- Draw
- Fill
Graphics vs. TextRenderer
Class | Interface | .NET Framework | SetCompatibleTextRenderingDefault | UseCompatibleTextRendering |
---|---|---|---|---|
Graphics | GDI+ | 1.1 - | true | true |
TextRenderer | GDI | 2.0 - | false | false |
- LightGray is LightGrey
- Origin is
Graphics
(0, 0).
- Graphics shape
-
GetBounds()
-
GetBounds()
is readonly. (returns Bounds copied.) - Bounds is only draw area. (Whitespace character etc. at both ends are not included.)
-
-
AddPath()
-
AddPath()
cannot set emptyGraphicsPath
(PointCount
is zero). (ArgumentException
is thrown.)
-
Implements IDisposable
- Region ★
- GraphicsPath ★
- Matrix
-
Image
- Bitmap
- Must keep
Stream
open for lifetime ofImage
.
- Graphics
- ImageAttributes
- StringFormat
- PrivateFontCollection
- Stream
- .NET repositories
- .NET Runtime
- TFM(Target Framework Moniker)
- XAML(eXtensible Application Markup Language)
- Latest version is
WinUI 3
.