1 module aurora.directx.d2d1.d2d1svg;
2 
3 version(Windows):
4 
5 public import aurora.directx.d2d1.d2d1_2;
6 
7 public:
8 
9 ///
10 /// Enumerations
11 ///
12 
13 enum D2D1_SVG_PAINT_TYPE : int
14 {
15     NONE = 0,
16     COLOR = 1,
17     CURRENT_COLOR = 2,
18     URI = 3,
19     URI_NONE = 4,
20     URI_COLOR = 5,
21     URI_CURRENT_COLOR = 6,
22     FORCE_DWORD = 0xffffffff
23 }
24 
25 enum D2D1_SVG_LENGTH_UNITS : int
26 {
27     D2D1_SVG_LENGTH_UNITS_NUMBER = 0,
28     D2D1_SVG_LENGTH_UNITS_PERCENTAGE = 1,
29     D2D1_SVG_LENGTH_UNITS_FORCE_DWORD = 0xffffffff
30 }
31 
32 enum D2D1_SVG_DISPLAY : int
33 {
34     INLINE = 0,
35     NONE = 1,
36     FORCE_DWORD = 0xffffffff
37 }
38 
39 enum D2D1_SVG_VISIBILITY : int
40 {
41     VISIBLE = 0,
42     HIDDEN = 1,
43     FORCE_DWORD = 0xffffffff
44 }
45 
46 enum D2D1_SVG_OVERFLOW : int
47 {
48     VISIBLE = 0,
49     HIDDEN = 1,
50     FORCE_DWORD = 0xffffffff
51 }
52 
53 enum D2D1_SVG_LINE_CAP : int
54 {
55     BUTT = D2D1_CAP_STYLE.FLAT,
56     SQUARE = D2D1_CAP_STYLE.SQUARE,
57     ROUND = D2D1_CAP_STYLE.ROUND,
58     FORCE_DWORD = 0xffffffff
59 }
60 
61 enum D2D1_SVG_LINE_JOIN : int
62 {
63     BEVEL = D2D1_LINE_JOIN.BEVEL,
64     MITER = D2D1_LINE_JOIN.MITER_OR_BEVEL,
65     ROUND = D2D1_LINE_JOIN.ROUND,
66     FORCE_DWORD = 0xffffffff
67 }
68 
69 enum D2D1_SVG_ASPECT_ALIGN : int
70 {
71     NONE = 0,
72     X_MIN_Y_MIN = 1,
73     X_MID_Y_MIN = 2,
74     X_MAX_Y_MIN = 3,
75     X_MIN_Y_MID = 4,
76     X_MID_Y_MID = 5,
77     X_MAX_Y_MID = 6,
78     X_MIN_Y_MAX = 7,
79     X_MID_Y_MAX = 8,
80     X_MAX_Y_MAX = 9,
81     FORCE_DWORD = 0xffffffff
82 }
83 
84 enum D2D1_SVG_ASPECT_SCALING : int
85 {
86     MEET = 0,
87     SLICE = 1,
88     FORCE_DWORD = 0xffffffff
89 }
90 
91 enum D2D1_SVG_PATH_COMMAND : int
92 {
93     CLOSE_PATH = 0,
94     MOVE_ABSOLUTE = 1,
95     MOVE_RELATIVE = 2,
96     LINE_ABSOLUTE = 3,
97     LINE_RELATIVE = 4,
98     CUBIC_ABSOLUTE = 5,
99     CUBIC_RELATIVE = 6,
100     QUADRADIC_ABSOLUTE = 7,
101     QUADRADIC_RELATIVE = 8,
102     ARC_ABSOLUTE = 9,
103     ARC_RELATIVE = 10,
104     HORIZONTAL_ABSOLUTE = 11,
105     HORIZONTAL_RELATIVE = 12,
106     VERTICAL_ABSOLUTE = 13,
107     VERTICAL_RELATIVE = 14,
108     CUBIC_SMOOTH_ABSOLUTE = 15,
109     CUBIC_SMOOTH_RELATIVE = 16,
110     QUADRADIC_SMOOTH_ABSOLUTE = 17,
111     QUADRADIC_SMOOTH_RELATIVE = 18,
112     FORCE_DWORD = 0xffffffff
113 }
114 
115 enum D2D1_SVG_UNIT_TYPE : int
116 {
117     USER_SPACE_ON_USE = 0,
118     OBJECT_BOUNDING_BOX = 1,
119     FORCE_DWORD = 0xffffffff
120 }
121 
122 enum D2D1_SVG_ATTRIBUTE_STRING_TYPE : int
123 {
124     SVG = 0,
125     ID = 1,
126     FORCE_DWORD = 0xffffffff
127 }
128 
129 enum D2D1_SVG_ATTRIBUTE_POD_TYPE : int
130 {
131     FLOAT = 0,
132     COLOR = 1,
133     FILL_MODE = 2,
134     DISPLAY = 3,
135     OVERFLOW = 4,
136     LINE_CAP = 5,
137     LINE_JOIN = 6,
138     VISIBILITY = 7,
139     MATRIX = 8,
140     UNIT_TYPE = 9,
141     EXTEND_MODE = 10,
142     PRESERVE_ASPECT_RATIO = 11,
143     VIEWBOX = 12,
144     LENGTH = 13,
145     FORCE_DWORD = 0xffffffff
146 }
147 
148 ///
149 /// Structures
150 ///
151 
152 struct D2D1_SVG_LENGTH
153 {
154     float value;
155     D2D1_SVG_LENGTH_UNITS units;
156 }
157 
158 struct D2D1_SVG_PRESERVE_ASPECT_RATIO
159 {
160     bool defer;
161     D2D1_SVG_ASPECT_ALIGN _align;
162     D2D1_SVG_ASPECT_SCALING meetOrSlice;
163 }
164 
165 struct D2D1_SVG_VIEWBOX
166 {
167     FLOAT x;
168     FLOAT y;
169     FLOAT width;
170     FLOAT height;
171 
172 }
173 
174 ///
175 /// Interfaces
176 ///
177 
178 mixin(uuid!(ID2D1SvgAttribute, "c9cdb0dd-f8c9-4e70-b7c2-301c80292c5e"));
179 public interface ID2D1SvgAttribute : ID2D1Resource
180 {
181 extern(Windows):
182     HRESULT Clone(ID2D1SvgAttribute *attribute);
183     void GetElement(ID2D1SvgElement *element);
184 }
185 
186 mixin(uuid!(ID2D1SvgPaint, "d59bab0a-68a2-455b-a5dc-9eb2854e2490"));
187 public interface ID2D1SvgPaint : ID2D1SvgAttribute
188 {
189 extern(Windows):
190     void GetColor(D2D1_COLOR_F *color);
191     HRESULT GetId(wchar *id, uint idCount);
192     uint GetIdLength();
193     D2D1_SVG_PAINT_TYPE GetPaintType();
194     HRESULT SetColor(const D2D1_COLOR_F *color);
195     final HRESULT SetColor(const D2D1_COLOR_F color) {
196         return SetColor(&color);
197     }
198     HRESULT SetId(const wchar *id);
199     HRESULT SetPaintType(D2D1_SVG_PAINT_TYPE paintType);
200 }
201 
202 mixin(uuid!(ID2D1SvgStrokeDashArray, "f1c0ca52-92a3-4f00-b4ce-f35691efd9d9"));
203 public interface ID2D1SvgStrokeDashArray : ID2D1SvgAttribute
204 {
205 extern(Windows):
206     HRESULT GetDashes(float *dashes, uint dashesCount, uint startIndex = 0);
207     HRESULT GetDashes(D2D1_SVG_LENGTH *dashes, uint dashesCount, uint startIndex = 0);
208     uint GetDashesCount();
209     HRESULT RemoveDashesAtEnd(uint dashesCount);
210     HRESULT UpdateDashes(const float *dashes, uint dashesCount, uint startIndex = 0);
211     HRESULT UpdateDashes(const D2D1_SVG_LENGTH *dashes, uint dashesCount, uint startIndex = 0);
212 }
213 
214 mixin(uuid!(ID2D1SvgPointCollection, "9dbe4c0d-3572-4dd9-9825-5530813bb712"));
215 public interface ID2D1SvgPointCollection : ID2D1SvgAttribute
216 {
217 extern(Windows):
218     HRESULT GetPoints(D2D1_POINT_2F *points, uint pointsCount, uint startIndex = 0);
219     uint GetPointsCount();
220     HRESULT RemovePointsAtEnd(uint pointsCount);
221     HRESULT UpdatePoints(const D2D1_POINT_2F *points, uint pointsCount, uint startIndex = 0);
222 }
223 
224 mixin(uuid!(ID2D1SvgPathData, "c095e4f4-bb98-43d6-9745-4d1b84ec9888"));
225 public interface ID2D1SvgPathData : ID2D1SvgAttribute
226 {
227 extern(Windows):
228     HRESULT CreatePathGeometry(D2D1_FILL_MODE fillMode, ID2D1PathGeometry1 *pathGeometry);
229     HRESULT GetCommands(D2D1_SVG_PATH_COMMAND *commands, uint commandsCount, uint startIndex = 0);
230     uint GetCommandsCount();
231     HRESULT GetSegmentData(float *data, uint dataCount, uint startIndex = 0);
232     uint GetSegmentDataCount();
233     HRESULT RemoveCommandsAtEnd(uint commandsCount);
234     HRESULT RemoveSegmentDataAtEnd(uint dataCount);
235     HRESULT UpdateCommands(const D2D1_SVG_PATH_COMMAND *commands, uint commandsCount, uint startIndex = 0);
236     HRESULT UpdateSegmentData(const float *data, uint dataCount, uint startIndex = 0);
237 }
238 
239 mixin(uuid!(ID2D1SvgElement, "ac7b67a6-183e-49c1-a823-0ebe40b0db29"));
240 public interface ID2D1SvgElement : ID2D1Resource
241 {
242 extern(Windows):
243     HRESULT AppendChild(ID2D1SvgElement newChild);
244     HRESULT CreateChild(const wchar *tagName, ID2D1SvgElement *newChild);
245     HRESULT GetAttributeValueLength(const wchar *name, D2D1_SVG_ATTRIBUTE_STRING_TYPE type, uint *valueLength);
246     void GetDocument(ID2D1SvgDocument *document);
247     void GetFirstChild(ID2D1SvgElement *child);
248     void GetLastChild(ID2D1SvgElement *child);
249     HRESULT GetNextChild(ID2D1SvgElement referenceChild, ID2D1SvgElement *nextChild);
250     void GetParent(ID2D1SvgElement *parent);
251     HRESULT GetPreviousChild(ID2D1SvgElement referenceChild,ID2D1SvgElement *previousChild);
252     uint GetSpecifiedAttributeCount();
253     HRESULT GetSpecifiedAttributeName(uint index, wchar *name, uint nameCount, bool *inherited = null);
254     HRESULT GetSpecifiedAttributeNameLength(uint index, uint *nameLength, bool *inherited = null);
255     HRESULT GetTagName(wchar *name, uint nameCount);
256     uint GetTagNameLength();
257     HRESULT GetTextValue(wchar *name, uint nameCount);
258     uint GetTextValueLength();
259     bool HasChildren();
260     HRESULT InsertChildBefore(ID2D1SvgElement newChild, ID2D1SvgElement referenceChild = null);
261     bool IsAttributeSpecified(const wchar *name, bool *inherited = null);
262     bool IsTextContent();
263     HRESULT RemoveAttribute(const wchar *name);
264     HRESULT RemoveChild(ID2D1SvgElement oldChild);
265     HRESULT ReplaceChild(ID2D1SvgElement newChild, ID2D1SvgElement oldChild);
266     HRESULT SetTextValue(const wchar *name, uint nameCount);
267 
268     HRESULT SetAttributeValue(const wchar* name, D2D1_SVG_ATTRIBUTE_STRING_TYPE type, const wchar* value);
269     HRESULT GetAttributeValue(const wchar* name, D2D1_SVG_ATTRIBUTE_STRING_TYPE type, wchar* value, uint valueCount);
270     HRESULT GetAttributeValueLength(const wchar* name, D2D1_SVG_ATTRIBUTE_STRING_TYPE type, uint *valueLength);
271     HRESULT SetAttributeValue(const wchar* name, D2D1_SVG_ATTRIBUTE_POD_TYPE type, const void *value, uint valueSizeInBytes);    
272     HRESULT GetAttributeValue(const wchar* name, D2D1_SVG_ATTRIBUTE_POD_TYPE type, void *value, uint valueSizeInBytes);
273     HRESULT SetAttributeValue(const wchar* name, ID2D1SvgAttribute value );
274     HRESULT GetAttributeValue(const wchar* name, REFIID riid, void **value);
275 
276     final HRESULT SetAttributeValue(const wchar *name, float value) {
277         return SetAttributeValue(name, D2D1_SVG_ATTRIBUTE_POD_TYPE.FLOAT, &value, value.sizeof);
278     }
279     final HRESULT GetAttributeValue(const wchar *name, float value) {
280         return GetAttributeValue(name, D2D1_SVG_ATTRIBUTE_POD_TYPE.FLOAT, cast(void*)value, cast(uint)value.sizeof);
281     }
282 
283     final HRESULT SetAttributeValue(const wchar *name, const D2D1_COLOR_F value) {
284         return SetAttributeValue(name, D2D1_SVG_ATTRIBUTE_POD_TYPE.COLOR, &value, value.sizeof);
285     }    
286     final HRESULT GetAttributeValue(const wchar *name, D2D1_COLOR_F *value) {
287         return GetAttributeValue(name, D2D1_SVG_ATTRIBUTE_POD_TYPE.COLOR, value, (*value).sizeof);
288     }
289 
290     final HRESULT SetAttributeValue(const wchar *name, D2D1_FILL_MODE value ) {
291         return SetAttributeValue(name, D2D1_SVG_ATTRIBUTE_POD_TYPE.FILL_MODE, &value, value.sizeof);
292     }    
293     final HRESULT GetAttributeValue(const wchar *name, D2D1_FILL_MODE *value) {
294         return GetAttributeValue(name, D2D1_SVG_ATTRIBUTE_POD_TYPE.FILL_MODE, value, (*value).sizeof);
295     }
296     
297     final HRESULT SetAttributeValue(const wchar *name, D2D1_SVG_DISPLAY value) {
298         return SetAttributeValue(name, D2D1_SVG_ATTRIBUTE_POD_TYPE.DISPLAY, &value, value.sizeof);
299     }
300     final HRESULT GetAttributeValue(const wchar *name, D2D1_SVG_DISPLAY *value ) {
301         return GetAttributeValue(name, D2D1_SVG_ATTRIBUTE_POD_TYPE.DISPLAY, value, (*value).sizeof);
302     }
303     
304     final HRESULT SetAttributeValue(const wchar *name, D2D1_SVG_OVERFLOW value) {
305         return SetAttributeValue(name, D2D1_SVG_ATTRIBUTE_POD_TYPE.OVERFLOW, &value, value.sizeof);
306     }
307     final HRESULT GetAttributeValue(const wchar *name, D2D1_SVG_OVERFLOW *value) {
308         return GetAttributeValue(name, D2D1_SVG_ATTRIBUTE_POD_TYPE.OVERFLOW, value, (*value).sizeof);
309     }
310 
311     final HRESULT SetAttributeValue(const wchar *name, D2D1_SVG_LINE_JOIN value) {
312         return SetAttributeValue(name, D2D1_SVG_ATTRIBUTE_POD_TYPE.LINE_JOIN, &value, value.sizeof);
313     }
314     final HRESULT GetAttributeValue(const wchar *name, D2D1_SVG_LINE_JOIN *value) {
315         return GetAttributeValue(name, D2D1_SVG_ATTRIBUTE_POD_TYPE.LINE_JOIN, value, (*value).sizeof);
316     }
317     
318     final HRESULT SetAttributeValue(const wchar *name, D2D1_SVG_LINE_CAP value) {
319        return SetAttributeValue(name, D2D1_SVG_ATTRIBUTE_POD_TYPE.LINE_CAP, &value, value.sizeof);
320     }
321     final HRESULT GetAttributeValue(const wchar *name, D2D1_SVG_LINE_CAP *value) {
322         return GetAttributeValue(name, D2D1_SVG_ATTRIBUTE_POD_TYPE.LINE_CAP, value, (*value).sizeof);
323     }
324     
325     final HRESULT SetAttributeValue(const wchar *name, D2D1_SVG_VISIBILITY value ) {
326         return SetAttributeValue(name, D2D1_SVG_ATTRIBUTE_POD_TYPE.VISIBILITY, &value, value.sizeof);
327     }
328     final HRESULT GetAttributeValue(const wchar *name, D2D1_SVG_VISIBILITY *value) {
329         return GetAttributeValue(name, D2D1_SVG_ATTRIBUTE_POD_TYPE.VISIBILITY, value, (*value).sizeof);
330     }
331     
332     final HRESULT SetAttributeValue(const wchar *name, const D2D1_MATRIX_3X2_F value) {
333         return SetAttributeValue(name, D2D1_SVG_ATTRIBUTE_POD_TYPE.MATRIX, &value, value.sizeof);
334     }
335     final HRESULT GetAttributeValue(const wchar *name, D2D1_MATRIX_3X2_F *value) {
336         return GetAttributeValue(name, D2D1_SVG_ATTRIBUTE_POD_TYPE.MATRIX, value, (*value).sizeof);
337     }
338     
339     final HRESULT SetAttributeValue(const wchar *name, D2D1_SVG_UNIT_TYPE value ) {
340         return SetAttributeValue(name, D2D1_SVG_ATTRIBUTE_POD_TYPE.UNIT_TYPE, &value, value.sizeof);
341     }
342     final HRESULT GetAttributeValue(const wchar *name, D2D1_SVG_UNIT_TYPE *value) {
343         return GetAttributeValue(name, D2D1_SVG_ATTRIBUTE_POD_TYPE.UNIT_TYPE, value, (*value).sizeof);
344     }
345     
346     final HRESULT SetAttributeValue(const wchar *name, D2D1_EXTEND_MODE value) {
347         return SetAttributeValue(name, D2D1_SVG_ATTRIBUTE_POD_TYPE.EXTEND_MODE, &value, value.sizeof);
348     }    
349     final HRESULT GetAttributeValue(const wchar *name, D2D1_EXTEND_MODE *value) {
350         return GetAttributeValue(name, D2D1_SVG_ATTRIBUTE_POD_TYPE.EXTEND_MODE, value, (*value).sizeof);
351     }
352     
353     final HRESULT SetAttributeValue(const wchar *name, const D2D1_SVG_PRESERVE_ASPECT_RATIO value) {
354         return SetAttributeValue(name, D2D1_SVG_ATTRIBUTE_POD_TYPE.PRESERVE_ASPECT_RATIO, &value, value.sizeof);
355     }
356     final HRESULT GetAttributeValue(const wchar *name, D2D1_SVG_PRESERVE_ASPECT_RATIO *value) {
357         return GetAttributeValue(name, D2D1_SVG_ATTRIBUTE_POD_TYPE.PRESERVE_ASPECT_RATIO, value, (*value).sizeof);
358     }
359     
360     final HRESULT SetAttributeValue(const wchar *name, const D2D1_SVG_LENGTH value) {
361         return SetAttributeValue(name, D2D1_SVG_ATTRIBUTE_POD_TYPE.LENGTH, &value, value.sizeof);
362     }
363     final HRESULT GetAttributeValue(const wchar *name, D2D1_SVG_LENGTH *value) {
364         return GetAttributeValue(name, D2D1_SVG_ATTRIBUTE_POD_TYPE.LENGTH, value, (*value).sizeof);
365     }
366     
367     final HRESULT GetAttributeValue(const wchar *name, ID2D1SvgAttribute *value) {
368         return GetAttributeValue(name, &IID_ID2D1SvgAttribute, cast(void **)(value));
369     }
370     final HRESULT GetAttributeValue(const wchar *name, ID2D1SvgPaint *value) {
371         return GetAttributeValue(name, &IID_ID2D1SvgPaint, cast(void **)(value));
372     }
373     final HRESULT GetAttributeValue(const wchar *name, ID2D1SvgStrokeDashArray *value) {
374         return GetAttributeValue(name, &IID_ID2D1SvgStrokeDashArray, cast(void **)(value));
375     }
376     final HRESULT GetAttributeValue(const wchar *name,ID2D1SvgPointCollection *value) {
377         return GetAttributeValue(name, &IID_ID2D1SvgPointCollection, cast(void **)(value));
378     }
379     final HRESULT GetAttributeValue(const wchar *name, ID2D1SvgPathData *value) {
380         return GetAttributeValue(name, &IID_ID2D1SvgPathData, cast(void **)(value));
381     }
382 }
383 
384 mixin(uuid!(ID2D1SvgDocument, "86b88e4d-afa4-4d7b-88e4-68a51c4a0aec"));
385 public interface ID2D1SvgDocument : ID2D1Resource
386 {
387 extern(Windows):
388     HRESULT CreatePaint(D2D1_SVG_PAINT_TYPE paintType, const D2D1_COLOR_F *color, const wchar *id, ID2D1SvgPaint *paint);
389     final HRESULT CreatePaint(D2D1_SVG_PAINT_TYPE paintType, const D2D1_COLOR_F color, const wchar *id, ID2D1SvgPaint *paint) {
390         return CreatePaint(paintType, &color, id, paint);
391     }
392     HRESULT CreatePathData(const float *segmentData, uint segmentDataCount, const D2D1_SVG_PATH_COMMAND *commands, uint commandsCount, ID2D1SvgPathData *pathData);
393     HRESULT CreatePointCollection(const D2D1_POINT_2F *points, uint pointsCount, ID2D1SvgPointCollection *pointCollection);
394     HRESULT CreateStrokeDashArray(const D2D1_SVG_LENGTH *dashes, uint dashesCount, ID2D1SvgStrokeDashArray *strokeDashArray);
395     HRESULT Deserialize(IStream *inputXmlStream, ID2D1SvgElement *subtree);
396     HRESULT FindElementById(const wchar *id, ID2D1SvgElement *svgElement);
397     void GetRoot(ID2D1SvgElement *root);
398     D2D1_SIZE_F GetViewportSize();
399     HRESULT Serialize(IStream *outputXmlStream, ID2D1SvgElement subtree = null);
400     HRESULT SetRoot(ID2D1SvgElement root);
401     HRESULT SetViewportSize(D2D1_SIZE_F viewportSize);
402 }