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