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