Class SvgElement
The base class of which all SVG elements are derived from.
Inherited Members
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Svg
Assembly: Svg.dll
Syntax
public abstract class SvgElement : ISvgTransformable, ICloneable, ISvgNode
Constructors
|
Improve this Doc
View Source
SvgElement()
Initializes a new instance of the SvgElement class.
Declaration
Fields
|
Improve this Doc
View Source
AutoPublishEvents
Declaration
public bool AutoPublishEvents
Field Value
Properties
|
Improve this Doc
View Source
Attributes
Gets a collection of element attributes.
Declaration
protected virtual SvgAttributeCollection Attributes { get; }
Property Value
|
Improve this Doc
View Source
BaselineShift
Specifies dominant-baseline positioning of text.
Declaration
public virtual string BaselineShift { get; set; }
Property Value
| Type |
Description |
| System.String |
|
|
Improve this Doc
View Source
Children
Gets a collection of all child SvgElement objects.
Declaration
public virtual SvgElementCollection Children { get; }
Property Value
|
Improve this Doc
View Source
Color
Gets or sets the color SvgPaintServer of this element which drives the currentColor property.
Declaration
public virtual SvgPaintServer Color { get; set; }
Property Value
|
Improve this Doc
View Source
ColorInterpolation
Gets or sets the color space for gradient interpolations, color animations and alpha compositing.
Declaration
public SvgColourInterpolation ColorInterpolation { get; set; }
Property Value
|
Improve this Doc
View Source
ColorInterpolationFilters
Gets or sets the color space for imaging operations performed via filter effects.
NOT currently mapped through to bitmap
Declaration
public SvgColourInterpolation ColorInterpolationFilters { get; set; }
Property Value
|
Improve this Doc
View Source
Content
Declaration
public virtual string Content { get; set; }
Property Value
| Type |
Description |
| System.String |
|
|
Improve this Doc
View Source
CustomAttributes
Gets a collection of custom attributes
Declaration
public SvgCustomAttributeCollection CustomAttributes { get; }
Property Value
|
Improve this Doc
View Source
Display
Gets or sets a value to determine whether the element will be rendered.
Needed to support SVG attribute display="none"
Declaration
public virtual string Display { get; set; }
Property Value
| Type |
Description |
| System.String |
|
|
Improve this Doc
View Source
ElementName
Gets the name of the element.
Declaration
protected string ElementName { get; }
Property Value
| Type |
Description |
| System.String |
|
|
Improve this Doc
View Source
ElementNamespace
Gets the elements namespace as a string.
Declaration
protected string ElementNamespace { get; set; }
Property Value
| Type |
Description |
| System.String |
|
|
Improve this Doc
View Source
Events
Declaration
protected virtual EventHandlerList Events { get; }
Property Value
|
Improve this Doc
View Source
Fill
Declaration
public virtual SvgPaintServer Fill { get; set; }
Property Value
|
Improve this Doc
View Source
FillOpacity
Gets or sets the opacity of this element's Fill.
Declaration
public virtual float FillOpacity { get; set; }
Property Value
|
Improve this Doc
View Source
FillRule
Declaration
public virtual SvgFillRule FillRule { get; set; }
Property Value
|
Improve this Doc
View Source
Font
Set all font information.
Declaration
public virtual string Font { get; set; }
Property Value
| Type |
Description |
| System.String |
|
|
Improve this Doc
View Source
FontFamily
Indicates which font family is to be used to render the text.
Declaration
public virtual string FontFamily { get; set; }
Property Value
| Type |
Description |
| System.String |
|
|
Improve this Doc
View Source
FontSize
Refers to the size of the font from baseline to baseline when multiple lines of text are set solid in a multiline layout environment.
Declaration
public virtual SvgUnit FontSize { get; set; }
Property Value
|
Improve this Doc
View Source
FontStretch
Indicates the desired amount of condensing or expansion in the glyphs used to render the text.
Declaration
public virtual SvgFontStretch FontStretch { get; set; }
Property Value
|
Improve this Doc
View Source
FontStyle
Refers to the style of the font.
Declaration
public virtual SvgFontStyle FontStyle { get; set; }
Property Value
|
Improve this Doc
View Source
FontVariant
Refers to the varient of the font.
Declaration
public virtual SvgFontVariant FontVariant { get; set; }
Property Value
|
Improve this Doc
View Source
FontWeight
Refers to the boldness of the font.
Declaration
public virtual SvgFontWeight FontWeight { get; set; }
Property Value
|
Improve this Doc
View Source
HttpClient
Declaration
protected static HttpClient HttpClient { get; }
Property Value
|
Improve this Doc
View Source
ID
Gets or sets the ID of the element.
Declaration
public string ID { get; set; }
Property Value
| Type |
Description |
| System.String |
|
Exceptions
|
Improve this Doc
View Source
IsPathDirty
Gets or sets a value indicating whether this element's 'Path' is dirty.
Declaration
protected virtual bool IsPathDirty { get; set; }
Property Value
| Type |
Description |
| Boolean |
true if the path is dirty; otherwise, false.
|
|
Improve this Doc
View Source
Namespaces
Gets the namespaces that element has.
Declaration
public Dictionary<string, string> Namespaces { get; }
Property Value
| Type |
Description |
| Dictionary<System.String, System.String> |
Key is prefix and value is namespace.
|
|
Improve this Doc
View Source
Nodes
Declaration
public IList<ISvgNode> Nodes { get; }
Property Value
|
Improve this Doc
View Source
Opacity
Gets or sets the opacity of the element. 1.0 is fully opaque; 0.0 is transparent.
Declaration
public virtual float Opacity { get; set; }
Property Value
|
Improve this Doc
View Source
OwnerDocument
Declaration
public virtual SvgDocument OwnerDocument { get; }
Property Value
|
Improve this Doc
View Source
Parent
Declaration
public virtual SvgElement Parent { get; }
Property Value
|
Improve this Doc
View Source
Parents
Declaration
public IEnumerable<SvgElement> Parents { get; }
Property Value
|
Improve this Doc
View Source
ParentsAndSelf
Declaration
public IEnumerable<SvgElement> ParentsAndSelf { get; }
Property Value
|
Improve this Doc
View Source
ShapeRendering
Refers to the AnitAlias rendering of shapes.
Declaration
public virtual SvgShapeRendering ShapeRendering { get; set; }
Property Value
|
Improve this Doc
View Source
SpaceHandling
Gets or sets the space handling.
Declaration
[SvgAttribute("space", "http://www.w3.org/XML/1998/namespace")]
public virtual XmlSpaceHandling SpaceHandling { get; set; }
Property Value
|
Improve this Doc
View Source
Stroke
Gets or sets the SvgPaintServer to be used when rendering a stroke around this element.
Declaration
public virtual SvgPaintServer Stroke { get; set; }
Property Value
|
Improve this Doc
View Source
StrokeDashArray
Declaration
[TypeConverter(typeof(SvgStrokeDashArrayConverter))]
public virtual SvgUnitCollection StrokeDashArray { get; set; }
Property Value
|
Improve this Doc
View Source
StrokeDashOffset
Declaration
public virtual SvgUnit StrokeDashOffset { get; set; }
Property Value
|
Improve this Doc
View Source
StrokeLineCap
Declaration
public virtual SvgStrokeLineCap StrokeLineCap { get; set; }
Property Value
|
Improve this Doc
View Source
StrokeLineJoin
Declaration
public virtual SvgStrokeLineJoin StrokeLineJoin { get; set; }
Property Value
|
Improve this Doc
View Source
StrokeMiterLimit
Declaration
public virtual float StrokeMiterLimit { get; set; }
Property Value
|
Improve this Doc
View Source
StrokeOpacity
Gets or sets the opacity of the stroke, if the Stroke property has been specified. 1.0 is fully opaque; 0.0 is transparent.
Declaration
public virtual float StrokeOpacity { get; set; }
Property Value
|
Improve this Doc
View Source
StrokeWidth
Gets or sets the width of the stroke (if the Stroke property has a valid value specified.
Declaration
public virtual SvgUnit StrokeWidth { get; set; }
Property Value
|
Improve this Doc
View Source
TextAnchor
Gets or sets the text anchor.
Declaration
public virtual SvgTextAnchor TextAnchor { get; set; }
Property Value
|
Improve this Doc
View Source
TextDecoration
Refers to the boldness of the font.
Declaration
public virtual SvgTextDecoration TextDecoration { get; set; }
Property Value
|
Improve this Doc
View Source
TextTransformation
Refers to the text transformation.
Declaration
public virtual SvgTextTransformation TextTransformation { get; set; }
Property Value
|
Improve this Doc
View Source
Gets or sets the element transforms.
Declaration
public SvgTransformCollection Transforms { get; set; }
Property Value
|
Improve this Doc
View Source
Visibility
Gets or sets a value to determine whether the element will be rendered.
Declaration
public virtual string Visibility { get; set; }
Property Value
| Type |
Description |
| System.String |
|
|
Improve this Doc
View Source
Writing
Declaration
protected bool Writing { get; set; }
Property Value
Methods
|
Improve this Doc
View Source
AddElement(SvgElement, Int32)
Called by the underlying SvgElement when an element has been added to the
Children collection.
Declaration
protected virtual void AddElement(SvgElement child, int index)
Parameters
| Type |
Name |
Description |
| SvgElement |
child |
The SvgElement that has been added.
|
| Int32 |
index |
An Int32 representing the index where the element was added to the collection.
|
|
Improve this Doc
View Source
AddPaths(SvgElement, GraphicsPath)
Recursive method to add up the paths of all children
Declaration
protected void AddPaths(SvgElement elem, GraphicsPath path)
Parameters
| Type |
Name |
Description |
| SvgElement |
elem |
|
| GraphicsPath |
path |
|
|
Improve this Doc
View Source
AddStyle(String, String, Int32)
Declaration
public void AddStyle(string name, string value, int specificity)
Parameters
| Type |
Name |
Description |
| System.String |
name |
The style name.
|
| System.String |
value |
The style value.
|
| Int32 |
specificity |
The specificity value.
|
|
Improve this Doc
View Source
Clone()
Creates a new object that is a copy of the current instance.
Declaration
public virtual object Clone()
Returns
| Type |
Description |
| Object |
A new object that is a copy of this instance.
|
|
Improve this Doc
View Source
ContainsAttribute(String)
Declaration
public bool ContainsAttribute(string name)
Parameters
| Type |
Name |
Description |
| System.String |
name |
|
Returns
|
Improve this Doc
View Source
CreateMouseEventAction(Action<Object, MouseArg>)
Declaration
protected Action<float, float, int, int, bool, bool, bool, string> CreateMouseEventAction(Action<object, MouseArg> eventRaiser)
Parameters
Returns
|
Improve this Doc
View Source
DeepCopy()
Declaration
public abstract SvgElement DeepCopy()
Returns
|
Improve this Doc
View Source
DeepCopy<T>()
Declaration
public virtual SvgElement DeepCopy<T>()
where T : SvgElement, new()
Returns
Type Parameters
|
Improve this Doc
View Source
Descendants()
Declaration
public IEnumerable<SvgElement> Descendants()
Returns
|
Improve this Doc
View Source
FixOpacityValue(Single)
Declaration
protected static float FixOpacityValue(float value)
Parameters
| Type |
Name |
Description |
| Single |
value |
|
Returns
|
Improve this Doc
View Source
FlushStyles(Boolean)
Declaration
public void FlushStyles(bool children = false)
Parameters
| Type |
Name |
Description |
| Boolean |
children |
If true, flush styles to the children.
|
|
Improve this Doc
View Source
GetAttribute<TAttributeType>(String, Boolean, TAttributeType)
Declaration
protected TAttributeType GetAttribute<TAttributeType>(string attributeName, bool inherited, TAttributeType defaultValue = null)
Parameters
| Type |
Name |
Description |
| System.String |
attributeName |
|
| Boolean |
inherited |
|
| TAttributeType |
defaultValue |
|
Returns
| Type |
Description |
| TAttributeType |
|
Type Parameters
| Name |
Description |
| TAttributeType |
|
|
Improve this Doc
View Source
GetPaths(SvgElement, ISvgRenderer)
Recursive method to add up the paths of all children
Declaration
protected GraphicsPath GetPaths(SvgElement elem, ISvgRenderer renderer)
Parameters
Returns
| Type |
Description |
| GraphicsPath |
|
|
Improve this Doc
View Source
HasChildren()
Gets a value to determine whether the element has children.
Declaration
public virtual bool HasChildren()
Returns
|
Improve this Doc
View Source
InitialiseFromXML(XmlReader, SvgDocument)
Declaration
public virtual void InitialiseFromXML(XmlReader reader, SvgDocument document)
Parameters
| Type |
Name |
Description |
| System.Xml.XmlReader |
reader |
|
| SvgDocument |
document |
|
|
Improve this Doc
View Source
InvalidateChildPaths()
Force recreation of the paths for the element and it's children.
Declaration
public void InvalidateChildPaths()
|
Improve this Doc
View Source
OnAttributeChanged(AttributeEventArgs)
Declaration
protected void OnAttributeChanged(AttributeEventArgs args)
Parameters
|
Improve this Doc
View Source
OnContentChanged(ContentEventArgs)
Declaration
protected void OnContentChanged(ContentEventArgs args)
Parameters
|
Improve this Doc
View Source
Declaration
protected void OnMouseScroll(int scroll, bool ctrlKey, bool shiftKey, bool altKey, string sessionID)
Parameters
|
Improve this Doc
View Source
Removes any previously applied transforms from the specified ISvgRenderer.
Declaration
protected virtual void PopTransforms(ISvgRenderer renderer)
Parameters
|
Improve this Doc
View Source
Declaration
protected virtual bool PushTransforms(ISvgRenderer renderer)
Parameters
Returns
|
Improve this Doc
View Source
RaiseMouseClick(Object, MouseArg)
Declaration
protected void RaiseMouseClick(object sender, MouseArg e)
Parameters
|
Improve this Doc
View Source
RaiseMouseDown(Object, MouseArg)
Declaration
protected void RaiseMouseDown(object sender, MouseArg e)
Parameters
|
Improve this Doc
View Source
RaiseMouseMove(Object, MouseArg)
Declaration
protected void RaiseMouseMove(object sender, MouseArg e)
Parameters
|
Improve this Doc
View Source
RaiseMouseOut(Object, MouseArg)
Declaration
protected void RaiseMouseOut(object sender, MouseArg args)
Parameters
|
Improve this Doc
View Source
RaiseMouseOver(Object, MouseArg)
Declaration
protected void RaiseMouseOver(object sender, MouseArg args)
Parameters
|
Improve this Doc
View Source
Declaration
protected void RaiseMouseScroll(object sender, MouseScrollArg e)
Parameters
|
Improve this Doc
View Source
RaiseMouseUp(Object, MouseArg)
Declaration
protected void RaiseMouseUp(object sender, MouseArg e)
Parameters
|
Improve this Doc
View Source
RegisterEvents(ISvgEventCaller)
Use this method to provide your implementation ISvgEventCaller which can register Actions
and call them if one of the events occurs. Make sure, that your SvgElement has a unique ID.
The SvgTextElement overwrites this and regsiters the Change event tor its text content.
Declaration
public virtual void RegisterEvents(ISvgEventCaller caller)
Parameters
|
Improve this Doc
View Source
RemoveElement(SvgElement)
Called by the underlying SvgElement when an element has been removed from the
Children collection.
Declaration
protected virtual void RemoveElement(SvgElement child)
Parameters
|
Improve this Doc
View Source
Render(ISvgRenderer)
Declaration
protected virtual void Render(ISvgRenderer renderer)
Parameters
|
Improve this Doc
View Source
RenderChildren(ISvgRenderer)
Declaration
protected virtual void RenderChildren(ISvgRenderer renderer)
Parameters
|
Improve this Doc
View Source
RenderElement(ISvgRenderer)
Declaration
public void RenderElement(ISvgRenderer renderer)
Parameters
|
Improve this Doc
View Source
SetAndForceUniqueID(String, Boolean, Action<SvgElement, String, String>)
Declaration
public void SetAndForceUniqueID(string value, bool autoForceUniqueID = true, Action<SvgElement, string, string> logElementOldIDNewID = null)
Parameters
| Type |
Name |
Description |
| System.String |
value |
|
| Boolean |
autoForceUniqueID |
|
| System.Action<SvgElement, System.String, System.String> |
logElementOldIDNewID |
|
|
Improve this Doc
View Source
ShouldWriteElement()
Derrived classes may decide that the element should not be written. For example, the text element shouldn't be written if it's empty.
Declaration
public virtual bool ShouldWriteElement()
Returns
|
Improve this Doc
View Source
Transforms the given rectangle with the set transformation, if any.
Can be applied to bounds calculated without considering the element transformation.
Declaration
protected RectangleF TransformedBounds(RectangleF bounds)
Parameters
| Type |
Name |
Description |
| RectangleF |
bounds |
The rectangle to be transformed.
|
Returns
| Type |
Description |
| RectangleF |
The transformed rectangle, or the original rectangle if no transformation exists.
|
|
Improve this Doc
View Source
TryGetAttribute(String, out String)
Declaration
public bool TryGetAttribute(string name, out string value)
Parameters
| Type |
Name |
Description |
| System.String |
name |
|
| System.String |
value |
|
Returns
|
Improve this Doc
View Source
UnregisterEvents(ISvgEventCaller)
Use this method to provide your implementation ISvgEventCaller to unregister Actions
Declaration
public virtual void UnregisterEvents(ISvgEventCaller caller)
Parameters
|
Improve this Doc
View Source
ValidateFontFamily(String, SvgDocument, SvgFontManager)
Declaration
public static object ValidateFontFamily(string fontFamilyList, SvgDocument doc, SvgFontManager fontManager)
Parameters
Returns
|
Improve this Doc
View Source
Write(XmlWriter)
Write this SvgElement out using a given XmlWriter.
Declaration
public virtual void Write(XmlWriter writer)
Parameters
| Type |
Name |
Description |
| System.Xml.XmlWriter |
writer |
The XmlWriter to use.
|
|
Improve this Doc
View Source
WriteAttributes(XmlWriter)
Declaration
protected virtual void WriteAttributes(XmlWriter writer)
Parameters
| Type |
Name |
Description |
| System.Xml.XmlWriter |
writer |
|
|
Improve this Doc
View Source
WriteChildren(XmlWriter)
Declaration
protected virtual void WriteChildren(XmlWriter writer)
Parameters
| Type |
Name |
Description |
| System.Xml.XmlWriter |
writer |
|
|
Improve this Doc
View Source
WriteEndElement(XmlWriter)
Declaration
protected virtual void WriteEndElement(XmlWriter writer)
Parameters
| Type |
Name |
Description |
| System.Xml.XmlWriter |
writer |
|
|
Improve this Doc
View Source
WriteStartElement(XmlWriter)
Declaration
protected virtual void WriteStartElement(XmlWriter writer)
Parameters
| Type |
Name |
Description |
| System.Xml.XmlWriter |
writer |
|
Events
|
Improve this Doc
View Source
AttributeChanged
Fired when an Atrribute of this Element has changed
Declaration
public event EventHandler<AttributeEventArgs> AttributeChanged
Event Type
|
Improve this Doc
View Source
ChildAdded
Fired when an Element was added to the children of this Element
Declaration
public event EventHandler<ChildAddedEventArgs> ChildAdded
Event Type
|
Improve this Doc
View Source
Click
Declaration
public event EventHandler<MouseArg> Click
Event Type
| Type |
Description |
| System.EventHandler<MouseArg> |
|
|
Improve this Doc
View Source
ContentChanged
Fired when an Atrribute of this Element has changed
Declaration
public event EventHandler<ContentEventArgs> ContentChanged
Event Type
|
Improve this Doc
View Source
Load
Occurs when the element is loaded.
Declaration
public event EventHandler Load
Event Type
|
Improve this Doc
View Source
MouseDown
Declaration
public event EventHandler<MouseArg> MouseDown
Event Type
| Type |
Description |
| System.EventHandler<MouseArg> |
|
|
Improve this Doc
View Source
MouseMove
Declaration
public event EventHandler<MouseArg> MouseMove
Event Type
| Type |
Description |
| System.EventHandler<MouseArg> |
|
|
Improve this Doc
View Source
MouseOut
Declaration
public event EventHandler<MouseArg> MouseOut
Event Type
| Type |
Description |
| System.EventHandler<MouseArg> |
|
|
Improve this Doc
View Source
MouseOver
Declaration
public event EventHandler<MouseArg> MouseOver
Event Type
| Type |
Description |
| System.EventHandler<MouseArg> |
|
|
Improve this Doc
View Source
Declaration
public event EventHandler<MouseScrollArg> MouseScroll
Event Type
|
Improve this Doc
View Source
MouseUp
Declaration
public event EventHandler<MouseArg> MouseUp
Event Type
| Type |
Description |
| System.EventHandler<MouseArg> |
|
Explicit Interface Implementations
|
Improve this Doc
View Source
ISvgNode.DeepCopy()
Declaration
ISvgNode ISvgNode.DeepCopy()
Returns
|
Improve this Doc
View Source
Removes any previously applied transforms from the specified ISvgRenderer.
Declaration
void ISvgTransformable.PopTransforms(ISvgRenderer renderer)
Parameters
|
Improve this Doc
View Source
Declaration
void ISvgTransformable.PushTransforms(ISvgRenderer renderer)
Parameters
Implements
Extension Methods