Skip to content
This repository was archived by the owner on Mar 30, 2019. It is now read-only.

Commit d7afe18

Browse files
committed
Add method to get a com attribute from svg element
1 parent ff84fb0 commit d7afe18

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

Source/SharpDX.Direct2D1/SvgElement.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,5 +363,18 @@ public unsafe void GetAttributeValue(string name, out SvgLength length)
363363
GetAttributeValue(name, SvgAttributePodType.Length, new IntPtr(ptr), sizeof(SvgLength));
364364
}
365365
}
366+
367+
/// <summary>
368+
/// Gets an attribute from a type id
369+
/// </summary>
370+
/// <typeparam name="T">Attribute type, must inherit from <see cref="SvgAttribute"/></typeparam>
371+
/// <param name="name">Attribute name</param>
372+
/// <returns>Attribute instance</returns>
373+
public T GetAttributeValue<T>(string name) where T : SvgAttribute
374+
{
375+
IntPtr nativePointer;
376+
GetAttributeValue(name, SharpDX.Utilities.GetGuidFromType(typeof(T)), out nativePointer);
377+
return ComObject.FromPointer<T>(nativePointer);
378+
}
366379
}
367380
}

0 commit comments

Comments
 (0)