1 module directx.d2d1_1;
2 //---------------------------------------------------------------------------
3 // Copyright (c) Microsoft Corporation.  All rights reserved.
4 //
5 // This file is automatically generated.  Please do not edit it directly.
6 //
7 // File name: D2D1_1.h
8 //---------------------------------------------------------------------------
9 
10 public import directx.com;
11 public import directx.d2d1;
12 public import directx.d2d1effects;
13 public import directx.dxgi;
14 public import directx.dwrite, directx.wincodec;
15 
16 import directx.d2d1effectauthor;
17 import core.sys.windows.objidl;
18 
19 /// <summary>
20 /// Function pointer to construct a new effect once registered.
21 /// </summary>
22 alias PD2D1_EFFECT_FACTORY = extern(Windows) HRESULT function(IUnknown* effectImpl);
23 enum D2D1_INVALID_PROPERTY_INDEX = uint.max;
24 alias D2D1_RECT_L = D2D_RECT_L;
25 alias D2D1_POINT_2L = D2D_POINT_2L;
26 
27 /// <summary>
28 /// This defines the valid property types that can be used in an effect property
29 /// interface.
30 /// </summary>
31 alias D2D1_PROPERTY_TYPE = uint;
32 enum : D2D1_PROPERTY_TYPE
33 {
34     D2D1_PROPERTY_TYPE_UNKNOWN = 0,
35     D2D1_PROPERTY_TYPE_STRING = 1,
36     D2D1_PROPERTY_TYPE_BOOL = 2,
37     D2D1_PROPERTY_TYPE_UINT32 = 3,
38     D2D1_PROPERTY_TYPE_INT32 = 4,
39     D2D1_PROPERTY_TYPE_FLOAT = 5,
40     D2D1_PROPERTY_TYPE_VECTOR2 = 6,
41     D2D1_PROPERTY_TYPE_VECTOR3 = 7,
42     D2D1_PROPERTY_TYPE_VECTOR4 = 8,
43     D2D1_PROPERTY_TYPE_BLOB = 9,
44     D2D1_PROPERTY_TYPE_IUNKNOWN = 10,
45     D2D1_PROPERTY_TYPE_ENUM = 11,
46     D2D1_PROPERTY_TYPE_ARRAY = 12,
47     D2D1_PROPERTY_TYPE_CLSID = 13,
48     D2D1_PROPERTY_TYPE_MATRIX_3X2 = 14,
49     D2D1_PROPERTY_TYPE_MATRIX_4X3 = 15,
50     D2D1_PROPERTY_TYPE_MATRIX_4X4 = 16,
51     D2D1_PROPERTY_TYPE_MATRIX_5X4 = 17,
52     D2D1_PROPERTY_TYPE_COLOR_CONTEXT = 18,
53     D2D1_PROPERTY_TYPE_FORCE_DWORD = 0xffffffff
54 
55 }
56 
57 
58 /// <summary>
59 /// This defines the list of system properties present on the root effect property
60 /// interface.
61 /// </summary>
62 alias D2D1_PROPERTY = uint;
63 enum : D2D1_PROPERTY
64 {
65     D2D1_PROPERTY_CLSID = 0x80000000,
66     D2D1_PROPERTY_DISPLAYNAME = 0x80000001,
67     D2D1_PROPERTY_AUTHOR = 0x80000002,
68     D2D1_PROPERTY_CATEGORY = 0x80000003,
69     D2D1_PROPERTY_DESCRIPTION = 0x80000004,
70     D2D1_PROPERTY_INPUTS = 0x80000005,
71     D2D1_PROPERTY_CACHED = 0x80000006,
72     D2D1_PROPERTY_PRECISION = 0x80000007,
73     D2D1_PROPERTY_MIN_INPUTS = 0x80000008,
74     D2D1_PROPERTY_MAX_INPUTS = 0x80000009
75 }
76 
77 
78 /// <summary>
79 /// This defines the indices of sub-properties that may be present on any parent
80 /// property.
81 /// </summary>
82 alias D2D1_SUBPROPERTY = uint;
83 enum : D2D1_SUBPROPERTY
84 {
85     D2D1_SUBPROPERTY_DISPLAYNAME = 0x80000000,
86     D2D1_SUBPROPERTY_ISREADONLY = 0x80000001,
87     D2D1_SUBPROPERTY_MIN = 0x80000002,
88     D2D1_SUBPROPERTY_MAX = 0x80000003,
89     D2D1_SUBPROPERTY_DEFAULT = 0x80000004,
90     D2D1_SUBPROPERTY_FIELDS = 0x80000005,
91     D2D1_SUBPROPERTY_INDEX = 0x80000006
92 }
93 
94 
95 /// <summary>
96 /// Specifies how the bitmap can be used.
97 /// </summary>
98 alias D2D1_BITMAP_OPTIONS = uint;
99 enum : D2D1_BITMAP_OPTIONS
100 {
101     
102     /// <summary>
103     /// The bitmap is created with default properties.
104     /// </summary>
105     D2D1_BITMAP_OPTIONS_NONE = 0x00000000,
106     
107     /// <summary>
108     /// The bitmap can be specified as a target in ID2D1DeviceContext::SetTarget
109     /// </summary>
110     D2D1_BITMAP_OPTIONS_TARGET = 0x00000001,
111     
112     /// <summary>
113     /// The bitmap cannot be used as an input to DrawBitmap, DrawImage, in a bitmap
114     /// brush or as an input to an effect.
115     /// </summary>
116     D2D1_BITMAP_OPTIONS_CANNOT_DRAW = 0x00000002,
117     
118     /// <summary>
119     /// The bitmap can be read from the CPU.
120     /// </summary>
121     D2D1_BITMAP_OPTIONS_CPU_READ = 0x00000004,
122     
123     /// <summary>
124     /// The bitmap works with the ID2D1GdiInteropRenderTarget::GetDC API.
125     /// </summary>
126     D2D1_BITMAP_OPTIONS_GDI_COMPATIBLE = 0x00000008
127 }
128 
129 
130 /// <summary>
131 /// Specifies the composite mode that will be applied.
132 /// </summary>
133 alias D2D1_COMPOSITE_MODE = uint;
134 enum : D2D1_COMPOSITE_MODE
135 {
136     D2D1_COMPOSITE_MODE_SOURCE_OVER = 0,
137     D2D1_COMPOSITE_MODE_DESTINATION_OVER = 1,
138     D2D1_COMPOSITE_MODE_SOURCE_IN = 2,
139     D2D1_COMPOSITE_MODE_DESTINATION_IN = 3,
140     D2D1_COMPOSITE_MODE_SOURCE_OUT = 4,
141     D2D1_COMPOSITE_MODE_DESTINATION_OUT = 5,
142     D2D1_COMPOSITE_MODE_SOURCE_ATOP = 6,
143     D2D1_COMPOSITE_MODE_DESTINATION_ATOP = 7,
144     D2D1_COMPOSITE_MODE_XOR = 8,
145     D2D1_COMPOSITE_MODE_PLUS = 9,
146     D2D1_COMPOSITE_MODE_SOURCE_COPY = 10,
147     D2D1_COMPOSITE_MODE_BOUNDED_SOURCE_COPY = 11,
148     D2D1_COMPOSITE_MODE_MASK_INVERT = 12
149 }
150 
151 
152 /// <summary>
153 /// This specifies the precision that should be used in buffers allocated by D2D.
154 /// </summary>
155 alias D2D1_BUFFER_PRECISION = uint;
156 enum : D2D1_BUFFER_PRECISION
157 {
158     D2D1_BUFFER_PRECISION_UNKNOWN = 0,
159     D2D1_BUFFER_PRECISION_8BPC_UNORM = 1,
160     D2D1_BUFFER_PRECISION_8BPC_UNORM_SRGB = 2,
161     D2D1_BUFFER_PRECISION_16BPC_UNORM = 3,
162     D2D1_BUFFER_PRECISION_16BPC_FLOAT = 4,
163     D2D1_BUFFER_PRECISION_32BPC_FLOAT = 5
164 }
165 
166 
167 /// <summary>
168 /// This describes how the individual mapping operation should be performed.
169 /// </summary>
170 alias D2D1_MAP_OPTIONS = uint;
171 enum : D2D1_MAP_OPTIONS
172 {
173     
174     /// <summary>
175     /// The mapped pointer has undefined behavior.
176     /// </summary>
177     D2D1_MAP_OPTIONS_NONE = 0,
178     
179     /// <summary>
180     /// The mapped pointer can be read from.
181     /// </summary>
182     D2D1_MAP_OPTIONS_READ = 1,
183     
184     /// <summary>
185     /// The mapped pointer can be written to.
186     /// </summary>
187     D2D1_MAP_OPTIONS_WRITE = 2,
188     
189     /// <summary>
190     /// The previous contents of the bitmap are discarded when it is mapped.
191     /// </summary>
192     D2D1_MAP_OPTIONS_DISCARD = 4
193 }
194 
195 
196 /// <summary>
197 /// This is used to specify the quality of image scaling with
198 /// ID2D1DeviceContext::DrawImage and with the 2D Affine Transform Effect.
199 /// </summary>
200 alias D2D1_INTERPOLATION_MODE = uint;
201 enum : D2D1_INTERPOLATION_MODE
202 {
203     D2D1_INTERPOLATION_MODE_NEAREST_NEIGHBOR = D2D1_INTERPOLATION_MODE_DEFINITION_NEAREST_NEIGHBOR,
204     D2D1_INTERPOLATION_MODE_LINEAR = D2D1_INTERPOLATION_MODE_DEFINITION_LINEAR,
205     D2D1_INTERPOLATION_MODE_CUBIC = D2D1_INTERPOLATION_MODE_DEFINITION_CUBIC,
206     D2D1_INTERPOLATION_MODE_MULTI_SAMPLE_LINEAR = D2D1_INTERPOLATION_MODE_DEFINITION_MULTI_SAMPLE_LINEAR,
207     D2D1_INTERPOLATION_MODE_ANISOTROPIC = D2D1_INTERPOLATION_MODE_DEFINITION_ANISOTROPIC,
208     D2D1_INTERPOLATION_MODE_HIGH_QUALITY_CUBIC = D2D1_INTERPOLATION_MODE_DEFINITION_HIGH_QUALITY_CUBIC
209 }
210 
211 
212 /// <summary>
213 /// This specifies what units should be accepted by the D2D API.
214 /// </summary>
215 alias D2D1_UNIT_MODE = uint;
216 enum : D2D1_UNIT_MODE
217 {
218     D2D1_UNIT_MODE_DIPS = 0,
219     D2D1_UNIT_MODE_PIXELS = 1
220 }
221 
222 
223 /// <summary>
224 /// Defines a color space.
225 /// </summary>
226 alias D2D1_COLOR_SPACE = uint;
227 enum : D2D1_COLOR_SPACE
228 {
229     
230     /// <summary>
231     /// The color space is described by accompanying data, such as a color profile.
232     /// </summary>
233     D2D1_COLOR_SPACE_CUSTOM = 0,
234     
235     /// <summary>
236     /// The sRGB color space.
237     /// </summary>
238     D2D1_COLOR_SPACE_SRGB = 1,
239     
240     /// <summary>
241     /// The scRGB color space.
242     /// </summary>
243     D2D1_COLOR_SPACE_SCRGB = 2
244 }
245 
246 
247 /// <summary>
248 /// This specifies options that apply to the device context for its lifetime.
249 /// </summary>
250 alias D2D1_DEVICE_CONTEXT_OPTIONS = uint;
251 enum : D2D1_DEVICE_CONTEXT_OPTIONS
252 {
253     D2D1_DEVICE_CONTEXT_OPTIONS_NONE = 0,
254     
255     /// <summary>
256     /// Geometry rendering will be performed on many threads in parallel, a single
257     /// thread is the default.
258     /// </summary>
259     D2D1_DEVICE_CONTEXT_OPTIONS_ENABLE_MULTITHREADED_OPTIMIZATIONS = 1
260 }
261 
262 
263 /// <summary>
264 /// Defines how the world transform, dots per inch (dpi), and stroke width affect
265 /// the shape of the pen used to stroke a primitive.
266 /// </summary>
267 alias D2D1_STROKE_TRANSFORM_TYPE = uint;
268 enum : D2D1_STROKE_TRANSFORM_TYPE
269 {
270     
271     /// <summary>
272     /// The stroke respects the world transform, the DPI, and the stroke width.
273     /// </summary>
274     D2D1_STROKE_TRANSFORM_TYPE_NORMAL = 0,
275     
276     /// <summary>
277     /// The stroke does not respect the world transform, but it does respect the DPI and
278     /// the stroke width.
279     /// </summary>
280     D2D1_STROKE_TRANSFORM_TYPE_FIXED = 1,
281     
282     /// <summary>
283     /// The stroke is forced to one pixel wide.
284     /// </summary>
285     D2D1_STROKE_TRANSFORM_TYPE_HAIRLINE = 2
286 }
287 
288 
289 /// <summary>
290 /// A blend mode that applies to all primitives drawn on the context.
291 /// </summary>
292 alias D2D1_PRIMITIVE_BLEND = uint;
293 enum : D2D1_PRIMITIVE_BLEND
294 {
295     D2D1_PRIMITIVE_BLEND_SOURCE_OVER = 0,
296     D2D1_PRIMITIVE_BLEND_COPY = 1,
297     D2D1_PRIMITIVE_BLEND_MIN = 2,
298     D2D1_PRIMITIVE_BLEND_ADD = 3,
299     D2D1_PRIMITIVE_BLEND_MAX = 4
300 }
301 
302 
303 /// <summary>
304 /// This specifies the threading mode used while simultaneously creating the device,
305 /// factory, and device context.
306 /// </summary>
307 alias D2D1_THREADING_MODE = uint;
308 enum : D2D1_THREADING_MODE
309 {
310     
311     /// <summary>
312     /// Resources may only be invoked serially.  Reference counts on resources are
313     /// interlocked, however, resource and render target state is not protected from
314     /// multi-threaded access
315     /// </summary>
316     D2D1_THREADING_MODE_SINGLE_THREADED = D2D1_FACTORY_TYPE_SINGLE_THREADED,
317     
318     /// <summary>
319     /// Resources may be invoked from multiple threads. Resources use interlocked
320     /// reference counting and their state is protected.
321     /// </summary>
322     D2D1_THREADING_MODE_MULTI_THREADED = D2D1_FACTORY_TYPE_MULTI_THREADED
323 }
324 
325 
326 /// <summary>
327 /// This specifies how colors are interpolated.
328 /// </summary>
329 alias D2D1_COLOR_INTERPOLATION_MODE = uint;
330 enum : D2D1_COLOR_INTERPOLATION_MODE
331 {
332     
333     /// <summary>
334     /// Colors will be interpolated in straight alpha space.
335     /// </summary>
336     D2D1_COLOR_INTERPOLATION_MODE_STRAIGHT = 0,
337     
338     /// <summary>
339     /// Colors will be interpolated in premultiplied alpha space.
340     /// </summary>
341     D2D1_COLOR_INTERPOLATION_MODE_PREMULTIPLIED = 1
342 }
343 
344 alias D2D1_VECTOR_2F = D2D_VECTOR_2F;
345 alias D2D1_VECTOR_3F = D2D_VECTOR_3F;
346 alias D2D1_VECTOR_4F = D2D_VECTOR_4F;
347 
348 /// <summary>
349 /// Extended bitmap properties.
350 /// </summary>
351 struct D2D1_BITMAP_PROPERTIES1
352 {
353     D2D1_PIXEL_FORMAT pixelFormat;
354     FLOAT dpiX;
355     FLOAT dpiY;
356     
357     /// <summary>
358     /// Specifies how the bitmap can be used.
359     /// </summary>
360     D2D1_BITMAP_OPTIONS bitmapOptions;
361     ID2D1ColorContext colorContext;
362 }
363 
364 
365 /// <summary>
366 /// Describes mapped memory from the ID2D1Bitmap1::Map API.
367 /// </summary>
368 struct D2D1_MAPPED_RECT
369 {
370     UINT32 pitch;
371     BYTE* bits;
372 }
373 
374 
375 /// <summary>
376 /// This controls advanced settings of the Direct2D imaging pipeline.
377 /// </summary>
378 struct D2D1_RENDERING_CONTROLS
379 {
380     /// <summary>
381     /// The default buffer precision, used if the precision isn't otherwise specified.
382     /// </summary>
383     D2D1_BUFFER_PRECISION bufferPrecision;
384     
385     /// <summary>
386     /// The size of allocated tiles used to render imaging effects.
387     /// </summary>
388     D2D1_SIZE_U tileSize;
389 }
390 
391 
392 /// <summary>
393 /// This identifies a certain input connection of a certain effect.
394 /// </summary>
395 struct D2D1_EFFECT_INPUT_DESCRIPTION
396 {
397     /// <summary>
398     /// The effect whose input connection is being specified.
399     /// </summary>
400     ID2D1Effect effect;
401     
402     /// <summary>
403     /// The index of the input connection into the specified effect.
404     /// </summary>
405     UINT32 inputIndex;
406     
407     /// <summary>
408     /// The rectangle which would be available on the specified input connection during
409     /// render operations.
410     /// </summary>
411     D2D1_RECT_F inputRectangle;
412 }
413 
414 alias D2D1_MATRIX_4X3_F = D2D_MATRIX_4X3_F;
415 alias D2D1_MATRIX_4X4_F = D2D_MATRIX_4X4_F;
416 alias D2D1_MATRIX_5X4_F = D2D_MATRIX_5X4_F;
417 
418 /// <summary>
419 /// Describes a point along a path.
420 /// </summary>
421 struct D2D1_POINT_DESCRIPTION
422 {
423     D2D1_POINT_2F point;
424     D2D1_POINT_2F unitTangentVector;
425     UINT32 endSegment;
426     UINT32 endFigure;
427     FLOAT lengthToEndSegment;
428 }
429 
430 
431 /// <summary>
432 /// Creation properties for an image brush.
433 /// </summary>
434 struct D2D1_IMAGE_BRUSH_PROPERTIES
435 {
436     D2D1_RECT_F sourceRectangle;
437     D2D1_EXTEND_MODE extendModeX;
438     D2D1_EXTEND_MODE extendModeY;
439     D2D1_INTERPOLATION_MODE interpolationMode;
440 }
441 
442 
443 /// <summary>
444 /// Describes the extend modes and the interpolation mode of an ID2D1BitmapBrush.
445 /// </summary>
446 struct D2D1_BITMAP_BRUSH_PROPERTIES1
447 {
448     D2D1_EXTEND_MODE extendModeX;
449     D2D1_EXTEND_MODE extendModeY;
450     D2D1_INTERPOLATION_MODE interpolationMode;
451 }
452 
453 
454 /// <summary>
455 /// This defines how geometries should be drawn and widened.
456 /// </summary>
457 struct D2D1_STROKE_STYLE_PROPERTIES1
458 {
459     D2D1_CAP_STYLE startCap;
460     D2D1_CAP_STYLE endCap;
461     D2D1_CAP_STYLE dashCap;
462     D2D1_LINE_JOIN lineJoin;
463     FLOAT miterLimit;
464     D2D1_DASH_STYLE dashStyle;
465     FLOAT dashOffset;
466     
467     /// <summary>
468     /// How the nib of the stroke is influenced by the context properties.
469     /// </summary>
470     D2D1_STROKE_TRANSFORM_TYPE transformType;
471 }
472 
473 
474 /// <summary>
475 /// Specifies how the layer contents should be prepared.
476 /// </summary>
477 alias D2D1_LAYER_OPTIONS1 = uint;
478 enum : D2D1_LAYER_OPTIONS1
479 {
480     D2D1_LAYER_OPTIONS1_NONE = 0,
481     D2D1_LAYER_OPTIONS1_INITIALIZE_FROM_BACKGROUND = 1,
482     D2D1_LAYER_OPTIONS1_IGNORE_ALPHA = 2
483 }
484 
485 
486 /// <summary>
487 /// All parameters related to pushing a layer.
488 /// </summary>
489 struct D2D1_LAYER_PARAMETERS1
490 {
491     D2D1_RECT_F contentBounds;
492     ID2D1Geometry geometricMask;
493     D2D1_ANTIALIAS_MODE maskAntialiasMode;
494     D2D1_MATRIX_3X2_F maskTransform;
495     FLOAT opacity;
496     ID2D1Brush opacityBrush;
497     D2D1_LAYER_OPTIONS1 layerOptions;
498 }
499 
500 
501 /// <summary>
502 /// Defines when font resources should be subset during printing.
503 /// </summary>
504 alias D2D1_PRINT_FONT_SUBSET_MODE = uint;
505 enum : D2D1_PRINT_FONT_SUBSET_MODE
506 {
507     
508     /// <summary>
509     /// Subset for used glyphs, send and discard font resource after every five pages
510     /// </summary>
511     D2D1_PRINT_FONT_SUBSET_MODE_DEFAULT = 0,
512     
513     /// <summary>
514     /// Subset for used glyphs, send and discard font resource after each page
515     /// </summary>
516     D2D1_PRINT_FONT_SUBSET_MODE_EACHPAGE = 1,
517     
518     /// <summary>
519     /// Do not subset, reuse font for all pages, send it after first page
520     /// </summary>
521     D2D1_PRINT_FONT_SUBSET_MODE_NONE = 2
522 }
523 
524 
525 /// <summary>
526 /// This describes the drawing state.
527 /// </summary>
528 struct D2D1_DRAWING_STATE_DESCRIPTION1
529 {
530     D2D1_ANTIALIAS_MODE antialiasMode;
531     D2D1_TEXT_ANTIALIAS_MODE textAntialiasMode;
532     D2D1_TAG tag1;
533     D2D1_TAG tag2;
534     D2D1_MATRIX_3X2_F transform;
535     D2D1_PRIMITIVE_BLEND primitiveBlend;
536     D2D1_UNIT_MODE unitMode;
537 }
538 
539 
540 /// <summary>
541 /// The creation properties for a ID2D1PrintControl object.
542 /// </summary>
543 struct D2D1_PRINT_CONTROL_PROPERTIES
544 {
545     D2D1_PRINT_FONT_SUBSET_MODE fontSubset;
546     
547     /// <summary>
548     /// DPI for rasterization of all unsupported D2D commands or options, defaults to
549     /// 150.0
550     /// </summary>
551     FLOAT rasterDPI;
552     
553     /// <summary>
554     /// Color space for vector graphics in XPS package
555     /// </summary>
556     D2D1_COLOR_SPACE colorSpace;
557 }
558 
559 
560 /// <summary>
561 /// This specifies the options while simultaneously creating the device, factory,
562 /// and device context.
563 /// </summary>
564 struct D2D1_CREATION_PROPERTIES
565 {
566     
567     /// <summary>
568     /// Describes locking behavior of D2D resources
569     /// </summary>
570     D2D1_THREADING_MODE threadingMode;
571     D2D1_DEBUG_LEVEL debugLevel;
572     D2D1_DEVICE_CONTEXT_OPTIONS options;
573 }
574 
575 mixin(uuid!(ID2D1GdiMetafileSink, "82237326-8111-4f7c-bcf4-b5c1175564fe"));
576 /// <summary>
577 /// User-implementable interface for introspecting on a metafile.
578 /// </summary>
579 interface ID2D1GdiMetafileSink : IUnknown
580 {
581 	extern(Windows):
582     /// <summary>
583     /// Callback for examining a metafile record.
584     /// </summary>
585     HRESULT ProcessRecord(
586         DWORD recordType,
587         const(void)* recordData,
588         DWORD recordDataSize 
589         );
590 } // interface ID2D1GdiMetafileSink
591 
592 
593 mixin(uuid!(ID2D1GdiMetafile, "2f543dc3-cfc1-4211-864f-cfd91c6f3395"));
594 /// <summary>
595 /// Interface encapsulating a GDI/GDI+ metafile.
596 /// </summary>
597 interface ID2D1GdiMetafile : ID2D1Resource
598 {
599 	extern(Windows):
600     /// <summary>
601     /// Play the metafile into a caller-supplied sink interface.
602     /// </summary>
603     HRESULT Stream(ID2D1GdiMetafileSink sink);
604     
605     /// <summary>
606     /// Gets the bounds of the metafile.
607     /// </summary>
608     HRESULT GetBounds(D2D1_RECT_F* bounds);
609 } // interface ID2D1GdiMetafile
610 
611 
612 mixin(uuid!(ID2D1CommandSink, "54d7898a-a061-40a7-bec7-e465bcba2c4f"));
613 /// <summary>
614 /// Caller-supplied implementation of an interface to receive the recorded command
615 /// list.
616 /// </summary>
617 interface ID2D1CommandSink : IUnknown
618 {
619 	extern(Windows):
620     HRESULT BeginDraw();
621     HRESULT EndDraw();
622     HRESULT SetAntialiasMode(D2D1_ANTIALIAS_MODE antialiasMode);
623     HRESULT SetTags(D2D1_TAG tag1, D2D1_TAG tag2);
624     HRESULT SetTextAntialiasMode(D2D1_TEXT_ANTIALIAS_MODE textAntialiasMode);
625     HRESULT SetTextRenderingParams(IDWriteRenderingParams textRenderingParams);
626     HRESULT SetTransform(const(D2D1_MATRIX_3X2_F)* transform);
627     HRESULT SetPrimitiveBlend(D2D1_PRIMITIVE_BLEND primitiveBlend);
628     HRESULT SetUnitMode(D2D1_UNIT_MODE unitMode);
629     HRESULT Clear(const(D2D1_COLOR_F)* color);
630     HRESULT DrawGlyphRun(
631         D2D1_POINT_2F baselineOrigin,
632         const(DWRITE_GLYPH_RUN)* glyphRun,
633         const(DWRITE_GLYPH_RUN_DESCRIPTION)* glyphRunDescription,
634         ID2D1Brush foregroundBrush,
635         DWRITE_MEASURING_MODE measuringMode 
636         );
637     HRESULT DrawLine(
638         D2D1_POINT_2F point0,
639         D2D1_POINT_2F point1,
640         ID2D1Brush brush,
641         FLOAT strokeWidth,
642         ID2D1StrokeStyle strokeStyle 
643         );
644     HRESULT DrawGeometry(
645         ID2D1Geometry geometry,
646         ID2D1Brush brush,
647         FLOAT strokeWidth,
648         ID2D1StrokeStyle strokeStyle 
649         );
650     HRESULT DrawRectangle(
651         const(D2D1_RECT_F)* rect,
652         ID2D1Brush brush,
653         FLOAT strokeWidth,
654         ID2D1StrokeStyle strokeStyle 
655         );
656     HRESULT DrawBitmap(
657         ID2D1Bitmap bitmap,
658         const(D2D1_RECT_F)* destinationRectangle,
659         FLOAT opacity,
660         D2D1_INTERPOLATION_MODE interpolationMode,
661         const(D2D1_RECT_F)* sourceRectangle,
662         const(D2D1_MATRIX_4X4_F)* perspectiveTransform 
663         );
664     HRESULT DrawImage(
665         ID2D1Image image,
666         const(D2D1_POINT_2F)* targetOffset,
667         const(D2D1_RECT_F)* imageRectangle,
668         D2D1_INTERPOLATION_MODE interpolationMode,
669         D2D1_COMPOSITE_MODE compositeMode 
670         );
671     HRESULT DrawGdiMetafile(
672         ID2D1GdiMetafile gdiMetafile,
673         const(D2D1_POINT_2F)* targetOffset 
674         );
675     HRESULT FillMesh(
676         ID2D1Mesh mesh,
677         ID2D1Brush brush 
678         );
679     HRESULT FillOpacityMask(
680         ID2D1Bitmap opacityMask,
681         ID2D1Brush brush,
682         const(D2D1_RECT_F)* destinationRectangle,
683         const(D2D1_RECT_F)* sourceRectangle 
684         );
685     HRESULT FillGeometry(
686         ID2D1Geometry geometry,
687         ID2D1Brush brush,
688         ID2D1Brush opacityBrush 
689         );
690     HRESULT FillRectangle(
691         const(D2D1_RECT_F)* rect,
692         ID2D1Brush brush 
693         );
694     HRESULT PushAxisAlignedClip(
695         const(D2D1_RECT_F)* clipRect,
696         D2D1_ANTIALIAS_MODE antialiasMode 
697         );
698     HRESULT PushLayer(
699         const(D2D1_LAYER_PARAMETERS1)* layerParameters1,
700         ID2D1Layer layer 
701         );
702     HRESULT PopAxisAlignedClip();
703     HRESULT PopLayer();
704 } // interface ID2D1CommandSink
705 
706 
707 mixin(uuid!(ID2D1CommandList, "b4f34a19-2383-4d76-94f6-ec343657c3dc"));
708 /// <summary>
709 /// The commandList interface.
710 /// </summary>
711 interface ID2D1CommandList : ID2D1Image
712 {
713 	extern(Windows):
714     /// <summary>
715     /// Play the command list into a caller-supplied sink interface.
716     /// </summary>
717     HRESULT Stream(ID2D1CommandSink sink);
718     
719     /// <summary>
720     /// Marks the command list as ready for use.
721     /// </summary>
722     HRESULT Close();
723 } // interface ID2D1CommandList
724 
725 mixin(uuid!(ID2D1PrintControl, "2c1d867d-c290-41c8-ae7e-34a98702e9a5"));
726 /// <summary>
727 /// Converts Direct2D primitives stored in an ID2D1CommandList into a fixed page
728 /// representation. The print sub-system then consumes the primitives.
729 /// </summary>
730 interface ID2D1PrintControl : IUnknown
731 {
732 	extern(Windows):
733     HRESULT AddPage(
734         ID2D1CommandList commandList,
735         D2D_SIZE_F pageSize,
736         IStream pagePrintTicketStream,
737         D2D1_TAG* tag1 = null,
738         D2D1_TAG* tag2 = null 
739         );
740     
741     HRESULT Close();
742 } // interface ID2D1PrintControl
743 
744 
745 mixin(uuid!(ID2D1ImageBrush, "fe9e984d-3f95-407c-b5db-cb94d4e8f87c"));
746 /// <summary>
747 /// Provides a brush that can take any effect, command list or bitmap and use it to
748 /// fill a 2D shape.
749 /// </summary>
750 interface ID2D1ImageBrush : ID2D1Brush
751 {
752 	extern(Windows):
753     void SetImage(ID2D1Image image);
754     void SetExtendModeX(D2D1_EXTEND_MODE extendModeX);
755     void SetExtendModeY(D2D1_EXTEND_MODE extendModeY);
756     void SetInterpolationMode(D2D1_INTERPOLATION_MODE interpolationMode);
757     void SetSourceRectangle(const(D2D1_RECT_F)* sourceRectangle);
758     void GetImage(ID2D1Image **image) const;
759     D2D1_EXTEND_MODE GetExtendModeX() const;
760     D2D1_EXTEND_MODE GetExtendModeY() const;
761     D2D1_INTERPOLATION_MODE GetInterpolationMode() const;
762     void GetSourceRectangle(D2D1_RECT_F* sourceRectangle) const;
763 } // interface ID2D1ImageBrush
764 
765 
766 mixin(uuid!(ID2D1BitmapBrush1, "41343a53-e41a-49a2-91cd-21793bbb62e5"));
767 /// <summary>
768 /// A bitmap brush allows a bitmap to be used to fill a geometry.  Interpolation
769 /// mode is specified with D2D1_INTERPOLATION_MODE
770 /// </summary>
771 interface ID2D1BitmapBrush1 : ID2D1BitmapBrush
772 {
773 	extern(Windows):
774     /// <summary>
775     /// Sets the interpolation mode used when this brush is used.
776     /// </summary>
777     void SetInterpolationMode1(D2D1_INTERPOLATION_MODE interpolationMode);
778     
779     D2D1_INTERPOLATION_MODE GetInterpolationMode1() const;
780 } // interface ID2D1BitmapBrush1
781 
782 
783 mixin(uuid!(ID2D1StrokeStyle1, "10a72a66-e91c-43f4-993f-ddf4b82b0b4a"));
784 /// <summary>
785 /// Extends a stroke style to allow nominal width strokes.
786 /// </summary>
787 interface ID2D1StrokeStyle1 : ID2D1StrokeStyle
788 {
789 	extern(Windows):
790     D2D1_STROKE_TRANSFORM_TYPE GetStrokeTransformType() const;
791 } // interface ID2D1StrokeStyle1
792 
793 
794 mixin(uuid!(ID2D1PathGeometry1, "62baa2d2-ab54-41b7-b872-787e0106a421"));
795 /// <summary>
796 /// The ID2D1PathGeometry1 interface adds functionality to ID2D1PathGeometry. In
797 /// particular, it provides the path geometry-specific
798 /// ComputePointAndSegmentAtLength method.
799 /// </summary>
800 interface ID2D1PathGeometry1 : ID2D1PathGeometry
801 {
802 	extern(Windows):
803     HRESULT ComputePointAndSegmentAtLength(
804         FLOAT length,
805         UINT32 startSegment,
806         const(D2D1_MATRIX_3X2_F)* worldTransform,
807         FLOAT flatteningTolerance,
808         D2D1_POINT_DESCRIPTION* pointDescription 
809         ) const;
810     
811     final
812     HRESULT
813     ComputePointAndSegmentAtLength(
814         FLOAT length,
815         UINT32 startSegment,
816         const D2D1_MATRIX_3X2_F worldTransform,
817         FLOAT flatteningTolerance,
818         D2D1_POINT_DESCRIPTION pointDescription 
819         ) const  
820     {
821         return ComputePointAndSegmentAtLength(length, startSegment, &worldTransform, flatteningTolerance, &pointDescription);
822     }
823     
824     final
825     HRESULT
826     ComputePointAndSegmentAtLength(
827         FLOAT length,
828         UINT32 startSegment,
829         const(D2D1_MATRIX_3X2_F)* worldTransform,
830         D2D1_POINT_DESCRIPTION* pointDescription 
831         ) const  
832     {
833         return ComputePointAndSegmentAtLength(length, startSegment, worldTransform, D2D1_DEFAULT_FLATTENING_TOLERANCE, pointDescription);
834     }
835     
836     final
837     HRESULT
838     ComputePointAndSegmentAtLength(
839         FLOAT length,
840         UINT32 startSegment,
841         const(D2D1_MATRIX_3X2_F) worldTransform,
842         D2D1_POINT_DESCRIPTION* pointDescription 
843         ) const  
844     {
845         return ComputePointAndSegmentAtLength(length, startSegment, &worldTransform, D2D1_DEFAULT_FLATTENING_TOLERANCE, pointDescription);
846     }
847 } // interface ID2D1PathGeometry1
848 
849 
850 mixin(uuid!(ID2D1Properties, "483473d7-cd46-4f9d-9d3a-3112aa80159d"));
851 /// <summary>
852 /// Represents a set of run-time bindable and discoverable properties that allow a
853 /// data-driven application to modify the state of a Direct2D effect.
854 /// </summary>
855 interface ID2D1Properties : IUnknown
856 {
857 	extern(Windows):
858     /// <summary>
859     /// Returns the total number of custom properties in this interface.
860     /// </summary>
861     UINT32 GetPropertyCount() const;
862     
863     /// <summary>
864     /// Retrieves the property name from the given property index.
865     /// </summary>
866     HRESULT GetPropertyName(
867         UINT32 index,
868         PWSTR name,
869         UINT32 nameCount 
870         ) const;
871     
872     /// <summary>
873     /// Returns the length of the property name from the given index.
874     /// </summary>
875     UINT32 GetPropertyNameLength(UINT32 index) const;
876     
877     /// <summary>
878     /// Retrieves the type of the given property.
879     /// </summary>
880     D2D1_PROPERTY_TYPE GetType(UINT32 index) const;
881     
882     /// <summary>
883     /// Retrieves the property index for the given property name.
884     /// </summary>
885     UINT32 GetPropertyIndex(PCWSTR name) const;
886     
887     /// <summary>
888     /// Sets the value of the given property using its name.
889     /// </summary>
890     HRESULT SetValueByName(
891         PCWSTR name,
892         D2D1_PROPERTY_TYPE type,
893         const(BYTE)* data,
894         UINT32 dataSize 
895         );
896     
897     /// <summary>
898     /// Sets the given value using the property index.
899     /// </summary>
900     HRESULT SetValue(
901         UINT32 index,
902         D2D1_PROPERTY_TYPE type,
903         const(BYTE)* data,
904         UINT32 dataSize 
905         );
906     
907     /// <summary>
908     /// Retrieves the given property or sub-property by name. '.' is the delimiter for
909     /// sub-properties.
910     /// </summary>
911     HRESULT GetValueByName(
912         PCWSTR name,
913         D2D1_PROPERTY_TYPE type,
914         BYTE* data,
915         UINT32 dataSize 
916         ) const;
917     
918     /// <summary>
919     /// Retrieves the given value by index.
920     /// </summary>
921     HRESULT GetValue(
922         UINT32 index,
923         D2D1_PROPERTY_TYPE type,
924         BYTE* data,
925         UINT32 dataSize 
926         ) const;
927     
928     /// <summary>
929     /// Returns the value size for the given property index.
930     /// </summary>
931     UINT32 GetValueSize(UINT32 index) const;
932     
933     /// <summary>
934     /// Retrieves the sub-properties of the given property by index.
935     /// </summary>
936     HRESULT GetSubProperties(
937         UINT32 index,
938         ID2D1Properties *subProperties 
939         ) const;
940     
941     final
942     HRESULT
943     SetValueByName(
944         PCWSTR name,
945         const(BYTE)* data,
946         UINT32 dataSize 
947         )  
948     {
949         return SetValueByName(name, D2D1_PROPERTY_TYPE_UNKNOWN, data, dataSize);
950     }
951     
952     final
953     HRESULT
954     SetValue(
955         UINT32 index,
956         const(BYTE)* data,
957         UINT32 dataSize 
958         )  
959     {
960         return SetValue(index, D2D1_PROPERTY_TYPE_UNKNOWN, data, dataSize);
961     }
962     
963     final
964     HRESULT
965     GetValueByName(
966         PCWSTR name,
967         BYTE* data,
968         UINT32 dataSize 
969         ) const  
970     {
971         return GetValueByName(name, D2D1_PROPERTY_TYPE_UNKNOWN, data, dataSize);
972     }
973     
974     final
975     HRESULT
976     GetValue(
977         UINT32 index,
978         BYTE* data,
979         UINT32 dataSize 
980         ) const  
981     {
982         return GetValue(index, D2D1_PROPERTY_TYPE_UNKNOWN, data, dataSize);
983     }
984     
985     //
986     // Templatized helper functions:
987     //
988     final
989     HRESULT GetValueByName(T)(
990         PCWSTR propertyName,
991         T *value
992         ) const
993     {
994         return GetValueByName(propertyName, cast(BYTE*)value, T.sizeof);
995     }
996     
997     final T GetValueByName(T)(PCWSTR propertyName) const
998     {
999         T value;
1000         HRESULT ignoreHr = GetValueByName(propertyName, cast(BYTE*)&value, T.sizeof);
1001         UNREFERENCED_PARAMETER(ignoreHr);
1002     
1003         return value;
1004     }
1005     
1006     
1007     final HRESULT SetValueByName(T)(
1008         PCWSTR propertyName,
1009         const T value
1010         )
1011     {
1012         return SetValueByName(propertyName, cast(const(BYTE)*)&value, T.sizeof);
1013     }
1014     
1015     final HRESULT GetValue(U)(
1016         U index,
1017         BYTE* data,
1018         UINT32 dataSize
1019         ) const
1020     {
1021         return GetValue(cast(UINT32)index, data, dataSize);
1022     }
1023     
1024     final HRESULT GetValue(T, U)(U index, T* value) const
1025     {
1026         return GetValue(cast(UINT32)index, cast(BYTE*)value, T.sizeof);
1027     }
1028     
1029     final T GetValue(T, U)(U index) const
1030     {
1031         T value;
1032         HRESULT ignoreHr = GetValue(cast(UINT32)index, cast(BYTE*)&value, T.sizeof);
1033     
1034         // Unreferenced variable:
1035         ignoreHr;
1036     
1037         return value;
1038     }
1039     
1040     final HRESULT SetValue(U)(U index, const(BYTE)* data, UINT32 dataSize)
1041     {
1042         return SetValue(cast(UINT32)index, data, dataSize);
1043     }
1044     
1045     final HRESULT SetValue(T, U)(U index, const T value)
1046     {
1047         return SetValue(cast(UINT32)index, cast(const(BYTE)*)&value, T.sizeof);
1048     }
1049     
1050     final HRESULT GetPropertyName(U)(U index, PWSTR name, UINT32 nameCount) const
1051     {
1052         return GetPropertyName(cast(UINT32)index, name, nameCount);
1053     }
1054     
1055     final UINT32 GetPropertyNameLength(U)(U index) const
1056     {
1057         return GetPropertyNameLength(cast(UINT32)index);
1058     }
1059     
1060     final D2D1_PROPERTY_TYPE GetType(U)(U index) const
1061     {
1062         return GetType(cast(UINT32)index);
1063     }
1064     
1065     
1066     final UINT32 GetValueSize(U)(U index) const
1067     {
1068         return GetValueSize(cast(UINT32)index);
1069     }
1070     
1071     final HRESULT GetSubProperties(U)(U index, out ID2D1Properties subProperties) const
1072     {
1073         return GetSubProperties(cast(UINT32)index, &subProperties);
1074     }
1075 } // interface ID2D1Properties
1076 
1077 
1078 mixin(uuid!(ID2D1Effect, "28211a43-7d89-476f-8181-2d6159b220ad"));
1079 /// <summary>
1080 /// The effect interface. Properties control how the effect is rendered. The effect
1081 /// is Drawn with the DrawImage call.
1082 /// </summary>
1083 interface ID2D1Effect : ID2D1Properties
1084 {
1085 	extern(Windows):
1086     /// <summary>
1087     /// Sets the input to the given effect. The input can be a concrete bitmap or the
1088     /// output of another effect.
1089     /// </summary>
1090     void SetInput(
1091         UINT32 index,
1092         ID2D1Image input,
1093         BOOL invalidate = TRUE 
1094         );
1095     
1096     /// <summary>
1097     /// If the effect supports a variable number of inputs, this sets the number of
1098     /// input that are currently active on the effect.
1099     /// </summary>
1100     HRESULT SetInputCount(UINT32 inputCount);
1101     
1102     /// <summary>
1103     /// Returns the input image to the effect. The input could be another effect or a
1104     /// bitmap.
1105     /// </summary>
1106     void GetInput(UINT32 index, ID2D1Image **input) const;
1107     
1108     /// <summary>
1109     /// This returns the number of input that are bound into this effect.
1110     /// </summary>
1111     UINT32 GetInputCount() const;
1112     
1113     /// <summary>
1114     /// Returns the output image of the given effect. This can be set as the input to
1115     /// another effect or can be drawn with DrawImage.
1116     /// </summary>
1117     void GetOutput(ID2D1Image *outputImage) const;
1118     
1119     final
1120     void
1121     SetInputEffect(UINT32 index, ID2D1Effect inputEffect, BOOL invalidate = TRUE)  
1122     {
1123         
1124         ID2D1Image output = null;
1125         if (inputEffect !is null) inputEffect.GetOutput(&output);
1126         scope(exit) if(output !is null) output.Release();
1127         SetInput(index, output, invalidate);
1128     }
1129 } // interface ID2D1Effect
1130 
1131 
1132 mixin(uuid!(ID2D1Bitmap, "28211a43-7d89-476f-8181-2d6159b220ad"));
1133 /// <summary>
1134 /// Represents a bitmap that can be used as a surface for an ID2D1DeviceContext or
1135 /// mapped into system memory, and can contain additional color context information.
1136 /// </summary>
1137 interface ID2D1Bitmap1 : ID2D1Bitmap
1138 {
1139 	extern(Windows):
1140     /// <summary>
1141     /// Retrieves the color context information associated with the bitmap.
1142     /// </summary>
1143     void GetColorContext(ID2D1ColorContext *colorContext) const;
1144     
1145     /// <summary>
1146     /// Retrieves the bitmap options used when creating the API.
1147     /// </summary>
1148     D2D1_BITMAP_OPTIONS GetOptions() const;
1149     
1150     /// <summary>
1151     /// Retrieves the DXGI surface from the corresponding bitmap, if the bitmap was
1152     /// created from a device derived from a D3D device.
1153     /// </summary>
1154     HRESULT GetSurface(IDXGISurface *dxgiSurface) const;
1155     
1156     /// <summary>
1157     /// Maps the given bitmap into memory. The bitmap must have been created with the
1158     /// D2D1_BITMAP_OPTIONS_CPU_READ flag.
1159     /// </summary>
1160     HRESULT Map(D2D1_MAP_OPTIONS options, D2D1_MAPPED_RECT *mappedRect);
1161     
1162     /// <summary>
1163     /// Unmaps the given bitmap from memory.
1164     /// </summary>
1165     HRESULT Unmap();
1166 } // interface ID2D1Bitmap1
1167 
1168 
1169 mixin(uuid!(ID2D1ColorContext, "1c4820bb-5771-4518-a581-2fe4dd0ec657"));
1170 /// <summary>
1171 /// Represents a color context that can be used with an ID2D1Bitmap1 object.
1172 /// </summary>
1173 interface ID2D1ColorContext : ID2D1Resource
1174 {
1175 	extern(Windows):
1176     /// <summary>
1177     /// Retrieves the color space of the color context.
1178     /// </summary>
1179     D2D1_COLOR_SPACE GetColorSpace() const;
1180     
1181     /// <summary>
1182     /// Retrieves the size of the color profile, in bytes.
1183     /// </summary>
1184     UINT32 GetProfileSize() const;
1185     
1186     /// <summary>
1187     /// Retrieves the color profile bytes.
1188     /// </summary>
1189     HRESULT GetProfile(BYTE* profile, UINT32 profileSize) const;
1190 } // interface ID2D1ColorContext
1191 
1192 
1193 mixin(uuid!(ID2D1GradientStopCollection1, "ae1572f4-5dd0-4777-998b-9279472ae63b"));
1194 /// <summary>
1195 /// Represents an collection of gradient stops that can then be the source resource
1196 /// for either a linear or radial gradient brush.
1197 /// </summary>
1198 interface ID2D1GradientStopCollection1 : ID2D1GradientStopCollection
1199 {
1200 	extern(Windows):
1201     /// <summary>
1202     /// Copies the gradient stops from the collection into the caller's memory. If this
1203     /// object was created using ID2D1DeviceContext::CreateGradientStopCollection, this
1204     /// method returns the same values as were specified in the creation method. If this
1205     /// object was created using ID2D1RenderTarget::CreateGradientStopCollection, the
1206     /// stops returned here will first be transformed into the gamma space specified by
1207     /// the colorInterpolationGamma parameter.
1208     /// </summary>
1209     void GetGradientStops1(D2D1_GRADIENT_STOP* gradientStops, UINT32 gradientStopsCount) const;
1210     
1211     /// <summary>
1212     /// Returns the color space in which interpolation occurs. If this object was
1213     /// created using ID2D1RenderTarget::CreateGradientStopCollection, this method
1214     /// returns the color space related to the color interpolation gamma.
1215     /// </summary>
1216     D2D1_COLOR_SPACE GetPreInterpolationSpace() const;
1217     
1218     /// <summary>
1219     /// Returns the color space colors will be converted to after interpolation occurs.
1220     /// If this object was created using
1221     /// ID2D1RenderTarget::CreateGradientStopCollection, this method returns
1222     /// D2D1_COLOR_SPACE_SRGB.
1223     /// </summary>
1224     D2D1_COLOR_SPACE GetPostInterpolationSpace() const;
1225     
1226     /// <summary>
1227     /// Returns the buffer precision of this gradient. If this object was created using
1228     /// ID2D1RenderTarget::CreateGradientStopCollection, this method returns
1229     /// D2D1_BUFFER_PRECISION_8BPC_UNORM.
1230     /// </summary>
1231     D2D1_BUFFER_PRECISION GetBufferPrecision() const;
1232     
1233     /// <summary>
1234     /// Returns the interpolation mode used to interpolate colors in the gradient.
1235     /// </summary>
1236     D2D1_COLOR_INTERPOLATION_MODE GetColorInterpolationMode() const;
1237 } // interface ID2D1GradientStopCollection1
1238 
1239 
1240 mixin(uuid!(ID2D1DrawingStateBlock1, "689f1f85-c72e-4e33-8f19-85754efd5ace"));
1241 /// <summary>
1242 /// Represents drawing state.
1243 /// </summary>
1244 interface ID2D1DrawingStateBlock1 : ID2D1DrawingStateBlock
1245 {
1246 	extern(Windows):
1247     /// <summary>
1248     /// Retrieves the state currently contained within this state block resource.
1249     /// </summary>
1250     void GetDescription(D2D1_DRAWING_STATE_DESCRIPTION1 *stateDescription) const;
1251 
1252     /* using ID2D1DrawingStateBlock::GetDescription; */
1253     void GetDescription(D2D1_DRAWING_STATE_DESCRIPTION *stateDescription) const;
1254     
1255     /// <summary>
1256     /// Sets the state description of this state block resource.
1257     /// </summary>
1258     void SetDescription(const(D2D1_DRAWING_STATE_DESCRIPTION1)* stateDescription);
1259     
1260     /* using ID2D1DrawingStateBlock::SetDescription; */
1261     void SetDescription(const(D2D1_DRAWING_STATE_DESCRIPTION)* stateDescription);
1262 } // interface ID2D1DrawingStateBlock1
1263 
1264 
1265 mixin(uuid!(ID2D1DeviceContext, "e8f7fe7a-191c-466d-ad95-975678bda998"));
1266 /// <summary>
1267 /// The device context represents a set of state and a command buffer that is used
1268 /// to render to a target bitmap.
1269 /// </summary>
1270 interface ID2D1DeviceContext : ID2D1RenderTarget
1271 {
1272 	extern(Windows):
1273     /// <summary>
1274     /// Creates a bitmap with extended bitmap properties, potentially from a block of
1275     /// memory.
1276     /// </summary>
1277     HRESULT CreateBitmap(
1278         D2D1_SIZE_U size,
1279         const(void)* sourceData,
1280         UINT32 pitch,
1281         const(D2D1_BITMAP_PROPERTIES1)* bitmapProperties,
1282         ID2D1Bitmap1 *bitmap 
1283         );
1284     
1285     /* using ID2D1RenderTarget::CreateBitmap; */
1286     HRESULT CreateBitmap(
1287         D2D1_SIZE_U size,
1288         const(void*) srcData,
1289         UINT32 pitch,
1290         const(D2D1_BITMAP_PROPERTIES)* bitmapProperties,
1291         /*out*/ID2D1Bitmap* bitmap 
1292         );
1293     
1294     /// <summary>
1295     /// Create a D2D bitmap by copying a WIC bitmap.
1296     /// </summary>
1297     HRESULT CreateBitmapFromWicBitmap(
1298         IWICBitmapSource wicBitmapSource,
1299         const(D2D1_BITMAP_PROPERTIES1)* bitmapProperties,
1300         ID2D1Bitmap1 *bitmap 
1301         );
1302     
1303     /* using ID2D1RenderTarget::CreateBitmapFromWicBitmap; */
1304     HRESULT CreateBitmapFromWicBitmap(
1305         IWICBitmapSource wicBitmapSource,
1306         const(D2D1_BITMAP_PROPERTIES)* bitmapProperties,
1307         /*out*/ ID2D1Bitmap *bitmap 
1308         );
1309     
1310     /// <summary>
1311     /// Creates a color context from a color space.  If the space is Custom, the context
1312     /// is initialized from the profile/profileSize arguments.  Otherwise the context is
1313     /// initialized with the profile bytes associated with the space and
1314     /// profile/profileSize are ignored.
1315     /// </summary>
1316     HRESULT CreateColorContext(
1317         D2D1_COLOR_SPACE space,
1318         const(BYTE)* profile,
1319         UINT32 profileSize,
1320         ID2D1ColorContext *colorContext 
1321         );
1322     
1323     HRESULT CreateColorContextFromFilename(
1324         PCWSTR filename,
1325         ID2D1ColorContext *colorContext 
1326         );
1327     
1328     HRESULT CreateColorContextFromWicColorContext(
1329         IWICColorContext wicColorContext,
1330         ID2D1ColorContext *colorContext 
1331         );
1332     
1333     /// <summary>
1334     /// Creates a bitmap from a DXGI surface with a set of extended properties.
1335     /// </summary>
1336     HRESULT CreateBitmapFromDxgiSurface(
1337         IDXGISurface surface,
1338         const(D2D1_BITMAP_PROPERTIES1)* bitmapProperties,
1339         ID2D1Bitmap1* bitmap 
1340         );
1341     
1342     /// <summary>
1343     /// Create a new effect, the effect must either be built in or previously registered
1344     /// through ID2D1Factory1::RegisterEffectFromStream or
1345     /// ID2D1Factory1::RegisterEffectFromString.
1346     /// </summary>
1347     HRESULT CreateEffect(
1348         REFCLSID effectId,
1349         ID2D1Effect *effect 
1350         );
1351     
1352     /// <summary>
1353     /// A gradient stop collection represents a set of stops in an ideal unit length.
1354     /// This is the source resource for a linear gradient and radial gradient brush.
1355     /// </summary>
1356     /// <param name="preInterpolationSpace">Specifies both the input color space and the
1357     /// space in which the color interpolation occurs.</param>
1358     /// <param name="postInterpolationSpace">Specifies the color space colors will be
1359     /// converted to after interpolation occurs.</param>
1360     /// <param name="bufferPrecision">Specifies the precision in which the gradient
1361     /// buffer will be held.</param>
1362     /// <param name="extendMode">Specifies how the gradient will be extended outside of
1363     /// the unit length.</param>
1364     /// <param name="colorInterpolationMode">Determines if colors will be interpolated
1365     /// in straight alpha or premultiplied alpha space.</param>
1366     HRESULT CreateGradientStopCollection(
1367         const(D2D1_GRADIENT_STOP)* straightAlphaGradientStops,
1368         UINT32 straightAlphaGradientStopsCount,
1369         D2D1_COLOR_SPACE preInterpolationSpace,
1370         D2D1_COLOR_SPACE postInterpolationSpace,
1371         D2D1_BUFFER_PRECISION bufferPrecision,
1372         D2D1_EXTEND_MODE extendMode,
1373         D2D1_COLOR_INTERPOLATION_MODE colorInterpolationMode,
1374         ID2D1GradientStopCollection1 *gradientStopCollection1 
1375         );
1376     
1377     /* using ID2D1RenderTarget::CreateGradientStopCollection; */
1378     HRESULT CreateGradientStopCollection(
1379         const(D2D1_GRADIENT_STOP)* gradientStops,
1380         UINT32 gradientStopsCount,
1381         
1382         //
1383         // Specifies which space the color interpolation occurs in.
1384         //
1385         D2D1_GAMMA colorInterpolationGamma,
1386         
1387         //
1388         // Specifies how the gradient will be extended outside of the unit length.
1389         //
1390         D2D1_EXTEND_MODE extendMode,
1391         /*out*/ ID2D1GradientStopCollection* gradientStopCollection 
1392         );
1393     
1394     /// <summary>
1395     /// Creates an image brush, the input image can be any type of image, including a
1396     /// bitmap, effect and a command list.
1397     /// </summary>
1398     HRESULT CreateImageBrush(
1399         ID2D1Image image,
1400         const(D2D1_IMAGE_BRUSH_PROPERTIES)* imageBrushProperties,
1401         const(D2D1_BRUSH_PROPERTIES)* brushProperties,
1402         ID2D1ImageBrush *imageBrush 
1403         );
1404     
1405     HRESULT CreateBitmapBrush(
1406         ID2D1Bitmap bitmap,
1407         const(D2D1_BITMAP_BRUSH_PROPERTIES1)* bitmapBrushProperties,
1408         const(D2D1_BRUSH_PROPERTIES)* brushProperties,
1409         ID2D1BitmapBrush1 *bitmapBrush 
1410         );
1411     
1412     /* using ID2D1RenderTarget::CreateBitmapBrush; */
1413     HRESULT CreateBitmapBrush(
1414         ID2D1Bitmap bitmap,
1415         const(D2D1_BITMAP_BRUSH_PROPERTIES)* bitmapBrushProperties,
1416         const(D2D1_BRUSH_PROPERTIES)* brushProperties,
1417         /*out*/ ID2D1BitmapBrush* bitmapBrush 
1418         );
1419     
1420     /// <summary>
1421     /// Creates a new command list.
1422     /// </summary>
1423     HRESULT CreateCommandList(ID2D1CommandList *commandList);
1424     
1425     /// <summary>
1426     /// Indicates whether the format is supported by D2D.
1427     /// </summary>
1428     BOOL IsDxgiFormatSupported(DXGI_FORMAT format) const;
1429     
1430     /// <summary>
1431     /// Indicates whether the buffer precision is supported by D2D.
1432     /// </summary>
1433     BOOL IsBufferPrecisionSupported(D2D1_BUFFER_PRECISION bufferPrecision) const;
1434     
1435     /// <summary>
1436     /// This retrieves the local-space bounds in DIPs of the current image using the
1437     /// device context DPI.
1438     /// </summary>
1439     HRESULT GetImageLocalBounds(
1440         ID2D1Image image,
1441         D2D1_RECT_F* localBounds 
1442         ) const;
1443     
1444     /// <summary>
1445     /// This retrieves the world-space bounds in DIPs of the current image using the
1446     /// device context DPI.
1447     /// </summary>
1448     HRESULT GetImageWorldBounds(
1449         ID2D1Image image,
1450         D2D1_RECT_F* worldBounds 
1451         ) const;
1452     
1453     /// <summary>
1454     /// Retrieves the world-space bounds in DIPs of the glyph run using the device
1455     /// context DPI.
1456     /// </summary>
1457     HRESULT GetGlyphRunWorldBounds(
1458         D2D1_POINT_2F baselineOrigin,
1459         const(DWRITE_GLYPH_RUN)* glyphRun,
1460         DWRITE_MEASURING_MODE measuringMode,
1461         D2D1_RECT_F* bounds 
1462         ) const;
1463     
1464     /// <summary>
1465     /// Retrieves the device associated with this device context.
1466     /// </summary>
1467     void GetDevice(ID2D1Device *device) const;
1468     
1469     /// <summary>
1470     /// Sets the target for this device context to point to the given image. The image
1471     /// can be a command list or a bitmap created with the D2D1_BITMAP_OPTIONS_TARGET
1472     /// flag.
1473     /// </summary>
1474     void SetTarget(ID2D1Image image);
1475     
1476     /// <summary>
1477     /// Gets the target that this device context is currently pointing to.
1478     /// </summary>
1479     void GetTarget(ID2D1Image *image) const;
1480     
1481     /// <summary>
1482     /// Sets tuning parameters for internal rendering inside the device context.
1483     /// </summary>
1484     void SetRenderingControls(const(D2D1_RENDERING_CONTROLS)* renderingControls);
1485     
1486     /// <summary>
1487     /// This retrieves the rendering controls currently selected into the device
1488     /// context.
1489     /// </summary>
1490     void GetRenderingControls(D2D1_RENDERING_CONTROLS* renderingControls) const;
1491     
1492     /// <summary>
1493     /// Changes the primitive blending mode for all of the rendering operations.
1494     /// </summary>
1495     void SetPrimitiveBlend(D2D1_PRIMITIVE_BLEND primitiveBlend);
1496     
1497     /// <summary>
1498     /// Returns the primitive blend currently selected into the device context.
1499     /// </summary>
1500     D2D1_PRIMITIVE_BLEND GetPrimitiveBlend() const;
1501     
1502     /// <summary>
1503     /// Changes the units used for all of the rendering operations.
1504     /// </summary>
1505     void SetUnitMode(D2D1_UNIT_MODE unitMode);
1506     
1507     /// <summary>
1508     /// Returns the unit mode currently set on the device context.
1509     /// </summary>
1510     D2D1_UNIT_MODE GetUnitMode() const;
1511     
1512     /// <summary>
1513     /// Draws the glyph run with an extended description to describe the glyphs.
1514     /// </summary>
1515     void DrawGlyphRun(
1516         D2D1_POINT_2F baselineOrigin,
1517         const(DWRITE_GLYPH_RUN)* glyphRun,
1518         const(DWRITE_GLYPH_RUN_DESCRIPTION)* glyphRunDescription,
1519         ID2D1Brush foregroundBrush,
1520         DWRITE_MEASURING_MODE measuringMode = DWRITE_MEASURING_MODE_NATURAL 
1521         );
1522     
1523     /* using ID2D1RenderTarget::DrawGlyphRun; */
1524     void DrawGlyphRun(
1525         D2D1_POINT_2F baselineOrigin,
1526         const(DWRITE_GLYPH_RUN)* glyphRun,
1527         ID2D1Brush foregroundBrush,
1528         DWRITE_MEASURING_MODE measuringMode = DWRITE_MEASURING_MODE_NATURAL 
1529         );
1530     
1531     /// <summary>
1532     /// Draw an image to the device context. The image represents either a concrete
1533     /// bitmap or the output of an effect graph.
1534     /// </summary>
1535     void DrawImage(
1536         ID2D1Image image,
1537         const(D2D1_POINT_2F)* targetOffset = null,
1538         const(D2D1_RECT_F)* imageRectangle = null,
1539         D2D1_INTERPOLATION_MODE interpolationMode = D2D1_INTERPOLATION_MODE_LINEAR,
1540         D2D1_COMPOSITE_MODE compositeMode = D2D1_COMPOSITE_MODE_SOURCE_OVER 
1541         );
1542     
1543     /// <summary>
1544     /// Draw a metafile to the device context.
1545     /// </summary>
1546     void DrawGdiMetafile(
1547         ID2D1GdiMetafile gdiMetafile,
1548         const(D2D1_POINT_2F)* targetOffset = null 
1549         );
1550     
1551     void DrawBitmap(
1552         ID2D1Bitmap bitmap,
1553         const(D2D1_RECT_F)* destinationRectangle,
1554         FLOAT opacity,
1555         D2D1_INTERPOLATION_MODE interpolationMode,
1556         const(D2D1_RECT_F)* sourceRectangle = null,
1557         const(D2D1_MATRIX_4X4_F)* perspectiveTransform = null 
1558         );
1559     
1560     /* using ID2D1RenderTarget::DrawBitmap; */
1561     void DrawBitmap(
1562         ID2D1Bitmap bitmap,
1563         const(D2D1_RECT_F)* destinationRectangle = null,
1564         FLOAT opacity = 1.0f,
1565         D2D1_BITMAP_INTERPOLATION_MODE interpolationMode = D2D1_BITMAP_INTERPOLATION_MODE_LINEAR,
1566         const(D2D1_RECT_F)* sourceRectangle = null 
1567         );
1568     
1569     /// <summary>
1570     /// Push a layer on the device context.
1571     /// </summary>
1572     void PushLayer(
1573         const(D2D1_LAYER_PARAMETERS1)* layerParameters,
1574         ID2D1Layer layer 
1575         );
1576     
1577     /* using ID2D1RenderTarget::PushLayer; */
1578     void PushLayer(
1579         const(D2D1_LAYER_PARAMETERS)* layerParameters,
1580         ID2D1Layer layer 
1581         );
1582     
1583     /// <summary>
1584     /// This indicates that a portion of an effect's input is invalid. This method can
1585     /// be called many times.
1586     /// </summary>
1587     HRESULT InvalidateEffectInputRectangle(
1588         ID2D1Effect effect,
1589         UINT32 input,
1590         const(D2D1_RECT_F)* inputRectangle 
1591         );
1592     
1593     /// <summary>
1594     /// Gets the number of invalid ouptut rectangles that have accumulated at the
1595     /// effect.
1596     /// </summary>
1597     HRESULT GetEffectInvalidRectangleCount(
1598         ID2D1Effect effect,
1599         UINT32* rectangleCount 
1600         );
1601     
1602     /// <summary>
1603     /// Gets the invalid rectangles that are at the output of the effect.
1604     /// </summary>
1605     HRESULT GetEffectInvalidRectangles(
1606         ID2D1Effect effect,
1607         D2D1_RECT_F* rectangles,
1608         UINT32 rectanglesCount 
1609         );
1610     
1611     /// <summary>
1612     /// Gets the maximum region of each specified input which would be used during a
1613     /// subsequent rendering operation
1614     /// </summary>
1615     HRESULT GetEffectRequiredInputRectangles(
1616         ID2D1Effect* renderEffect,
1617         const(D2D1_RECT_F)* renderImageRectangle,
1618         const(D2D1_EFFECT_INPUT_DESCRIPTION)* inputDescriptions,
1619         D2D1_RECT_F* requiredInputRects,
1620         UINT32 inputCount 
1621         );
1622     
1623     /// <summary>
1624     /// Fill using the alpha channel of the supplied opacity mask bitmap. The brush
1625     /// opacity will be modulated by the mask. The render target antialiasing mode must
1626     /// be set to aliased.
1627     /// </summary>
1628     void FillOpacityMask(
1629         ID2D1Bitmap opacityMask,
1630         ID2D1Brush brush,
1631         const(D2D1_RECT_F)* destinationRectangle = null,
1632         const(D2D1_RECT_F)* sourceRectangle = null 
1633         );
1634     
1635     /* using ID2D1RenderTarget::FillOpacityMask; */
1636     void FillOpacityMask(
1637         ID2D1Bitmap opacityMask,
1638         ID2D1Brush brush,
1639         D2D1_OPACITY_MASK_CONTENT content,
1640         const(D2D1_RECT_F)* destinationRectangle = null,
1641         const(D2D1_RECT_F)* sourceRectangle = null 
1642         );
1643     
1644     final
1645     HRESULT
1646     CreateBitmap(
1647         D2D1_SIZE_U size,
1648         const(void)* sourceData,
1649         UINT32 pitch,
1650         const D2D1_BITMAP_PROPERTIES1 bitmapProperties,
1651         out ID2D1Bitmap1 bitmap 
1652         )  
1653     {
1654         return CreateBitmap(size, sourceData, pitch, &bitmapProperties, &bitmap);
1655     }
1656     
1657     /// <summary>
1658     /// Create a D2D bitmap by copying a WIC bitmap.
1659     /// </summary>
1660     final
1661     HRESULT
1662     CreateBitmapFromWicBitmap(
1663         IWICBitmapSource wicBitmapSource,
1664         const D2D1_BITMAP_PROPERTIES1 bitmapProperties,
1665         out ID2D1Bitmap1 bitmap 
1666         )  
1667     {
1668         return CreateBitmapFromWicBitmap(wicBitmapSource, &bitmapProperties, &bitmap);
1669     }
1670     
1671     /// <summary>
1672     /// Create a D2D bitmap by copying a WIC bitmap.
1673     /// </summary>
1674     final
1675     HRESULT
1676     CreateBitmapFromWicBitmap(
1677         IWICBitmapSource wicBitmapSource,
1678         out ID2D1Bitmap1 bitmap 
1679         )  
1680     {
1681         return CreateBitmapFromWicBitmap(wicBitmapSource, null, &bitmap);
1682     }
1683     
1684     final
1685     HRESULT
1686     CreateBitmapFromDxgiSurface(
1687         IDXGISurface surface,
1688         const D2D1_BITMAP_PROPERTIES1 bitmapProperties,
1689         out ID2D1Bitmap1 bitmap 
1690         )  
1691     {
1692         return CreateBitmapFromDxgiSurface(surface, &bitmapProperties, &bitmap);
1693     }
1694     
1695     final
1696     HRESULT
1697     CreateImageBrush(
1698         ID2D1Image image,
1699         const D2D1_IMAGE_BRUSH_PROPERTIES imageBrushProperties,
1700         const D2D1_BRUSH_PROPERTIES brushProperties,
1701         out ID2D1ImageBrush imageBrush 
1702         )  
1703     {
1704         return CreateImageBrush(image, &imageBrushProperties, &brushProperties, &imageBrush);
1705     }
1706     
1707     final
1708     HRESULT
1709     CreateImageBrush(
1710         ID2D1Image image,
1711         const D2D1_IMAGE_BRUSH_PROPERTIES imageBrushProperties,
1712         out ID2D1ImageBrush imageBrush 
1713         )  
1714     {
1715         return CreateImageBrush(image,&imageBrushProperties, null, &imageBrush);
1716     }
1717     
1718     final
1719     HRESULT
1720     CreateBitmapBrush(
1721         ID2D1Bitmap bitmap,
1722         out ID2D1BitmapBrush1 bitmapBrush 
1723         )  
1724     {
1725         return CreateBitmapBrush(bitmap, null, null, &bitmapBrush);
1726     }
1727     
1728     final
1729     HRESULT
1730     CreateBitmapBrush(
1731         ID2D1Bitmap bitmap,
1732         const D2D1_BITMAP_BRUSH_PROPERTIES1 bitmapBrushProperties,
1733         out ID2D1BitmapBrush1 bitmapBrush 
1734         )  
1735     {
1736         return CreateBitmapBrush(bitmap, &bitmapBrushProperties, null, &bitmapBrush);
1737     }
1738     
1739     final
1740     HRESULT
1741     CreateBitmapBrush(
1742         ID2D1Bitmap bitmap,
1743         const D2D1_BITMAP_BRUSH_PROPERTIES1 bitmapBrushProperties,
1744         const D2D1_BRUSH_PROPERTIES brushProperties,
1745         out ID2D1BitmapBrush1 bitmapBrush 
1746         )  
1747     {
1748         return CreateBitmapBrush(bitmap, &bitmapBrushProperties, &brushProperties, &bitmapBrush);
1749     }
1750     
1751     /// <summary>
1752     /// Draws the output of the effect as an image.
1753     /// </summary>
1754     final
1755     void
1756     DrawImage(
1757         ID2D1Effect effect,
1758         const(D2D1_POINT_2F)* targetOffset = null,
1759         const(D2D1_RECT_F)* imageRectangle = null,
1760         D2D1_INTERPOLATION_MODE interpolationMode = D2D1_INTERPOLATION_MODE_LINEAR,
1761         D2D1_COMPOSITE_MODE compositeMode = D2D1_COMPOSITE_MODE_SOURCE_OVER 
1762         )  
1763     {
1764         
1765         ID2D1Image output = null;
1766         effect.GetOutput(&output); scope(exit) output.Release();
1767         DrawImage(output, targetOffset, imageRectangle, interpolationMode, compositeMode);
1768     }
1769     
1770     final
1771     void
1772     DrawImage(
1773         ID2D1Image image,
1774         D2D1_INTERPOLATION_MODE interpolationMode,
1775         D2D1_COMPOSITE_MODE compositeMode = D2D1_COMPOSITE_MODE_SOURCE_OVER 
1776         )  
1777     {
1778         DrawImage(image, null, null, interpolationMode, compositeMode);
1779     }
1780     
1781     final
1782     void
1783     DrawImage(
1784         ID2D1Effect effect,
1785         D2D1_INTERPOLATION_MODE interpolationMode,
1786         D2D1_COMPOSITE_MODE compositeMode = D2D1_COMPOSITE_MODE_SOURCE_OVER 
1787         )  
1788     {
1789         DrawImage(effect, null, null, interpolationMode, compositeMode);
1790     }
1791     
1792     final
1793     void
1794     DrawImage(
1795         ID2D1Image image,
1796         D2D1_POINT_2F targetOffset,
1797         D2D1_INTERPOLATION_MODE interpolationMode = D2D1_INTERPOLATION_MODE_LINEAR,
1798         D2D1_COMPOSITE_MODE compositeMode = D2D1_COMPOSITE_MODE_SOURCE_OVER 
1799         )  
1800     {
1801         DrawImage(image, &targetOffset, null, interpolationMode, compositeMode);
1802     }
1803     
1804     final
1805     void
1806     DrawImage(
1807         ID2D1Effect effect,
1808         D2D1_POINT_2F targetOffset,
1809         D2D1_INTERPOLATION_MODE interpolationMode = D2D1_INTERPOLATION_MODE_LINEAR,
1810         D2D1_COMPOSITE_MODE compositeMode = D2D1_COMPOSITE_MODE_SOURCE_OVER 
1811         )  
1812     {
1813         DrawImage(effect, &targetOffset, null, interpolationMode, compositeMode);
1814     }
1815 
1816     final
1817     void
1818     DrawImage(
1819         ID2D1Image image,
1820         D2D1_POINT_2F targetOffset,
1821         const D2D1_RECT_F imageRectangle,
1822         D2D1_INTERPOLATION_MODE interpolationMode = D2D1_INTERPOLATION_MODE_LINEAR,
1823         D2D1_COMPOSITE_MODE compositeMode = D2D1_COMPOSITE_MODE_SOURCE_OVER 
1824         )  
1825     {
1826         DrawImage(image, &targetOffset, &imageRectangle, interpolationMode, compositeMode);
1827     }
1828     
1829     final
1830     void
1831     DrawImage(
1832         ID2D1Effect effect,
1833         D2D1_POINT_2F targetOffset,
1834         const D2D1_RECT_F imageRectangle,
1835         D2D1_INTERPOLATION_MODE interpolationMode = D2D1_INTERPOLATION_MODE_LINEAR,
1836         D2D1_COMPOSITE_MODE compositeMode = D2D1_COMPOSITE_MODE_SOURCE_OVER 
1837         )  
1838     {
1839         DrawImage(effect, &targetOffset, &imageRectangle, interpolationMode, compositeMode);
1840     }
1841     
1842     final
1843     void
1844     PushLayer(
1845         const D2D1_LAYER_PARAMETERS1 layerParameters,
1846         ID2D1Layer layer 
1847         )  
1848     {
1849         PushLayer(&layerParameters, layer);
1850     }
1851     
1852     final
1853     void
1854     DrawGdiMetafile(
1855         ID2D1GdiMetafile gdiMetafile,
1856         D2D1_POINT_2F targetOffset 
1857         )  
1858     {
1859         DrawGdiMetafile(gdiMetafile, &targetOffset);
1860     }
1861     
1862     final
1863     void
1864     DrawBitmap(
1865         ID2D1Bitmap bitmap,
1866         const D2D1_RECT_F destinationRectangle,
1867         FLOAT opacity,
1868         D2D1_INTERPOLATION_MODE interpolationMode,
1869         const(D2D1_RECT_F)* sourceRectangle = null,
1870         const(D2D1_MATRIX_4X4_F)* perspectiveTransform = null 
1871         )  
1872     {
1873         DrawBitmap(bitmap, &destinationRectangle, opacity, interpolationMode, sourceRectangle, perspectiveTransform);
1874     }
1875     
1876     final
1877     void
1878     DrawBitmap(
1879         ID2D1Bitmap bitmap,
1880         const D2D1_RECT_F destinationRectangle,
1881         FLOAT opacity,
1882         D2D1_INTERPOLATION_MODE interpolationMode,
1883         const D2D1_RECT_F sourceRectangle,
1884         const(D2D1_MATRIX_4X4_F)* perspectiveTransform = null 
1885         )  
1886     {
1887         DrawBitmap(bitmap, &destinationRectangle, opacity, interpolationMode, &sourceRectangle, perspectiveTransform);
1888     }
1889     
1890     final
1891     void
1892     DrawBitmap(
1893         ID2D1Bitmap bitmap,
1894         const D2D1_RECT_F destinationRectangle,
1895         FLOAT opacity,
1896         D2D1_INTERPOLATION_MODE interpolationMode,
1897         const D2D1_RECT_F sourceRectangle,
1898         const D2D1_MATRIX_4X4_F perspectiveTransform 
1899         )  
1900     {
1901         DrawBitmap(bitmap, &destinationRectangle, opacity, interpolationMode, &sourceRectangle, &perspectiveTransform);
1902     }
1903     
1904     final
1905     void
1906     FillOpacityMask(
1907         ID2D1Bitmap opacityMask,
1908         ID2D1Brush brush,
1909         const D2D1_RECT_F destinationRectangle,
1910         const(D2D1_RECT_F)* sourceRectangle = null 
1911         )  
1912     {
1913         FillOpacityMask(opacityMask, brush, &destinationRectangle, sourceRectangle);
1914     }
1915     
1916     final
1917     void
1918     FillOpacityMask(
1919         ID2D1Bitmap opacityMask,
1920         ID2D1Brush brush,
1921         const D2D1_RECT_F destinationRectangle,
1922         const D2D1_RECT_F sourceRectangle 
1923         )  
1924     {
1925         FillOpacityMask(opacityMask, brush, &destinationRectangle, &sourceRectangle);
1926     }
1927     
1928     /// <summary>
1929     /// Sets tuning parameters for internal rendering inside the device context.
1930     /// </summary>
1931     final
1932     void
1933     SetRenderingControls(
1934         const D2D1_RENDERING_CONTROLS renderingControls 
1935         )  
1936     {
1937         return SetRenderingControls(&renderingControls);
1938     }
1939 } // interface ID2D1DeviceContext
1940 
1941 
1942 mixin(uuid!(ID2D1Device, "47dd575d-ac05-4cdd-8049-9b02cd16f44c"));
1943 /// <summary>
1944 /// The device defines a resource domain whose objects and device contexts can be
1945 /// used together.
1946 /// </summary>
1947 interface ID2D1Device : ID2D1Resource
1948 {
1949 	extern(Windows):
1950     /// <summary>
1951     /// Creates a new device context with no initially assigned target.
1952     /// </summary>
1953     HRESULT CreateDeviceContext(
1954         D2D1_DEVICE_CONTEXT_OPTIONS options,
1955         ID2D1DeviceContext *deviceContext 
1956         );
1957     
1958     /// <summary>
1959     /// Creates a D2D print control.
1960     /// </summary>
1961     HRESULT CreatePrintControl(
1962         IWICImagingFactory wicFactory,
1963         IPrintDocumentPackageTarget documentTarget,
1964         const(D2D1_PRINT_CONTROL_PROPERTIES)* printControlProperties,
1965         ID2D1PrintControl *printControl 
1966         );
1967     
1968     /// <summary>
1969     /// Sets the maximum amount of texture memory to maintain before evicting caches.
1970     /// </summary>
1971     void SetMaximumTextureMemory(UINT64 maximumInBytes);
1972     
1973     /// <summary>
1974     /// Gets the maximum amount of texture memory to maintain before evicting caches.
1975     /// </summary>
1976     UINT64 GetMaximumTextureMemory() const;
1977     
1978     /// <summary>
1979     /// Clears all resources that are cached but not held in use by the application
1980     /// through an interface reference.
1981     /// </summary>
1982     void ClearResources(UINT32 millisecondsSinceUse = 0);
1983     
1984     final
1985     HRESULT
1986     CreatePrintControl(
1987         IWICImagingFactory wicFactory,
1988         IPrintDocumentPackageTarget documentTarget,
1989         const D2D1_PRINT_CONTROL_PROPERTIES printControlProperties,
1990         out ID2D1PrintControl printControl 
1991         )  
1992     {
1993         return CreatePrintControl(wicFactory, documentTarget, &printControlProperties, &printControl);
1994     }
1995 } // interface ID2D1Device
1996 
1997 
1998 mixin(uuid!(ID2D1Factory1, "bb12d362-daee-4b9a-aa1d-14ba401cfa1f"));
1999 /// <summary>
2000 /// Creates Direct2D resources.
2001 /// </summary>
2002 interface ID2D1Factory1 : ID2D1Factory
2003 {
2004 	extern(Windows):
2005     /// <summary>
2006     /// This creates a new Direct2D device from the given IDXGIDevice.
2007     /// </summary>
2008     HRESULT CreateDevice(
2009         IDXGIDevice dxgiDevice,
2010         ID2D1Device *d2dDevice 
2011         );
2012     
2013     /// <summary>
2014     /// This creates a stroke style with the ability to preserve stroke width in various
2015     /// ways.
2016     /// </summary>
2017     HRESULT CreateStrokeStyle(
2018         const(D2D1_STROKE_STYLE_PROPERTIES1)* strokeStyleProperties,
2019         const(FLOAT)* dashes,
2020         UINT32 dashesCount,
2021         ID2D1StrokeStyle1 *strokeStyle 
2022         );
2023     
2024     /* using ID2D1Factory::CreateStrokeStyle; */
2025     HRESULT CreateStrokeStyle(
2026         const(D2D1_STROKE_STYLE_PROPERTIES)* strokeStyleProperties,
2027         const(FLOAT)* dashes,
2028         UINT32 dashesCount,
2029         /*out*/ ID2D1StrokeStyle* strokeStyle 
2030         );
2031     
2032     /// <summary>
2033     /// Creates a path geometry with new operational methods.
2034     /// </summary>
2035     HRESULT CreatePathGeometry(ID2D1PathGeometry1 *pathGeometry);
2036     
2037     /* using ID2D1Factory::CreatePathGeometry; */
2038     HRESULT CreatePathGeometry(
2039         /*out*/ ID2D1PathGeometry* pathGeometry 
2040         );
2041     
2042     /// <summary>
2043     /// Creates a new drawing state block, this can be used in subsequent
2044     /// SaveDrawingState and RestoreDrawingState operations on the render target.
2045     /// </summary>
2046     HRESULT CreateDrawingStateBlock(
2047         const(D2D1_DRAWING_STATE_DESCRIPTION1)* drawingStateDescription,
2048         IDWriteRenderingParams textRenderingParams,
2049         ID2D1DrawingStateBlock1 *drawingStateBlock 
2050         );
2051     
2052     /* using ID2D1Factory::CreateDrawingStateBlock; */
2053     HRESULT CreateDrawingStateBlock(
2054         const(D2D1_DRAWING_STATE_DESCRIPTION)* drawingStateDescription,
2055         IDWriteRenderingParams textRenderingParams,
2056         /*out*/ ID2D1DrawingStateBlock* drawingStateBlock 
2057 		);
2058     
2059     /// <summary>
2060     /// Creates a new GDI metafile.
2061     /// </summary>
2062     HRESULT CreateGdiMetafile(
2063         IStream metafileStream,
2064         ID2D1GdiMetafile *metafile 
2065         );
2066     
2067     /// <summary>
2068     /// This globally registers the given effect. The effect can later be instantiated
2069     /// by using the registered class id. The effect registration is reference counted.
2070     /// </summary>
2071     HRESULT RegisterEffectFromStream(
2072         REFCLSID classId,
2073         IStream propertyXml,
2074         const(D2D1_PROPERTY_BINDING)* bindings,
2075         UINT32 bindingsCount,
2076         const PD2D1_EFFECT_FACTORY effectFactory 
2077         );
2078     
2079     /// <summary>
2080     /// This globally registers the given effect. The effect can later be instantiated
2081     /// by using the registered class id. The effect registration is reference counted.
2082     /// </summary>
2083     HRESULT RegisterEffectFromString(
2084         REFCLSID classId,
2085         PCWSTR propertyXml,
2086         const(D2D1_PROPERTY_BINDING)* bindings,
2087         UINT32 bindingsCount,
2088         const PD2D1_EFFECT_FACTORY effectFactory 
2089         );
2090     
2091     /// <summary>
2092     /// This unregisters the given effect by its class id, you need to call
2093     /// UnregisterEffect for every call to ID2D1Factory1::RegisterEffectFromStream and
2094     /// ID2D1Factory1::RegisterEffectFromString to completely unregister it.
2095     /// </summary>
2096     HRESULT UnregisterEffect(REFCLSID classId);
2097     
2098     /// <summary>
2099     /// This returns all of the registered effects in the process, including any
2100     /// built-in effects.
2101     /// </summary>
2102     /// <param name="effectsReturned">The number of effects returned into the passed in
2103     /// effects array.</param>
2104     /// <param name="effectsRegistered">The number of effects currently registered in
2105     /// the system.</param>
2106     HRESULT GetRegisteredEffects(
2107         CLSID* effects,
2108         UINT32 effectsCount,
2109         UINT32* effectsReturned,
2110         UINT32* effectsRegistered 
2111         ) const;
2112     
2113     /// <summary>
2114     /// This retrieves the effect properties for the given effect, all of the effect
2115     /// properties will be set to a default value since an effect is not instantiated to
2116     /// implement the returned property interface.
2117     /// </summary>
2118     HRESULT GetEffectProperties(
2119         REFCLSID effectId,
2120         ID2D1Properties *properties 
2121         ) const;
2122     
2123     final
2124     HRESULT
2125     CreateStrokeStyle(
2126         const D2D1_STROKE_STYLE_PROPERTIES1 strokeStyleProperties,
2127         const(FLOAT)* dashes,
2128         UINT32 dashesCount,
2129         out ID2D1StrokeStyle1 strokeStyle 
2130         )  
2131     {
2132         return CreateStrokeStyle(&strokeStyleProperties, dashes, dashesCount, &strokeStyle);
2133     }
2134     // D-style impl
2135     final
2136     HRESULT
2137     CreateStrokeStyle(
2138         const D2D1_STROKE_STYLE_PROPERTIES1 strokeStyleProperties,
2139         const(FLOAT)[] dashes,
2140         out ID2D1StrokeStyle1 strokeStyle 
2141         )  
2142     {
2143         return CreateStrokeStyle(&strokeStyleProperties, &dashes[0], cast(UINT32)dashes.length, &strokeStyle);
2144     }
2145     
2146     final
2147     HRESULT
2148     CreateDrawingStateBlock(
2149         const D2D1_DRAWING_STATE_DESCRIPTION1 drawingStateDescription,
2150         out ID2D1DrawingStateBlock1 drawingStateBlock 
2151         )  
2152     {
2153         return CreateDrawingStateBlock(&drawingStateDescription, null, &drawingStateBlock);
2154     }
2155     
2156     final
2157     HRESULT
2158     CreateDrawingStateBlock(out ID2D1DrawingStateBlock1 drawingStateBlock)  
2159     {
2160         return CreateDrawingStateBlock(null, null, &drawingStateBlock);
2161     }
2162 } // interface ID2D1Factory1
2163 
2164 
2165 mixin(uuid!(ID2D1Multithread, "31e6e7bc-e0ff-4d46-8c64-a0a8c41c15d3"));
2166 /// <summary>
2167 /// A locking mechanism from a Direct2D factory that Direct2D uses to control
2168 /// exclusive resource access in an app that is uses multiple threads.
2169 /// </summary>
2170 interface ID2D1Multithread : IUnknown
2171 {
2172 	extern(Windows):
2173     /// <summary>
2174     /// Returns whether the D2D factory was created with
2175     /// D2D1_FACTORY_TYPE_MULTI_THREADED.
2176     /// </summary>
2177     BOOL GetMultithreadProtected() const;
2178     
2179     /// <summary>
2180     /// Enters the D2D API critical section, if it exists.
2181     /// </summary>
2182     void Enter();
2183     
2184     /// <summary>
2185     /// Leaves the D2D API critical section, if it exists.
2186     /// </summary>
2187     void Leave();
2188 } // interface ID2D1Multithread
2189 
2190 extern(Windows)
2191 {
2192     HRESULT 
2193     D2D1CreateDevice(
2194         IDXGIDevice dxgiDevice,
2195         const(D2D1_CREATION_PROPERTIES)* creationProperties,
2196         ID2D1Device *d2dDevice
2197         ); 
2198         
2199     HRESULT 
2200     D2D1CreateDeviceContext(
2201         IDXGISurface dxgiSurface,
2202         const(D2D1_CREATION_PROPERTIES)* creationProperties,
2203         ID2D1DeviceContext *d2dDeviceContext
2204         ); 
2205 
2206     D2D1_COLOR_F
2207     D2D1ConvertColorSpace(
2208         D2D1_COLOR_SPACE sourceColorSpace,
2209         D2D1_COLOR_SPACE destinationColorSpace,
2210         const(D2D1_COLOR_F)* color
2211         );
2212             
2213     void
2214     D2D1SinCos(
2215       FLOAT angle,
2216       FLOAT* s,
2217       FLOAT* c
2218       );
2219            
2220     FLOAT
2221     D2D1Tan(FLOAT angle);
2222         
2223     FLOAT
2224     D2D1Vec3Length(
2225       FLOAT x,
2226       FLOAT y,
2227       FLOAT z
2228       );
2229 }
2230 
2231 // public import D2D1 = directx.d2d1_1helper; TODO: Resolve namespace translation
2232 
2233 HRESULT 
2234 D2D1CreateDevice(
2235     IDXGIDevice dxgiDevice,
2236     const D2D1_CREATION_PROPERTIES creationProperties,
2237     out ID2D1Device d2dDevice
2238     ) 
2239 {
2240 
2241     return
2242         D2D1CreateDevice(
2243             dxgiDevice,
2244             &creationProperties,
2245             &d2dDevice);
2246 } 
2247     
2248 HRESULT 
2249 D2D1CreateDeviceContext(
2250     IDXGISurface dxgiSurface,
2251     const D2D1_CREATION_PROPERTIES creationProperties,
2252     out ID2D1DeviceContext d2dDeviceContext
2253     ) 
2254 {
2255     return
2256         D2D1CreateDeviceContext(
2257             dxgiSurface,
2258             &creationProperties,
2259             &d2dDeviceContext);
2260 }