1 //---------------------------------------------------------------------------
2 // Copyright (c) Microsoft Corporation. All rights reserved.
3 //
4 // This file is automatically generated. Please do not edit it directly.
5 //
6 // File name: D2D1.h
7 //---------------------------------------------------------------------------
8 #ifdef _MSC_VER
9 #pragma once
10 #endif // #ifdef _MSC_VER
11
12 #ifndef _D2D1_H_
13 #define _D2D1_H_
14
15 #ifndef COM_NO_WINDOWS_H
16 #include <windows.h>
17 #endif // #ifndef COM_NO_WINDOWS_H
18 #include <unknwn.h>
19 #include <dcommon.h>
20 #include <d2derr.h>
21 #include <d2dbasetypes.h>
22 #include <dxgiformat.h>
23 /*#pragma region Desktop Family*/
24 /*#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)*/
25 #include <d3d10_1.h>
26 /*#else*/
27 /*#include <d3dcommon.h>*/
28 /*#endif*/ /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) */
29
30 #ifndef D2D_USE_C_DEFINITIONS
31
32 //
33 // We use the 'C' definitions if C++ is not defined
34 //
35 #ifndef __cplusplus
36 #define D2D_USE_C_DEFINITIONS
37 #endif
38
39 #endif // #ifndef D2D_USE_C_DEFINITIONS
40
41 /*#include <winapifamily.h>*/
42
43 //
44 // Forward declarations here
45 //
46
47 /*#pragma region Application Family*/
48 /*#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)*/
49
50 typedef interface IDWriteTextFormat IDWriteTextFormat;
51 typedef interface IDWriteTextLayout IDWriteTextLayout;
52 typedef interface IDWriteRenderingParams IDWriteRenderingParams;
53 typedef interface IDXGISurface IDXGISurface;
54 typedef interface IWICBitmap IWICBitmap;
55 typedef interface IWICBitmapSource IWICBitmapSource;
56
57 typedef struct DWRITE_GLYPH_RUN DWRITE_GLYPH_RUN;
58
59 #ifndef D2D_USE_C_DEFINITIONS
60
61 interface ID2D1Factory;
62 interface ID2D1RenderTarget;
63 interface ID2D1BitmapRenderTarget;
64 interface ID2D1SimplifiedGeometrySink;
65 interface ID2D1TessellationSink;
66 interface ID2D1Geometry;
67 interface ID2D1Brush;
68
69 #else
70
71 typedef interface ID2D1Factory ID2D1Factory;
72 typedef interface ID2D1RenderTarget ID2D1RenderTarget;
73 typedef interface ID2D1BitmapRenderTarget ID2D1BitmapRenderTarget;
74 typedef interface ID2D1SimplifiedGeometrySink ID2D1SimplifiedGeometrySink;;
75 typedef interface ID2D1TessellationSink ID2D1TessellationSink;
76 typedef interface ID2D1Geometry ID2D1Geometry;
77 typedef interface ID2D1Brush ID2D1Brush;
78
79 #endif
80
81 #define D2D1_INVALID_TAG ULONGLONG_MAX
82 #define D2D1_DEFAULT_FLATTENING_TOLERANCE (0.25f)
83
84 /// <summary>
85 /// This defines the superset of interpolation mode supported by D2D APIs
86 /// and built-in effects
87 /// </summary>
88 enum
89 {
90 D2D1_INTERPOLATION_MODE_DEFINITION_NEAREST_NEIGHBOR = 0,
91 D2D1_INTERPOLATION_MODE_DEFINITION_LINEAR = 1,
92 D2D1_INTERPOLATION_MODE_DEFINITION_CUBIC = 2,
93 D2D1_INTERPOLATION_MODE_DEFINITION_MULTI_SAMPLE_LINEAR = 3,
94 D2D1_INTERPOLATION_MODE_DEFINITION_ANISOTROPIC = 4,
95 D2D1_INTERPOLATION_MODE_DEFINITION_HIGH_QUALITY_CUBIC = 5,
96 D2D1_INTERPOLATION_MODE_DEFINITION_FANT = 6,
97 D2D1_INTERPOLATION_MODE_DEFINITION_MIPMAP_LINEAR = 7
98
99 };
100
101 /// <summary>
102 /// This determines what gamma is used for interpolation/blending.
103 /// </summary>
104 typedef enum D2D1_GAMMA
105 {
106
107 /// <summary>
108 /// Colors are manipulated in 2.2 gamma color space.
109 /// </summary>
110 D2D1_GAMMA_2_2 = 0,
111
112 /// <summary>
113 /// Colors are manipulated in 1.0 gamma color space.
114 /// </summary>
115 D2D1_GAMMA_1_0 = 1,
116 D2D1_GAMMA_FORCE_DWORD = 0xffffffff
117
118 } D2D1_GAMMA;
119
120 /// <summary>
121 /// Specifies what the contents are of an opacity mask.
122 /// </summary>
123 typedef enum D2D1_OPACITY_MASK_CONTENT
124 {
125
126 /// <summary>
127 /// The mask contains geometries or bitmaps.
128 /// </summary>
129 D2D1_OPACITY_MASK_CONTENT_GRAPHICS = 0,
130
131 /// <summary>
132 /// The mask contains text rendered using one of the natural text modes.
133 /// </summary>
134 D2D1_OPACITY_MASK_CONTENT_TEXT_NATURAL = 1,
135
136 /// <summary>
137 /// The mask contains text rendered using one of the GDI compatible text modes.
138 /// </summary>
139 D2D1_OPACITY_MASK_CONTENT_TEXT_GDI_COMPATIBLE = 2,
140 D2D1_OPACITY_MASK_CONTENT_FORCE_DWORD = 0xffffffff
141
142 } D2D1_OPACITY_MASK_CONTENT;
143
144 /// <summary>
145 /// Enum which describes how to sample from a source outside its base tile.
146 /// </summary>
147 typedef enum D2D1_EXTEND_MODE
148 {
149
150 /// <summary>
151 /// Extend the edges of the source out by clamping sample points outside the source
152 /// to the edges.
153 /// </summary>
154 D2D1_EXTEND_MODE_CLAMP = 0,
155
156 /// <summary>
157 /// The base tile is drawn untransformed and the remainder are filled by repeating
158 /// the base tile.
159 /// </summary>
160 D2D1_EXTEND_MODE_WRAP = 1,
161
162 /// <summary>
163 /// The same as wrap, but alternate tiles are flipped The base tile is drawn
164 /// untransformed.
165 /// </summary>
166 D2D1_EXTEND_MODE_MIRROR = 2,
167 D2D1_EXTEND_MODE_FORCE_DWORD = 0xffffffff
168
169 } D2D1_EXTEND_MODE;
170
171 /// <summary>
172 /// Enum which describes the manner in which we render edges of non-text primitives.
173 /// </summary>
174 typedef enum D2D1_ANTIALIAS_MODE
175 {
176
177 /// <summary>
178 /// The edges of each primitive are antialiased sequentially.
179 /// </summary>
180 D2D1_ANTIALIAS_MODE_PER_PRIMITIVE = 0,
181
182 /// <summary>
183 /// Each pixel is rendered if its pixel center is contained by the geometry.
184 /// </summary>
185 D2D1_ANTIALIAS_MODE_ALIASED = 1,
186 D2D1_ANTIALIAS_MODE_FORCE_DWORD = 0xffffffff
187
188 } D2D1_ANTIALIAS_MODE;
189
190 /// <summary>
191 /// Describes the antialiasing mode used for drawing text.
192 /// </summary>
193 typedef enum D2D1_TEXT_ANTIALIAS_MODE
194 {
195
196 /// <summary>
197 /// Render text using the current system setting.
198 /// </summary>
199 D2D1_TEXT_ANTIALIAS_MODE_DEFAULT = 0,
200
201 /// <summary>
202 /// Render text using ClearType.
203 /// </summary>
204 D2D1_TEXT_ANTIALIAS_MODE_CLEARTYPE = 1,
205
206 /// <summary>
207 /// Render text using gray-scale.
208 /// </summary>
209 D2D1_TEXT_ANTIALIAS_MODE_GRAYSCALE = 2,
210
211 /// <summary>
212 /// Render text aliased.
213 /// </summary>
214 D2D1_TEXT_ANTIALIAS_MODE_ALIASED = 3,
215 D2D1_TEXT_ANTIALIAS_MODE_FORCE_DWORD = 0xffffffff
216
217 } D2D1_TEXT_ANTIALIAS_MODE;
218
219 /// <summary>
220 /// Specifies the algorithm that is used when images are scaled or rotated. Note
221 /// Starting in Windows 8, more interpolations modes are available. See
222 /// D2D1_INTERPOLATION_MODE for more info.
223 /// </summary>
224 typedef enum D2D1_BITMAP_INTERPOLATION_MODE
225 {
226
227 /// <summary>
228 /// Nearest Neighbor filtering. Also known as nearest pixel or nearest point
229 /// sampling.
230 /// </summary>
231 D2D1_BITMAP_INTERPOLATION_MODE_NEAREST_NEIGHBOR = D2D1_INTERPOLATION_MODE_DEFINITION_NEAREST_NEIGHBOR,
232
233 /// <summary>
234 /// Linear filtering.
235 /// </summary>
236 D2D1_BITMAP_INTERPOLATION_MODE_LINEAR = D2D1_INTERPOLATION_MODE_DEFINITION_LINEAR,
237 D2D1_BITMAP_INTERPOLATION_MODE_FORCE_DWORD = 0xffffffff
238
239 } D2D1_BITMAP_INTERPOLATION_MODE;
240
241 /// <summary>
242 /// Modifications made to the draw text call that influence how the text is
243 /// rendered.
244 /// </summary>
245 typedef enum D2D1_DRAW_TEXT_OPTIONS
246 {
247
248 /// <summary>
249 /// Do not snap the baseline of the text vertically.
250 /// </summary>
251 D2D1_DRAW_TEXT_OPTIONS_NO_SNAP = 0x00000001,
252
253 /// <summary>
254 /// Clip the text to the content bounds.
255 /// </summary>
256 D2D1_DRAW_TEXT_OPTIONS_CLIP = 0x00000002,
257
258 /// <summary>
259 /// Render color versions of glyphs if defined by the font.
260 /// </summary>
261 D2D1_DRAW_TEXT_OPTIONS_ENABLE_COLOR_FONT = 0x00000004,
262
263 /// <summary>
264 /// Bitmap origins of color glyph bitmaps are not snapped.
265 /// </summary>
266 D2D1_DRAW_TEXT_OPTIONS_DISABLE_COLOR_BITMAP_SNAPPING = 0x00000008,
267 D2D1_DRAW_TEXT_OPTIONS_NONE = 0x00000000,
268 D2D1_DRAW_TEXT_OPTIONS_FORCE_DWORD = 0xffffffff
269
270 } D2D1_DRAW_TEXT_OPTIONS;
271
272 DEFINE_ENUM_FLAG_OPERATORS(D2D1_DRAW_TEXT_OPTIONS);
273
274 typedef D2D_POINT_2U D2D1_POINT_2U;
275 typedef D2D_POINT_2F D2D1_POINT_2F;
276 typedef D2D_RECT_F D2D1_RECT_F;
277 typedef D2D_RECT_U D2D1_RECT_U;
278 typedef D2D_SIZE_F D2D1_SIZE_F;
279 typedef D2D_SIZE_U D2D1_SIZE_U;
280 typedef D2D_COLOR_F D2D1_COLOR_F;
281 typedef D2D_MATRIX_3X2_F D2D1_MATRIX_3X2_F;
282 typedef UINT64 D2D1_TAG;
283
284 /// <summary>
285 /// Describes the pixel format and dpi of a bitmap.
286 /// </summary>
287 typedef struct D2D1_BITMAP_PROPERTIES
288 {
289 D2D1_PIXEL_FORMAT pixelFormat;
290 FLOAT dpiX;
291 FLOAT dpiY;
292
293 } D2D1_BITMAP_PROPERTIES;
294
295 /// <summary>
296 /// Contains the position and color of a gradient stop.
297 /// </summary>
298 typedef struct D2D1_GRADIENT_STOP
299 {
300 FLOAT position;
301 D2D1_COLOR_F color;
302
303 } D2D1_GRADIENT_STOP;
304
305 /// <summary>
306 /// Describes the opacity and transformation of a brush.
307 /// </summary>
308 typedef struct D2D1_BRUSH_PROPERTIES
309 {
310 FLOAT opacity;
311 D2D1_MATRIX_3X2_F transform;
312
313 } D2D1_BRUSH_PROPERTIES;
314
315 /// <summary>
316 /// Describes the extend modes and the interpolation mode of an ID2D1BitmapBrush.
317 /// </summary>
318 typedef struct D2D1_BITMAP_BRUSH_PROPERTIES
319 {
320 D2D1_EXTEND_MODE extendModeX;
321 D2D1_EXTEND_MODE extendModeY;
322 D2D1_BITMAP_INTERPOLATION_MODE interpolationMode;
323
324 } D2D1_BITMAP_BRUSH_PROPERTIES;
325
326 /// <summary>
327 /// Contains the starting point and endpoint of the gradient axis for an
328 /// ID2D1LinearGradientBrush.
329 /// </summary>
330 typedef struct D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES
331 {
332 D2D1_POINT_2F startPoint;
333 D2D1_POINT_2F endPoint;
334
335 } D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES;
336
337 /// <summary>
338 /// Contains the gradient origin offset and the size and position of the gradient
339 /// ellipse for an ID2D1RadialGradientBrush.
340 /// </summary>
341 typedef struct D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES
342 {
343 D2D1_POINT_2F center;
344 D2D1_POINT_2F gradientOriginOffset;
345 FLOAT radiusX;
346 FLOAT radiusY;
347
348 } D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES;
349
350 /// <summary>
351 /// Differentiates which of the two possible arcs could match the given arc
352 /// parameters.
353 /// </summary>
354 typedef enum D2D1_ARC_SIZE
355 {
356 D2D1_ARC_SIZE_SMALL = 0,
357 D2D1_ARC_SIZE_LARGE = 1,
358 D2D1_ARC_SIZE_FORCE_DWORD = 0xffffffff
359
360 } D2D1_ARC_SIZE;
361
362 /// <summary>
363 /// Enum which describes the drawing of the ends of a line.
364 /// </summary>
365 typedef enum D2D1_CAP_STYLE
366 {
367
368 /// <summary>
369 /// Flat line cap.
370 /// </summary>
371 D2D1_CAP_STYLE_FLAT = 0,
372
373 /// <summary>
374 /// Square line cap.
375 /// </summary>
376 D2D1_CAP_STYLE_SQUARE = 1,
377
378 /// <summary>
379 /// Round line cap.
380 /// </summary>
381 D2D1_CAP_STYLE_ROUND = 2,
382
383 /// <summary>
384 /// Triangle line cap.
385 /// </summary>
386 D2D1_CAP_STYLE_TRIANGLE = 3,
387 D2D1_CAP_STYLE_FORCE_DWORD = 0xffffffff
388
389 } D2D1_CAP_STYLE;
390
391 /// <summary>
392 /// Describes the sequence of dashes and gaps in a stroke.
393 /// </summary>
394 typedef enum D2D1_DASH_STYLE
395 {
396 D2D1_DASH_STYLE_SOLID = 0,
397 D2D1_DASH_STYLE_DASH = 1,
398 D2D1_DASH_STYLE_DOT = 2,
399 D2D1_DASH_STYLE_DASH_DOT = 3,
400 D2D1_DASH_STYLE_DASH_DOT_DOT = 4,
401 D2D1_DASH_STYLE_CUSTOM = 5,
402 D2D1_DASH_STYLE_FORCE_DWORD = 0xffffffff
403
404 } D2D1_DASH_STYLE;
405
406 /// <summary>
407 /// Enum which describes the drawing of the corners on the line.
408 /// </summary>
409 typedef enum D2D1_LINE_JOIN
410 {
411
412 /// <summary>
413 /// Miter join.
414 /// </summary>
415 D2D1_LINE_JOIN_MITER = 0,
416
417 /// <summary>
418 /// Bevel join.
419 /// </summary>
420 D2D1_LINE_JOIN_BEVEL = 1,
421
422 /// <summary>
423 /// Round join.
424 /// </summary>
425 D2D1_LINE_JOIN_ROUND = 2,
426
427 /// <summary>
428 /// Miter/Bevel join.
429 /// </summary>
430 D2D1_LINE_JOIN_MITER_OR_BEVEL = 3,
431 D2D1_LINE_JOIN_FORCE_DWORD = 0xffffffff
432
433 } D2D1_LINE_JOIN;
434
435 /// <summary>
436 /// This enumeration describes the type of combine operation to be performed.
437 /// </summary>
438 typedef enum D2D1_COMBINE_MODE
439 {
440
441 /// <summary>
442 /// Produce a geometry representing the set of points contained in either the first
443 /// or the second geometry.
444 /// </summary>
445 D2D1_COMBINE_MODE_UNION = 0,
446
447 /// <summary>
448 /// Produce a geometry representing the set of points common to the first and the
449 /// second geometries.
450 /// </summary>
451 D2D1_COMBINE_MODE_INTERSECT = 1,
452
453 /// <summary>
454 /// Produce a geometry representing the set of points contained in the first
455 /// geometry or the second geometry, but not both.
456 /// </summary>
457 D2D1_COMBINE_MODE_XOR = 2,
458
459 /// <summary>
460 /// Produce a geometry representing the set of points contained in the first
461 /// geometry but not the second geometry.
462 /// </summary>
463 D2D1_COMBINE_MODE_EXCLUDE = 3,
464 D2D1_COMBINE_MODE_FORCE_DWORD = 0xffffffff
465
466 } D2D1_COMBINE_MODE;
467
468 /// <summary>
469 /// Describes how one geometry object is spatially related to another geometry
470 /// object.
471 /// </summary>
472 typedef enum D2D1_GEOMETRY_RELATION
473 {
474
475 /// <summary>
476 /// The relation between the geometries couldn't be determined. This value is never
477 /// returned by any D2D method.
478 /// </summary>
479 D2D1_GEOMETRY_RELATION_UNKNOWN = 0,
480
481 /// <summary>
482 /// The two geometries do not intersect at all.
483 /// </summary>
484 D2D1_GEOMETRY_RELATION_DISJOINT = 1,
485
486 /// <summary>
487 /// The passed in geometry is entirely contained by the object.
488 /// </summary>
489 D2D1_GEOMETRY_RELATION_IS_CONTAINED = 2,
490
491 /// <summary>
492 /// The object entirely contains the passed in geometry.
493 /// </summary>
494 D2D1_GEOMETRY_RELATION_CONTAINS = 3,
495
496 /// <summary>
497 /// The two geometries overlap but neither completely contains the other.
498 /// </summary>
499 D2D1_GEOMETRY_RELATION_OVERLAP = 4,
500 D2D1_GEOMETRY_RELATION_FORCE_DWORD = 0xffffffff
501
502 } D2D1_GEOMETRY_RELATION;
503
504 /// <summary>
505 /// Specifies how simple the output of a simplified geometry sink should be.
506 /// </summary>
507 typedef enum D2D1_GEOMETRY_SIMPLIFICATION_OPTION
508 {
509 D2D1_GEOMETRY_SIMPLIFICATION_OPTION_CUBICS_AND_LINES = 0,
510 D2D1_GEOMETRY_SIMPLIFICATION_OPTION_LINES = 1,
511 D2D1_GEOMETRY_SIMPLIFICATION_OPTION_FORCE_DWORD = 0xffffffff
512
513 } D2D1_GEOMETRY_SIMPLIFICATION_OPTION;
514
515 /// <summary>
516 /// Indicates whether the given figure is filled or hollow.
517 /// </summary>
518 typedef enum D2D1_FIGURE_BEGIN
519 {
520 D2D1_FIGURE_BEGIN_FILLED = 0,
521 D2D1_FIGURE_BEGIN_HOLLOW = 1,
522 D2D1_FIGURE_BEGIN_FORCE_DWORD = 0xffffffff
523
524 } D2D1_FIGURE_BEGIN;
525
526 /// <summary>
527 /// Indicates whether the figure is open or closed on its end point.
528 /// </summary>
529 typedef enum D2D1_FIGURE_END
530 {
531 D2D1_FIGURE_END_OPEN = 0,
532 D2D1_FIGURE_END_CLOSED = 1,
533 D2D1_FIGURE_END_FORCE_DWORD = 0xffffffff
534
535 } D2D1_FIGURE_END;
536
537 /// <summary>
538 /// Describes a cubic bezier in a path.
539 /// </summary>
540 typedef struct D2D1_BEZIER_SEGMENT
541 {
542 D2D1_POINT_2F point1;
543 D2D1_POINT_2F point2;
544 D2D1_POINT_2F point3;
545
546 } D2D1_BEZIER_SEGMENT;
547
548 /// <summary>
549 /// Describes a triangle.
550 /// </summary>
551 typedef struct D2D1_TRIANGLE
552 {
553 D2D1_POINT_2F point1;
554 D2D1_POINT_2F point2;
555 D2D1_POINT_2F point3;
556
557 } D2D1_TRIANGLE;
558
559 /// <summary>
560 /// Indicates whether the given segment should be stroked, or, if the join between
561 /// this segment and the previous one should be smooth.
562 /// </summary>
563 typedef enum D2D1_PATH_SEGMENT
564 {
565 D2D1_PATH_SEGMENT_NONE = 0x00000000,
566 D2D1_PATH_SEGMENT_FORCE_UNSTROKED = 0x00000001,
567 D2D1_PATH_SEGMENT_FORCE_ROUND_LINE_JOIN = 0x00000002,
568 D2D1_PATH_SEGMENT_FORCE_DWORD = 0xffffffff
569
570 } D2D1_PATH_SEGMENT;
571
572 DEFINE_ENUM_FLAG_OPERATORS(D2D1_PATH_SEGMENT);
573
574 /// <summary>
575 /// Defines the direction that an elliptical arc is drawn.
576 /// </summary>
577 typedef enum D2D1_SWEEP_DIRECTION
578 {
579 D2D1_SWEEP_DIRECTION_COUNTER_CLOCKWISE = 0,
580 D2D1_SWEEP_DIRECTION_CLOCKWISE = 1,
581 D2D1_SWEEP_DIRECTION_FORCE_DWORD = 0xffffffff
582
583 } D2D1_SWEEP_DIRECTION;
584
585 /// <summary>
586 /// Specifies how the intersecting areas of geometries or figures are combined to
587 /// form the area of the composite geometry.
588 /// </summary>
589 typedef enum D2D1_FILL_MODE
590 {
591 D2D1_FILL_MODE_ALTERNATE = 0,
592 D2D1_FILL_MODE_WINDING = 1,
593 D2D1_FILL_MODE_FORCE_DWORD = 0xffffffff
594
595 } D2D1_FILL_MODE;
596
597 /// <summary>
598 /// Describes an arc that is defined as part of a path.
599 /// </summary>
600 typedef struct D2D1_ARC_SEGMENT
601 {
602 D2D1_POINT_2F point;
603 D2D1_SIZE_F size;
604 FLOAT rotationAngle;
605 D2D1_SWEEP_DIRECTION sweepDirection;
606 D2D1_ARC_SIZE arcSize;
607
608 } D2D1_ARC_SEGMENT;
609
610 /// <summary>
611 /// Contains the control point and end point for a quadratic Bezier segment.
612 /// </summary>
613 typedef struct D2D1_QUADRATIC_BEZIER_SEGMENT
614 {
615 D2D1_POINT_2F point1;
616 D2D1_POINT_2F point2;
617
618 } D2D1_QUADRATIC_BEZIER_SEGMENT;
619
620 /// <summary>
621 /// Contains the center point, x-radius, and y-radius of an ellipse.
622 /// </summary>
623 typedef struct D2D1_ELLIPSE
624 {
625 D2D1_POINT_2F point;
626 FLOAT radiusX;
627 FLOAT radiusY;
628
629 } D2D1_ELLIPSE;
630
631 /// <summary>
632 /// Contains the dimensions and corner radii of a rounded rectangle.
633 /// </summary>
634 typedef struct D2D1_ROUNDED_RECT
635 {
636 D2D1_RECT_F rect;
637 FLOAT radiusX;
638 FLOAT radiusY;
639
640 } D2D1_ROUNDED_RECT;
641
642 /// <summary>
643 /// Properties, aside from the width, that allow geometric penning to be specified.
644 /// </summary>
645 typedef struct D2D1_STROKE_STYLE_PROPERTIES
646 {
647 D2D1_CAP_STYLE startCap;
648 D2D1_CAP_STYLE endCap;
649 D2D1_CAP_STYLE dashCap;
650 D2D1_LINE_JOIN lineJoin;
651 FLOAT miterLimit;
652 D2D1_DASH_STYLE dashStyle;
653 FLOAT dashOffset;
654
655 } D2D1_STROKE_STYLE_PROPERTIES;
656
657 /// <summary>
658 /// Specified options that can be applied when a layer resource is applied to create
659 /// a layer.
660 /// </summary>
661 typedef enum D2D1_LAYER_OPTIONS
662 {
663 D2D1_LAYER_OPTIONS_NONE = 0x00000000,
664
665 /// <summary>
666 /// The layer will render correctly for ClearType text. If the render target was set
667 /// to ClearType previously, the layer will continue to render ClearType. If the
668 /// render target was set to ClearType and this option is not specified, the render
669 /// target will be set to render gray-scale until the layer is popped. The caller
670 /// can override this default by calling SetTextAntialiasMode while within the
671 /// layer. This flag is slightly slower than the default.
672 /// </summary>
673 D2D1_LAYER_OPTIONS_INITIALIZE_FOR_CLEARTYPE = 0x00000001,
674 D2D1_LAYER_OPTIONS_FORCE_DWORD = 0xffffffff
675
676 } D2D1_LAYER_OPTIONS;
677
678 DEFINE_ENUM_FLAG_OPERATORS(D2D1_LAYER_OPTIONS);
679
680 /// <summary>
681 /// Contains the content bounds, mask information, opacity settings, and other
682 /// options for a layer resource.
683 /// </summary>
684 typedef struct D2D1_LAYER_PARAMETERS
685 {
686
687 /// <summary>
688 /// The rectangular clip that will be applied to the layer. The clip is affected by
689 /// the world transform. Content outside of the content bounds will not render.
690 /// </summary>
691 D2D1_RECT_F contentBounds;
692
693 /// <summary>
694 /// A general mask that can be optionally applied to the content. Content not inside
695 /// the fill of the mask will not be rendered.
696 /// </summary>
697 _Field_size_opt_(1) ID2D1Geometry *geometricMask;
698
699 /// <summary>
700 /// Specifies whether the mask should be aliased or antialiased.
701 /// </summary>
702 D2D1_ANTIALIAS_MODE maskAntialiasMode;
703
704 /// <summary>
705 /// An additional transform that may be applied to the mask in addition to the
706 /// current world transform.
707 /// </summary>
708 D2D1_MATRIX_3X2_F maskTransform;
709
710 /// <summary>
711 /// The opacity with which all of the content in the layer will be blended back to
712 /// the target when the layer is popped.
713 /// </summary>
714 FLOAT opacity;
715
716 /// <summary>
717 /// An additional brush that can be applied to the layer. Only the opacity channel
718 /// is sampled from this brush and multiplied both with the layer content and the
719 /// over-all layer opacity.
720 /// </summary>
721 _Field_size_opt_(1) ID2D1Brush *opacityBrush;
722
723 /// <summary>
724 /// Specifies if ClearType will be rendered into the layer.
725 /// </summary>
726 D2D1_LAYER_OPTIONS layerOptions;
727
728 } D2D1_LAYER_PARAMETERS;
729
730 /// <summary>
731 /// Describes whether a window is occluded.
732 /// </summary>
733 typedef enum D2D1_WINDOW_STATE
734 {
735 D2D1_WINDOW_STATE_NONE = 0x0000000,
736 D2D1_WINDOW_STATE_OCCLUDED = 0x0000001,
737 D2D1_WINDOW_STATE_FORCE_DWORD = 0xffffffff
738
739 } D2D1_WINDOW_STATE;
740
741 DEFINE_ENUM_FLAG_OPERATORS(D2D1_WINDOW_STATE);
742
743 /// <summary>
744 /// Describes whether a render target uses hardware or software rendering, or if
745 /// Direct2D should select the rendering mode.
746 /// </summary>
747 typedef enum D2D1_RENDER_TARGET_TYPE
748 {
749
750 /// <summary>
751 /// D2D is free to choose the render target type for the caller.
752 /// </summary>
753 D2D1_RENDER_TARGET_TYPE_DEFAULT = 0,
754
755 /// <summary>
756 /// The render target will render using the CPU.
757 /// </summary>
758 D2D1_RENDER_TARGET_TYPE_SOFTWARE = 1,
759
760 /// <summary>
761 /// The render target will render using the GPU.
762 /// </summary>
763 D2D1_RENDER_TARGET_TYPE_HARDWARE = 2,
764 D2D1_RENDER_TARGET_TYPE_FORCE_DWORD = 0xffffffff
765
766 } D2D1_RENDER_TARGET_TYPE;
767
768 /// <summary>
769 /// Describes the minimum DirectX support required for hardware rendering by a
770 /// render target.
771 /// </summary>
772 typedef enum D2D1_FEATURE_LEVEL
773 {
774
775 /// <summary>
776 /// The caller does not require a particular underlying D3D device level.
777 /// </summary>
778 D2D1_FEATURE_LEVEL_DEFAULT = 0,
779
780 /// <summary>
781 /// The D3D device level is DX9 compatible.
782 /// </summary>
783 D2D1_FEATURE_LEVEL_9 = D3D_FEATURE_LEVEL_9_1,
784
785 /// <summary>
786 /// The D3D device level is DX10 compatible.
787 /// </summary>
788 D2D1_FEATURE_LEVEL_10 = D3D_FEATURE_LEVEL_10_0,
789 D2D1_FEATURE_LEVEL_FORCE_DWORD = 0xffffffff
790
791 } D2D1_FEATURE_LEVEL;
792
793 /// <summary>
794 /// Describes how a render target is remoted and whether it should be
795 /// GDI-compatible. This enumeration allows a bitwise combination of its member
796 /// values.
797 /// </summary>
798 typedef enum D2D1_RENDER_TARGET_USAGE
799 {
800 D2D1_RENDER_TARGET_USAGE_NONE = 0x00000000,
801
802 /// <summary>
803 /// Rendering will occur locally, if a terminal-services session is established, the
804 /// bitmap updates will be sent to the terminal services client.
805 /// </summary>
806 D2D1_RENDER_TARGET_USAGE_FORCE_BITMAP_REMOTING = 0x00000001,
807
808 /// <summary>
809 /// The render target will allow a call to GetDC on the ID2D1GdiInteropRenderTarget
810 /// interface. Rendering will also occur locally.
811 /// </summary>
812 D2D1_RENDER_TARGET_USAGE_GDI_COMPATIBLE = 0x00000002,
813 D2D1_RENDER_TARGET_USAGE_FORCE_DWORD = 0xffffffff
814
815 } D2D1_RENDER_TARGET_USAGE;
816
817 DEFINE_ENUM_FLAG_OPERATORS(D2D1_RENDER_TARGET_USAGE);
818
819 /// <summary>
820 /// Describes how present should behave.
821 /// </summary>
822 typedef enum D2D1_PRESENT_OPTIONS
823 {
824 D2D1_PRESENT_OPTIONS_NONE = 0x00000000,
825
826 /// <summary>
827 /// Keep the target contents intact through present.
828 /// </summary>
829 D2D1_PRESENT_OPTIONS_RETAIN_CONTENTS = 0x00000001,
830
831 /// <summary>
832 /// Do not wait for display refresh to commit changes to display.
833 /// </summary>
834 D2D1_PRESENT_OPTIONS_IMMEDIATELY = 0x00000002,
835 D2D1_PRESENT_OPTIONS_FORCE_DWORD = 0xffffffff
836
837 } D2D1_PRESENT_OPTIONS;
838
839 DEFINE_ENUM_FLAG_OPERATORS(D2D1_PRESENT_OPTIONS);
840
841 /// <summary>
842 /// Contains rendering options (hardware or software), pixel format, DPI
843 /// information, remoting options, and Direct3D support requirements for a render
844 /// target.
845 /// </summary>
846 typedef struct D2D1_RENDER_TARGET_PROPERTIES
847 {
848 D2D1_RENDER_TARGET_TYPE type;
849 D2D1_PIXEL_FORMAT pixelFormat;
850 FLOAT dpiX;
851 FLOAT dpiY;
852 D2D1_RENDER_TARGET_USAGE usage;
853 D2D1_FEATURE_LEVEL minLevel;
854
855 } D2D1_RENDER_TARGET_PROPERTIES;
856
857 /// <summary>
858 /// Contains the HWND, pixel size, and presentation options for an
859 /// ID2D1HwndRenderTarget.
860 /// </summary>
861 typedef struct D2D1_HWND_RENDER_TARGET_PROPERTIES
862 {
863 HWND hwnd;
864 D2D1_SIZE_U pixelSize;
865 D2D1_PRESENT_OPTIONS presentOptions;
866
867 } D2D1_HWND_RENDER_TARGET_PROPERTIES;
868
869 /// <summary>
870 /// Specifies additional features supportable by a compatible render target when it
871 /// is created. This enumeration allows a bitwise combination of its member values.
872 /// </summary>
873 typedef enum D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS
874 {
875 D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS_NONE = 0x00000000,
876
877 /// <summary>
878 /// The compatible render target will allow a call to GetDC on the
879 /// ID2D1GdiInteropRenderTarget interface. This can be specified even if the parent
880 /// render target is not GDI compatible.
881 /// </summary>
882 D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS_GDI_COMPATIBLE = 0x00000001,
883 D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS_FORCE_DWORD = 0xffffffff
884
885 } D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS;
886
887 DEFINE_ENUM_FLAG_OPERATORS(D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS);
888
889 /// <summary>
890 /// Allows the drawing state to be atomically created. This also specifies the
891 /// drawing state that is saved into an IDrawingStateBlock object.
892 /// </summary>
893 typedef struct D2D1_DRAWING_STATE_DESCRIPTION
894 {
895 D2D1_ANTIALIAS_MODE antialiasMode;
896 D2D1_TEXT_ANTIALIAS_MODE textAntialiasMode;
897 D2D1_TAG tag1;
898 D2D1_TAG tag2;
899 D2D1_MATRIX_3X2_F transform;
900
901 } D2D1_DRAWING_STATE_DESCRIPTION;
902
903 /// <summary>
904 /// Specifies how a device context is initialized for GDI rendering when it is
905 /// retrieved from the render target.
906 /// </summary>
907 typedef enum D2D1_DC_INITIALIZE_MODE
908 {
909
910 /// <summary>
911 /// The contents of the D2D render target will be copied to the DC.
912 /// </summary>
913 D2D1_DC_INITIALIZE_MODE_COPY = 0,
914
915 /// <summary>
916 /// The contents of the DC will be cleared.
917 /// </summary>
918 D2D1_DC_INITIALIZE_MODE_CLEAR = 1,
919 D2D1_DC_INITIALIZE_MODE_FORCE_DWORD = 0xffffffff
920
921 } D2D1_DC_INITIALIZE_MODE;
922
923 /// <summary>
924 /// Indicates the debug level to be output by the debug layer.
925 /// </summary>
926 typedef enum D2D1_DEBUG_LEVEL
927 {
928 D2D1_DEBUG_LEVEL_NONE = 0,
929 D2D1_DEBUG_LEVEL_ERROR = 1,
930 D2D1_DEBUG_LEVEL_WARNING = 2,
931 D2D1_DEBUG_LEVEL_INFORMATION = 3,
932 D2D1_DEBUG_LEVEL_FORCE_DWORD = 0xffffffff
933
934 } D2D1_DEBUG_LEVEL;
935
936 /// <summary>
937 /// Specifies the threading model of the created factory and all of its derived
938 /// resources.
939 /// </summary>
940 typedef enum D2D1_FACTORY_TYPE
941 {
942
943 /// <summary>
944 /// The resulting factory and derived resources may only be invoked serially.
945 /// Reference counts on resources are interlocked, however, resource and render
946 /// target state is not protected from multi-threaded access.
947 /// </summary>
948 D2D1_FACTORY_TYPE_SINGLE_THREADED = 0,
949
950 /// <summary>
951 /// The resulting factory may be invoked from multiple threads. Returned resources
952 /// use interlocked reference counting and their state is protected.
953 /// </summary>
954 D2D1_FACTORY_TYPE_MULTI_THREADED = 1,
955 D2D1_FACTORY_TYPE_FORCE_DWORD = 0xffffffff
956
957 } D2D1_FACTORY_TYPE;
958
959 /// <summary>
960 /// Allows additional parameters for factory creation.
961 /// </summary>
962 typedef struct D2D1_FACTORY_OPTIONS
963 {
964
965 /// <summary>
966 /// Requests a certain level of debugging information from the debug layer. This
967 /// parameter is ignored if the debug layer DLL is not present.
968 /// </summary>
969 D2D1_DEBUG_LEVEL debugLevel;
970
971 } D2D1_FACTORY_OPTIONS;
972
973 /*#endif*/ /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) */
974 /*#pragma endregion*/
975
976 /*#pragma region Application Family*/
977 /*#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)*/
978
979 EXTERN_C CONST IID IID_ID2D1Resource;
980 EXTERN_C CONST IID IID_ID2D1Image;
981 EXTERN_C CONST IID IID_ID2D1Bitmap;
982 EXTERN_C CONST IID IID_ID2D1GradientStopCollection;
983 EXTERN_C CONST IID IID_ID2D1Brush;
984 EXTERN_C CONST IID IID_ID2D1BitmapBrush;
985 EXTERN_C CONST IID IID_ID2D1SolidColorBrush;
986 EXTERN_C CONST IID IID_ID2D1LinearGradientBrush;
987 EXTERN_C CONST IID IID_ID2D1RadialGradientBrush;
988 EXTERN_C CONST IID IID_ID2D1StrokeStyle;
989 EXTERN_C CONST IID IID_ID2D1Geometry;
990 EXTERN_C CONST IID IID_ID2D1RectangleGeometry;
991 EXTERN_C CONST IID IID_ID2D1RoundedRectangleGeometry;
992 EXTERN_C CONST IID IID_ID2D1EllipseGeometry;
993 EXTERN_C CONST IID IID_ID2D1GeometryGroup;
994 EXTERN_C CONST IID IID_ID2D1TransformedGeometry;
995 EXTERN_C CONST IID IID_ID2D1SimplifiedGeometrySink;
996 EXTERN_C CONST IID IID_ID2D1GeometrySink;
997 EXTERN_C CONST IID IID_ID2D1TessellationSink;
998 EXTERN_C CONST IID IID_ID2D1PathGeometry;
999 EXTERN_C CONST IID IID_ID2D1Mesh;
1000 EXTERN_C CONST IID IID_ID2D1Layer;
1001 EXTERN_C CONST IID IID_ID2D1DrawingStateBlock;
1002 EXTERN_C CONST IID IID_ID2D1RenderTarget;
1003 EXTERN_C CONST IID IID_ID2D1BitmapRenderTarget;
1004 EXTERN_C CONST IID IID_ID2D1HwndRenderTarget;
1005 EXTERN_C CONST IID IID_ID2D1DCRenderTarget;
1006 EXTERN_C CONST IID IID_ID2D1Factory;
1007
1008 /*#endif*/ /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) */
1009 /*#pragma endregion*/
1010
1011 /*#pragma region Desktop Family*/
1012 /*#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)*/
1013
1014 EXTERN_C CONST IID IID_ID2D1GdiInteropRenderTarget;
1015
1016 /*#endif*/ /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) */
1017 /*#pragma endregion*/
1018
1019 #ifndef D2D_USE_C_DEFINITIONS
1020
1021 /*#pragma region Application Family*/
1022 /*#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)*/
1023
1024 /// <summary>
1025 /// The root interface for all resources in D2D.
1026 /// </summary>
1027 interface DX_DECLARE_INTERFACE("2cd90691-12e2-11dc-9fed-001143a055f9") ID2D1Resource : public IUnknown
1028 {
1029
1030 /// <summary>
1031 /// Retrieve the factory associated with this resource.
1032 /// </summary>
1033 STDMETHOD_(void, GetFactory)(
1034 _Outptr_ ID2D1Factory **factory
1035 ) CONST PURE;
1036 }; // interface ID2D1Resource
1037
1038 /// <summary>
1039 /// Represents a producer of pixels that can fill an arbitrary 2D plane.
1040 /// </summary>
1041 interface DX_DECLARE_INTERFACE("65019f75-8da2-497c-b32c-dfa34e48ede6") ID2D1Image : public ID2D1Resource
1042 {
1043 }; // interface ID2D1Image
1044
1045 /// <summary>
1046 /// Root bitmap resource, linearly scaled on a draw call.
1047 /// </summary>
1048 interface DX_DECLARE_INTERFACE("a2296057-ea42-4099-983b-539fb6505426") ID2D1Bitmap : public ID2D1Image
1049 {
1050
1051 /// <summary>
1052 /// Returns the size of the bitmap in resolution independent units.
1053 /// </summary>
1054 STDMETHOD_(D2D1_SIZE_F, GetSize)(
1055 ) CONST PURE;
1056
1057 /// <summary>
1058 /// Returns the size of the bitmap in resolution dependent units, (pixels).
1059 /// </summary>
1060 STDMETHOD_(D2D1_SIZE_U, GetPixelSize)(
1061 ) CONST PURE;
1062
1063 /// <summary>
1064 /// Retrieve the format of the bitmap.
1065 /// </summary>
1066 STDMETHOD_(D2D1_PIXEL_FORMAT, GetPixelFormat)(
1067 ) CONST PURE;
1068
1069 /// <summary>
1070 /// Return the DPI of the bitmap.
1071 /// </summary>
1072 STDMETHOD_(void, GetDpi)(
1073 _Out_ FLOAT *dpiX,
1074 _Out_ FLOAT *dpiY
1075 ) CONST PURE;
1076
1077 STDMETHOD(CopyFromBitmap)(
1078 _In_opt_ CONST D2D1_POINT_2U *destPoint,
1079 _In_ ID2D1Bitmap *bitmap,
1080 _In_opt_ CONST D2D1_RECT_U *srcRect
1081 ) PURE;
1082
1083 STDMETHOD(CopyFromRenderTarget)(
1084 _In_opt_ CONST D2D1_POINT_2U *destPoint,
1085 _In_ ID2D1RenderTarget *renderTarget,
1086 _In_opt_ CONST D2D1_RECT_U *srcRect
1087 ) PURE;
1088
1089 STDMETHOD(CopyFromMemory)(
1090 _In_opt_ CONST D2D1_RECT_U *dstRect,
1091 _In_ CONST void *srcData,
1092 UINT32 pitch
1093 ) PURE;
1094 }; // interface ID2D1Bitmap
1095
1096 /// <summary>
1097 /// Represents an collection of gradient stops that can then be the source resource
1098 /// for either a linear or radial gradient brush.
1099 /// </summary>
1100 interface DX_DECLARE_INTERFACE("2cd906a7-12e2-11dc-9fed-001143a055f9") ID2D1GradientStopCollection : public ID2D1Resource
1101 {
1102
1103 /// <summary>
1104 /// Returns the number of stops in the gradient.
1105 /// </summary>
1106 STDMETHOD_(UINT32, GetGradientStopCount)(
1107 ) CONST PURE;
1108
1109 /// <summary>
1110 /// Copies the gradient stops from the collection into the caller's interface. The
1111 /// returned colors have straight alpha.
1112 /// </summary>
1113 STDMETHOD_(void, GetGradientStops)(
1114 _Out_writes_to_(gradientStopsCount, _Inexpressible_("Retrieved through GetGradientStopCount()") ) D2D1_GRADIENT_STOP *gradientStops,
1115 UINT32 gradientStopsCount
1116 ) CONST PURE;
1117
1118 /// <summary>
1119 /// Returns whether the interpolation occurs with 1.0 or 2.2 gamma.
1120 /// </summary>
1121 STDMETHOD_(D2D1_GAMMA, GetColorInterpolationGamma)(
1122 ) CONST PURE;
1123
1124 STDMETHOD_(D2D1_EXTEND_MODE, GetExtendMode)(
1125 ) CONST PURE;
1126 }; // interface ID2D1GradientStopCollection
1127
1128 /// <summary>
1129 /// The root brush interface. All brushes can be used to fill or pen a geometry.
1130 /// </summary>
1131 interface DX_DECLARE_INTERFACE("2cd906a8-12e2-11dc-9fed-001143a055f9") ID2D1Brush : public ID2D1Resource
1132 {
1133
1134 /// <summary>
1135 /// Sets the opacity for when the brush is drawn over the entire fill of the brush.
1136 /// </summary>
1137 STDMETHOD_(void, SetOpacity)(
1138 FLOAT opacity
1139 ) PURE;
1140
1141 /// <summary>
1142 /// Sets the transform that applies to everything drawn by the brush.
1143 /// </summary>
1144 STDMETHOD_(void, SetTransform)(
1145 _In_ CONST D2D1_MATRIX_3X2_F *transform
1146 ) PURE;
1147
1148 STDMETHOD_(FLOAT, GetOpacity)(
1149 ) CONST PURE;
1150
1151 STDMETHOD_(void, GetTransform)(
1152 _Out_ D2D1_MATRIX_3X2_F *transform
1153 ) CONST PURE;
1154
1155 COM_DECLSPEC_NOTHROW
1156 void
SetTransform(CONST D2D1_MATRIX_3X2_F & transform)1157 SetTransform(
1158 CONST D2D1_MATRIX_3X2_F &transform
1159 )
1160 {
1161 SetTransform(&transform);
1162 }
1163 }; // interface ID2D1Brush
1164
1165 /// <summary>
1166 /// A bitmap brush allows a bitmap to be used to fill a geometry.
1167 /// </summary>
1168 interface DX_DECLARE_INTERFACE("2cd906aa-12e2-11dc-9fed-001143a055f9") ID2D1BitmapBrush : public ID2D1Brush
1169 {
1170
1171 /// <summary>
1172 /// Sets how the bitmap is to be treated outside of its natural extent on the X
1173 /// axis.
1174 /// </summary>
1175 STDMETHOD_(void, SetExtendModeX)(
1176 D2D1_EXTEND_MODE extendModeX
1177 ) PURE;
1178
1179 /// <summary>
1180 /// Sets how the bitmap is to be treated outside of its natural extent on the X
1181 /// axis.
1182 /// </summary>
1183 STDMETHOD_(void, SetExtendModeY)(
1184 D2D1_EXTEND_MODE extendModeY
1185 ) PURE;
1186
1187 /// <summary>
1188 /// Sets the interpolation mode used when this brush is used.
1189 /// </summary>
1190 STDMETHOD_(void, SetInterpolationMode)(
1191 D2D1_BITMAP_INTERPOLATION_MODE interpolationMode
1192 ) PURE;
1193
1194 /// <summary>
1195 /// Sets the bitmap associated as the source of this brush.
1196 /// </summary>
1197 STDMETHOD_(void, SetBitmap)(
1198 _In_opt_ ID2D1Bitmap *bitmap
1199 ) PURE;
1200
1201 STDMETHOD_(D2D1_EXTEND_MODE, GetExtendModeX)(
1202 ) CONST PURE;
1203
1204 STDMETHOD_(D2D1_EXTEND_MODE, GetExtendModeY)(
1205 ) CONST PURE;
1206
1207 STDMETHOD_(D2D1_BITMAP_INTERPOLATION_MODE, GetInterpolationMode)(
1208 ) CONST PURE;
1209
1210 STDMETHOD_(void, GetBitmap)(
1211 _Outptr_result_maybenull_ ID2D1Bitmap **bitmap
1212 ) CONST PURE;
1213 }; // interface ID2D1BitmapBrush
1214
1215 /// <summary>
1216 /// Paints an area with a solid color.
1217 /// </summary>
1218 interface DX_DECLARE_INTERFACE("2cd906a9-12e2-11dc-9fed-001143a055f9") ID2D1SolidColorBrush : public ID2D1Brush
1219 {
1220
1221 STDMETHOD_(void, SetColor)(
1222 _In_ CONST D2D1_COLOR_F *color
1223 ) PURE;
1224
1225 STDMETHOD_(D2D1_COLOR_F, GetColor)(
1226 ) CONST PURE;
1227
1228 COM_DECLSPEC_NOTHROW
1229 void
SetColor(CONST D2D1_COLOR_F & color)1230 SetColor(
1231 CONST D2D1_COLOR_F &color
1232 )
1233 {
1234 SetColor(&color);
1235 }
1236 }; // interface ID2D1SolidColorBrush
1237
1238 /// <summary>
1239 /// Paints an area with a linear gradient.
1240 /// </summary>
1241 interface DX_DECLARE_INTERFACE("2cd906ab-12e2-11dc-9fed-001143a055f9") ID2D1LinearGradientBrush : public ID2D1Brush
1242 {
1243
1244 STDMETHOD_(void, SetStartPoint)(
1245 D2D1_POINT_2F startPoint
1246 ) PURE;
1247
1248 /// <summary>
1249 /// Sets the end point of the gradient in local coordinate space. This is not
1250 /// influenced by the geometry being filled.
1251 /// </summary>
1252 STDMETHOD_(void, SetEndPoint)(
1253 D2D1_POINT_2F endPoint
1254 ) PURE;
1255
1256 STDMETHOD_(D2D1_POINT_2F, GetStartPoint)(
1257 ) CONST PURE;
1258
1259 STDMETHOD_(D2D1_POINT_2F, GetEndPoint)(
1260 ) CONST PURE;
1261
1262 STDMETHOD_(void, GetGradientStopCollection)(
1263 _Outptr_ ID2D1GradientStopCollection **gradientStopCollection
1264 ) CONST PURE;
1265 }; // interface ID2D1LinearGradientBrush
1266
1267 /// <summary>
1268 /// Paints an area with a radial gradient.
1269 /// </summary>
1270 interface DX_DECLARE_INTERFACE("2cd906ac-12e2-11dc-9fed-001143a055f9") ID2D1RadialGradientBrush : public ID2D1Brush
1271 {
1272
1273 /// <summary>
1274 /// Sets the center of the radial gradient. This will be in local coordinates and
1275 /// will not depend on the geometry being filled.
1276 /// </summary>
1277 STDMETHOD_(void, SetCenter)(
1278 D2D1_POINT_2F center
1279 ) PURE;
1280
1281 /// <summary>
1282 /// Sets offset of the origin relative to the radial gradient center.
1283 /// </summary>
1284 STDMETHOD_(void, SetGradientOriginOffset)(
1285 D2D1_POINT_2F gradientOriginOffset
1286 ) PURE;
1287
1288 STDMETHOD_(void, SetRadiusX)(
1289 FLOAT radiusX
1290 ) PURE;
1291
1292 STDMETHOD_(void, SetRadiusY)(
1293 FLOAT radiusY
1294 ) PURE;
1295
1296 STDMETHOD_(D2D1_POINT_2F, GetCenter)(
1297 ) CONST PURE;
1298
1299 STDMETHOD_(D2D1_POINT_2F, GetGradientOriginOffset)(
1300 ) CONST PURE;
1301
1302 STDMETHOD_(FLOAT, GetRadiusX)(
1303 ) CONST PURE;
1304
1305 STDMETHOD_(FLOAT, GetRadiusY)(
1306 ) CONST PURE;
1307
1308 STDMETHOD_(void, GetGradientStopCollection)(
1309 _Outptr_ ID2D1GradientStopCollection **gradientStopCollection
1310 ) CONST PURE;
1311 }; // interface ID2D1RadialGradientBrush
1312
1313 /// <summary>
1314 /// Resource interface that holds pen style properties.
1315 /// </summary>
1316 interface DX_DECLARE_INTERFACE("2cd9069d-12e2-11dc-9fed-001143a055f9") ID2D1StrokeStyle : public ID2D1Resource
1317 {
1318
1319 STDMETHOD_(D2D1_CAP_STYLE, GetStartCap)(
1320 ) CONST PURE;
1321
1322 STDMETHOD_(D2D1_CAP_STYLE, GetEndCap)(
1323 ) CONST PURE;
1324
1325 STDMETHOD_(D2D1_CAP_STYLE, GetDashCap)(
1326 ) CONST PURE;
1327
1328 STDMETHOD_(FLOAT, GetMiterLimit)(
1329 ) CONST PURE;
1330
1331 STDMETHOD_(D2D1_LINE_JOIN, GetLineJoin)(
1332 ) CONST PURE;
1333
1334 STDMETHOD_(FLOAT, GetDashOffset)(
1335 ) CONST PURE;
1336
1337 STDMETHOD_(D2D1_DASH_STYLE, GetDashStyle)(
1338 ) CONST PURE;
1339
1340 STDMETHOD_(UINT32, GetDashesCount)(
1341 ) CONST PURE;
1342
1343 /// <summary>
1344 /// Returns the dashes from the object into a user allocated array. The user must
1345 /// call GetDashesCount to retrieve the required size.
1346 /// </summary>
1347 STDMETHOD_(void, GetDashes)(
1348 _Out_writes_(dashesCount) FLOAT *dashes,
1349 UINT32 dashesCount
1350 ) CONST PURE;
1351 }; // interface ID2D1StrokeStyle
1352
1353 /// <summary>
1354 /// Represents a geometry resource and defines a set of helper methods for
1355 /// manipulating and measuring geometric shapes. Interfaces that inherit from
1356 /// ID2D1Geometry define specific shapes.
1357 /// </summary>
1358 interface DX_DECLARE_INTERFACE("2cd906a1-12e2-11dc-9fed-001143a055f9") ID2D1Geometry : public ID2D1Resource
1359 {
1360
1361 /// <summary>
1362 /// Retrieve the bounds of the geometry, with an optional applied transform.
1363 /// </summary>
1364 STDMETHOD(GetBounds)(
1365 _In_opt_ CONST D2D1_MATRIX_3X2_F *worldTransform,
1366 _Out_ D2D1_RECT_F *bounds
1367 ) CONST PURE;
1368
1369 /// <summary>
1370 /// Get the bounds of the corresponding geometry after it has been widened or have
1371 /// an optional pen style applied.
1372 /// </summary>
1373 STDMETHOD(GetWidenedBounds)(
1374 FLOAT strokeWidth,
1375 _In_opt_ ID2D1StrokeStyle *strokeStyle,
1376 _In_opt_ CONST D2D1_MATRIX_3X2_F *worldTransform,
1377 FLOAT flatteningTolerance,
1378 _Out_ D2D1_RECT_F *bounds
1379 ) CONST PURE;
1380
1381 /// <summary>
1382 /// Checks to see whether the corresponding penned and widened geometry contains the
1383 /// given point.
1384 /// </summary>
1385 STDMETHOD(StrokeContainsPoint)(
1386 D2D1_POINT_2F point,
1387 FLOAT strokeWidth,
1388 _In_opt_ ID2D1StrokeStyle *strokeStyle,
1389 _In_opt_ CONST D2D1_MATRIX_3X2_F *worldTransform,
1390 FLOAT flatteningTolerance,
1391 _Out_ BOOL *contains
1392 ) CONST PURE;
1393
1394 /// <summary>
1395 /// Test whether the given fill of this geometry would contain this point.
1396 /// </summary>
1397 STDMETHOD(FillContainsPoint)(
1398 D2D1_POINT_2F point,
1399 _In_opt_ CONST D2D1_MATRIX_3X2_F *worldTransform,
1400 FLOAT flatteningTolerance,
1401 _Out_ BOOL *contains
1402 ) CONST PURE;
1403
1404 /// <summary>
1405 /// Compare how one geometry intersects or contains another geometry.
1406 /// </summary>
1407 STDMETHOD(CompareWithGeometry)(
1408 _In_ ID2D1Geometry *inputGeometry,
1409 _In_opt_ CONST D2D1_MATRIX_3X2_F *inputGeometryTransform,
1410 FLOAT flatteningTolerance,
1411 _Out_ D2D1_GEOMETRY_RELATION *relation
1412 ) CONST PURE;
1413
1414 /// <summary>
1415 /// Converts a geometry to a simplified geometry that has arcs and quadratic beziers
1416 /// removed.
1417 /// </summary>
1418 STDMETHOD(Simplify)(
1419 D2D1_GEOMETRY_SIMPLIFICATION_OPTION simplificationOption,
1420 _In_opt_ CONST D2D1_MATRIX_3X2_F *worldTransform,
1421 FLOAT flatteningTolerance,
1422 _In_ ID2D1SimplifiedGeometrySink *geometrySink
1423 ) CONST PURE;
1424
1425 /// <summary>
1426 /// Tessellates a geometry into triangles.
1427 /// </summary>
1428 STDMETHOD(Tessellate)(
1429 _In_opt_ CONST D2D1_MATRIX_3X2_F *worldTransform,
1430 FLOAT flatteningTolerance,
1431 _In_ ID2D1TessellationSink *tessellationSink
1432 ) CONST PURE;
1433
1434 /// <summary>
1435 /// Performs a combine operation between the two geometries to produce a resulting
1436 /// geometry.
1437 /// </summary>
1438 STDMETHOD(CombineWithGeometry)(
1439 _In_ ID2D1Geometry *inputGeometry,
1440 D2D1_COMBINE_MODE combineMode,
1441 _In_opt_ CONST D2D1_MATRIX_3X2_F *inputGeometryTransform,
1442 FLOAT flatteningTolerance,
1443 _In_ ID2D1SimplifiedGeometrySink *geometrySink
1444 ) CONST PURE;
1445
1446 /// <summary>
1447 /// Computes the outline of the geometry. The result is written back into a
1448 /// simplified geometry sink.
1449 /// </summary>
1450 STDMETHOD(Outline)(
1451 _In_opt_ CONST D2D1_MATRIX_3X2_F *worldTransform,
1452 FLOAT flatteningTolerance,
1453 _In_ ID2D1SimplifiedGeometrySink *geometrySink
1454 ) CONST PURE;
1455
1456 /// <summary>
1457 /// Computes the area of the geometry.
1458 /// </summary>
1459 STDMETHOD(ComputeArea)(
1460 _In_opt_ CONST D2D1_MATRIX_3X2_F *worldTransform,
1461 FLOAT flatteningTolerance,
1462 _Out_ FLOAT *area
1463 ) CONST PURE;
1464
1465 /// <summary>
1466 /// Computes the length of the geometry.
1467 /// </summary>
1468 STDMETHOD(ComputeLength)(
1469 _In_opt_ CONST D2D1_MATRIX_3X2_F *worldTransform,
1470 FLOAT flatteningTolerance,
1471 _Out_ FLOAT *length
1472 ) CONST PURE;
1473
1474 /// <summary>
1475 /// Computes the point and tangent a given distance along the path.
1476 /// </summary>
1477 STDMETHOD(ComputePointAtLength)(
1478 FLOAT length,
1479 _In_opt_ CONST D2D1_MATRIX_3X2_F *worldTransform,
1480 FLOAT flatteningTolerance,
1481 _Out_opt_ D2D1_POINT_2F *point,
1482 _Out_opt_ D2D1_POINT_2F *unitTangentVector
1483 ) CONST PURE;
1484
1485 /// <summary>
1486 /// Get the geometry and widen it as well as apply an optional pen style.
1487 /// </summary>
1488 STDMETHOD(Widen)(
1489 FLOAT strokeWidth,
1490 _In_opt_ ID2D1StrokeStyle *strokeStyle,
1491 _In_opt_ CONST D2D1_MATRIX_3X2_F *worldTransform,
1492 FLOAT flatteningTolerance,
1493 _In_ ID2D1SimplifiedGeometrySink *geometrySink
1494 ) CONST PURE;
1495
1496 /// <summary>
1497 /// Retrieve the bounds of the geometry, with an optional applied transform.
1498 /// </summary>
1499 COM_DECLSPEC_NOTHROW
1500 HRESULT
GetBounds(CONST D2D1_MATRIX_3X2_F & worldTransform,_Out_ D2D1_RECT_F * bounds)1501 GetBounds(
1502 CONST D2D1_MATRIX_3X2_F &worldTransform,
1503 _Out_ D2D1_RECT_F *bounds
1504 ) CONST
1505 {
1506 return GetBounds(&worldTransform, bounds);
1507 }
1508
1509 /// <summary>
1510 /// Get the bounds of the corresponding geometry after it has been widened or have
1511 /// an optional pen style applied.
1512 /// </summary>
1513 COM_DECLSPEC_NOTHROW
1514 HRESULT
GetWidenedBounds(FLOAT strokeWidth,_In_opt_ ID2D1StrokeStyle * strokeStyle,CONST D2D1_MATRIX_3X2_F & worldTransform,FLOAT flatteningTolerance,_Out_ D2D1_RECT_F * bounds)1515 GetWidenedBounds(
1516 FLOAT strokeWidth,
1517 _In_opt_ ID2D1StrokeStyle *strokeStyle,
1518 CONST D2D1_MATRIX_3X2_F &worldTransform,
1519 FLOAT flatteningTolerance,
1520 _Out_ D2D1_RECT_F *bounds
1521 ) CONST
1522 {
1523 return GetWidenedBounds(strokeWidth, strokeStyle, &worldTransform, flatteningTolerance, bounds);
1524 }
1525
1526 /// <summary>
1527 /// Get the bounds of the corresponding geometry after it has been widened or have
1528 /// an optional pen style applied.
1529 /// </summary>
1530 COM_DECLSPEC_NOTHROW
1531 HRESULT
GetWidenedBounds(FLOAT strokeWidth,_In_opt_ ID2D1StrokeStyle * strokeStyle,_In_opt_ CONST D2D1_MATRIX_3X2_F * worldTransform,_Out_ D2D1_RECT_F * bounds)1532 GetWidenedBounds(
1533 FLOAT strokeWidth,
1534 _In_opt_ ID2D1StrokeStyle *strokeStyle,
1535 _In_opt_ CONST D2D1_MATRIX_3X2_F *worldTransform,
1536 _Out_ D2D1_RECT_F *bounds
1537 ) CONST
1538 {
1539 return GetWidenedBounds(strokeWidth, strokeStyle, worldTransform, D2D1_DEFAULT_FLATTENING_TOLERANCE, bounds);
1540 }
1541
1542 /// <summary>
1543 /// Get the bounds of the corresponding geometry after it has been widened or have
1544 /// an optional pen style applied.
1545 /// </summary>
1546 COM_DECLSPEC_NOTHROW
1547 HRESULT
GetWidenedBounds(FLOAT strokeWidth,_In_opt_ ID2D1StrokeStyle * strokeStyle,CONST D2D1_MATRIX_3X2_F & worldTransform,_Out_ D2D1_RECT_F * bounds)1548 GetWidenedBounds(
1549 FLOAT strokeWidth,
1550 _In_opt_ ID2D1StrokeStyle *strokeStyle,
1551 CONST D2D1_MATRIX_3X2_F &worldTransform,
1552 _Out_ D2D1_RECT_F *bounds
1553 ) CONST
1554 {
1555 return GetWidenedBounds(strokeWidth, strokeStyle, &worldTransform, D2D1_DEFAULT_FLATTENING_TOLERANCE, bounds);
1556 }
1557
1558 COM_DECLSPEC_NOTHROW
1559 HRESULT
StrokeContainsPoint(D2D1_POINT_2F point,FLOAT strokeWidth,_In_opt_ ID2D1StrokeStyle * strokeStyle,CONST D2D1_MATRIX_3X2_F & worldTransform,FLOAT flatteningTolerance,_Out_ BOOL * contains)1560 StrokeContainsPoint(
1561 D2D1_POINT_2F point,
1562 FLOAT strokeWidth,
1563 _In_opt_ ID2D1StrokeStyle *strokeStyle,
1564 CONST D2D1_MATRIX_3X2_F &worldTransform,
1565 FLOAT flatteningTolerance,
1566 _Out_ BOOL *contains
1567 ) CONST
1568 {
1569 return StrokeContainsPoint(point, strokeWidth, strokeStyle, &worldTransform, flatteningTolerance, contains);
1570 }
1571
1572 /// <summary>
1573 /// Checks to see whether the corresponding penned and widened geometry contains the
1574 /// given point.
1575 /// </summary>
1576 COM_DECLSPEC_NOTHROW
1577 HRESULT
StrokeContainsPoint(D2D1_POINT_2F point,FLOAT strokeWidth,_In_opt_ ID2D1StrokeStyle * strokeStyle,_In_opt_ CONST D2D1_MATRIX_3X2_F * worldTransform,_Out_ BOOL * contains)1578 StrokeContainsPoint(
1579 D2D1_POINT_2F point,
1580 FLOAT strokeWidth,
1581 _In_opt_ ID2D1StrokeStyle *strokeStyle,
1582 _In_opt_ CONST D2D1_MATRIX_3X2_F *worldTransform,
1583 _Out_ BOOL *contains
1584 ) CONST
1585 {
1586 return StrokeContainsPoint(point, strokeWidth, strokeStyle, worldTransform, D2D1_DEFAULT_FLATTENING_TOLERANCE, contains);
1587 }
1588
1589 COM_DECLSPEC_NOTHROW
1590 HRESULT
StrokeContainsPoint(D2D1_POINT_2F point,FLOAT strokeWidth,_In_opt_ ID2D1StrokeStyle * strokeStyle,CONST D2D1_MATRIX_3X2_F & worldTransform,_Out_ BOOL * contains)1591 StrokeContainsPoint(
1592 D2D1_POINT_2F point,
1593 FLOAT strokeWidth,
1594 _In_opt_ ID2D1StrokeStyle *strokeStyle,
1595 CONST D2D1_MATRIX_3X2_F &worldTransform,
1596 _Out_ BOOL *contains
1597 ) CONST
1598 {
1599 return StrokeContainsPoint(point, strokeWidth, strokeStyle, &worldTransform, D2D1_DEFAULT_FLATTENING_TOLERANCE, contains);
1600 }
1601
1602 COM_DECLSPEC_NOTHROW
1603 HRESULT
FillContainsPoint(D2D1_POINT_2F point,CONST D2D1_MATRIX_3X2_F & worldTransform,FLOAT flatteningTolerance,_Out_ BOOL * contains)1604 FillContainsPoint(
1605 D2D1_POINT_2F point,
1606 CONST D2D1_MATRIX_3X2_F &worldTransform,
1607 FLOAT flatteningTolerance,
1608 _Out_ BOOL *contains
1609 ) CONST
1610 {
1611 return FillContainsPoint(point, &worldTransform, flatteningTolerance, contains);
1612 }
1613
1614 /// <summary>
1615 /// Test whether the given fill of this geometry would contain this point.
1616 /// </summary>
1617 COM_DECLSPEC_NOTHROW
1618 HRESULT
FillContainsPoint(D2D1_POINT_2F point,_In_opt_ CONST D2D1_MATRIX_3X2_F * worldTransform,_Out_ BOOL * contains)1619 FillContainsPoint(
1620 D2D1_POINT_2F point,
1621 _In_opt_ CONST D2D1_MATRIX_3X2_F *worldTransform,
1622 _Out_ BOOL *contains
1623 ) CONST
1624 {
1625 return FillContainsPoint(point, worldTransform, D2D1_DEFAULT_FLATTENING_TOLERANCE, contains);
1626 }
1627
1628 COM_DECLSPEC_NOTHROW
1629 HRESULT
FillContainsPoint(D2D1_POINT_2F point,CONST D2D1_MATRIX_3X2_F & worldTransform,_Out_ BOOL * contains)1630 FillContainsPoint(
1631 D2D1_POINT_2F point,
1632 CONST D2D1_MATRIX_3X2_F &worldTransform,
1633 _Out_ BOOL *contains
1634 ) CONST
1635 {
1636 return FillContainsPoint(point, &worldTransform, D2D1_DEFAULT_FLATTENING_TOLERANCE, contains);
1637 }
1638
1639 /// <summary>
1640 /// Compare how one geometry intersects or contains another geometry.
1641 /// </summary>
1642 COM_DECLSPEC_NOTHROW
1643 HRESULT
CompareWithGeometry(_In_ ID2D1Geometry * inputGeometry,CONST D2D1_MATRIX_3X2_F & inputGeometryTransform,FLOAT flatteningTolerance,_Out_ D2D1_GEOMETRY_RELATION * relation)1644 CompareWithGeometry(
1645 _In_ ID2D1Geometry *inputGeometry,
1646 CONST D2D1_MATRIX_3X2_F &inputGeometryTransform,
1647 FLOAT flatteningTolerance,
1648 _Out_ D2D1_GEOMETRY_RELATION *relation
1649 ) CONST
1650 {
1651 return CompareWithGeometry(inputGeometry, &inputGeometryTransform, flatteningTolerance, relation);
1652 }
1653
1654 /// <summary>
1655 /// Compare how one geometry intersects or contains another geometry.
1656 /// </summary>
1657 COM_DECLSPEC_NOTHROW
1658 HRESULT
CompareWithGeometry(_In_ ID2D1Geometry * inputGeometry,_In_opt_ CONST D2D1_MATRIX_3X2_F * inputGeometryTransform,_Out_ D2D1_GEOMETRY_RELATION * relation)1659 CompareWithGeometry(
1660 _In_ ID2D1Geometry *inputGeometry,
1661 _In_opt_ CONST D2D1_MATRIX_3X2_F *inputGeometryTransform,
1662 _Out_ D2D1_GEOMETRY_RELATION *relation
1663 ) CONST
1664 {
1665 return CompareWithGeometry(inputGeometry, inputGeometryTransform, D2D1_DEFAULT_FLATTENING_TOLERANCE, relation);
1666 }
1667
1668 /// <summary>
1669 /// Compare how one geometry intersects or contains another geometry.
1670 /// </summary>
1671 COM_DECLSPEC_NOTHROW
1672 HRESULT
CompareWithGeometry(_In_ ID2D1Geometry * inputGeometry,CONST D2D1_MATRIX_3X2_F & inputGeometryTransform,_Out_ D2D1_GEOMETRY_RELATION * relation)1673 CompareWithGeometry(
1674 _In_ ID2D1Geometry *inputGeometry,
1675 CONST D2D1_MATRIX_3X2_F &inputGeometryTransform,
1676 _Out_ D2D1_GEOMETRY_RELATION *relation
1677 ) CONST
1678 {
1679 return CompareWithGeometry(inputGeometry, &inputGeometryTransform, D2D1_DEFAULT_FLATTENING_TOLERANCE, relation);
1680 }
1681
1682 /// <summary>
1683 /// Converts a geometry to a simplified geometry that has arcs and quadratic beziers
1684 /// removed.
1685 /// </summary>
1686 COM_DECLSPEC_NOTHROW
1687 HRESULT
Simplify(D2D1_GEOMETRY_SIMPLIFICATION_OPTION simplificationOption,CONST D2D1_MATRIX_3X2_F & worldTransform,FLOAT flatteningTolerance,_In_ ID2D1SimplifiedGeometrySink * geometrySink)1688 Simplify(
1689 D2D1_GEOMETRY_SIMPLIFICATION_OPTION simplificationOption,
1690 CONST D2D1_MATRIX_3X2_F &worldTransform,
1691 FLOAT flatteningTolerance,
1692 _In_ ID2D1SimplifiedGeometrySink *geometrySink
1693 ) CONST
1694 {
1695 return Simplify(simplificationOption, &worldTransform, flatteningTolerance, geometrySink);
1696 }
1697
1698 /// <summary>
1699 /// Converts a geometry to a simplified geometry that has arcs and quadratic beziers
1700 /// removed.
1701 /// </summary>
1702 COM_DECLSPEC_NOTHROW
1703 HRESULT
Simplify(D2D1_GEOMETRY_SIMPLIFICATION_OPTION simplificationOption,_In_opt_ CONST D2D1_MATRIX_3X2_F * worldTransform,_In_ ID2D1SimplifiedGeometrySink * geometrySink)1704 Simplify(
1705 D2D1_GEOMETRY_SIMPLIFICATION_OPTION simplificationOption,
1706 _In_opt_ CONST D2D1_MATRIX_3X2_F *worldTransform,
1707 _In_ ID2D1SimplifiedGeometrySink *geometrySink
1708 ) CONST
1709 {
1710 return Simplify(simplificationOption, worldTransform, D2D1_DEFAULT_FLATTENING_TOLERANCE, geometrySink);
1711 }
1712
1713 /// <summary>
1714 /// Converts a geometry to a simplified geometry that has arcs and quadratic beziers
1715 /// removed.
1716 /// </summary>
1717 COM_DECLSPEC_NOTHROW
1718 HRESULT
Simplify(D2D1_GEOMETRY_SIMPLIFICATION_OPTION simplificationOption,CONST D2D1_MATRIX_3X2_F & worldTransform,_In_ ID2D1SimplifiedGeometrySink * geometrySink)1719 Simplify(
1720 D2D1_GEOMETRY_SIMPLIFICATION_OPTION simplificationOption,
1721 CONST D2D1_MATRIX_3X2_F &worldTransform,
1722 _In_ ID2D1SimplifiedGeometrySink *geometrySink
1723 ) CONST
1724 {
1725 return Simplify(simplificationOption, &worldTransform, D2D1_DEFAULT_FLATTENING_TOLERANCE, geometrySink);
1726 }
1727
1728 /// <summary>
1729 /// Tessellates a geometry into triangles.
1730 /// </summary>
1731 COM_DECLSPEC_NOTHROW
1732 HRESULT
Tessellate(CONST D2D1_MATRIX_3X2_F & worldTransform,FLOAT flatteningTolerance,_In_ ID2D1TessellationSink * tessellationSink)1733 Tessellate(
1734 CONST D2D1_MATRIX_3X2_F &worldTransform,
1735 FLOAT flatteningTolerance,
1736 _In_ ID2D1TessellationSink *tessellationSink
1737 ) CONST
1738 {
1739 return Tessellate(&worldTransform, flatteningTolerance, tessellationSink);
1740 }
1741
1742 /// <summary>
1743 /// Tessellates a geometry into triangles.
1744 /// </summary>
1745 COM_DECLSPEC_NOTHROW
1746 HRESULT
Tessellate(_In_opt_ CONST D2D1_MATRIX_3X2_F * worldTransform,_In_ ID2D1TessellationSink * tessellationSink)1747 Tessellate(
1748 _In_opt_ CONST D2D1_MATRIX_3X2_F *worldTransform,
1749 _In_ ID2D1TessellationSink *tessellationSink
1750 ) CONST
1751 {
1752 return Tessellate(worldTransform, D2D1_DEFAULT_FLATTENING_TOLERANCE, tessellationSink);
1753 }
1754
1755 /// <summary>
1756 /// Tessellates a geometry into triangles.
1757 /// </summary>
1758 COM_DECLSPEC_NOTHROW
1759 HRESULT
Tessellate(CONST D2D1_MATRIX_3X2_F & worldTransform,_In_ ID2D1TessellationSink * tessellationSink)1760 Tessellate(
1761 CONST D2D1_MATRIX_3X2_F &worldTransform,
1762 _In_ ID2D1TessellationSink *tessellationSink
1763 ) CONST
1764 {
1765 return Tessellate(&worldTransform, D2D1_DEFAULT_FLATTENING_TOLERANCE, tessellationSink);
1766 }
1767
1768 /// <summary>
1769 /// Performs a combine operation between the two geometries to produce a resulting
1770 /// geometry.
1771 /// </summary>
1772 COM_DECLSPEC_NOTHROW
1773 HRESULT
CombineWithGeometry(_In_ ID2D1Geometry * inputGeometry,D2D1_COMBINE_MODE combineMode,CONST D2D1_MATRIX_3X2_F & inputGeometryTransform,FLOAT flatteningTolerance,_In_ ID2D1SimplifiedGeometrySink * geometrySink)1774 CombineWithGeometry(
1775 _In_ ID2D1Geometry *inputGeometry,
1776 D2D1_COMBINE_MODE combineMode,
1777 CONST D2D1_MATRIX_3X2_F &inputGeometryTransform,
1778 FLOAT flatteningTolerance,
1779 _In_ ID2D1SimplifiedGeometrySink *geometrySink
1780 ) CONST
1781 {
1782 return CombineWithGeometry(inputGeometry, combineMode, &inputGeometryTransform, flatteningTolerance, geometrySink);
1783 }
1784
1785 /// <summary>
1786 /// Performs a combine operation between the two geometries to produce a resulting
1787 /// geometry.
1788 /// </summary>
1789 COM_DECLSPEC_NOTHROW
1790 HRESULT
CombineWithGeometry(_In_ ID2D1Geometry * inputGeometry,D2D1_COMBINE_MODE combineMode,_In_opt_ CONST D2D1_MATRIX_3X2_F * inputGeometryTransform,_In_ ID2D1SimplifiedGeometrySink * geometrySink)1791 CombineWithGeometry(
1792 _In_ ID2D1Geometry *inputGeometry,
1793 D2D1_COMBINE_MODE combineMode,
1794 _In_opt_ CONST D2D1_MATRIX_3X2_F *inputGeometryTransform,
1795 _In_ ID2D1SimplifiedGeometrySink *geometrySink
1796 ) CONST
1797 {
1798 return CombineWithGeometry(inputGeometry, combineMode, inputGeometryTransform, D2D1_DEFAULT_FLATTENING_TOLERANCE, geometrySink);
1799 }
1800
1801 /// <summary>
1802 /// Performs a combine operation between the two geometries to produce a resulting
1803 /// geometry.
1804 /// </summary>
1805 COM_DECLSPEC_NOTHROW
1806 HRESULT
CombineWithGeometry(_In_ ID2D1Geometry * inputGeometry,D2D1_COMBINE_MODE combineMode,CONST D2D1_MATRIX_3X2_F & inputGeometryTransform,_In_ ID2D1SimplifiedGeometrySink * geometrySink)1807 CombineWithGeometry(
1808 _In_ ID2D1Geometry *inputGeometry,
1809 D2D1_COMBINE_MODE combineMode,
1810 CONST D2D1_MATRIX_3X2_F &inputGeometryTransform,
1811 _In_ ID2D1SimplifiedGeometrySink *geometrySink
1812 ) CONST
1813 {
1814 return CombineWithGeometry(inputGeometry, combineMode, &inputGeometryTransform, D2D1_DEFAULT_FLATTENING_TOLERANCE, geometrySink);
1815 }
1816
1817 /// <summary>
1818 /// Computes the outline of the geometry. The result is written back into a
1819 /// simplified geometry sink.
1820 /// </summary>
1821 COM_DECLSPEC_NOTHROW
1822 HRESULT
Outline(CONST D2D1_MATRIX_3X2_F & worldTransform,FLOAT flatteningTolerance,_In_ ID2D1SimplifiedGeometrySink * geometrySink)1823 Outline(
1824 CONST D2D1_MATRIX_3X2_F &worldTransform,
1825 FLOAT flatteningTolerance,
1826 _In_ ID2D1SimplifiedGeometrySink *geometrySink
1827 ) CONST
1828 {
1829 return Outline(&worldTransform, flatteningTolerance, geometrySink);
1830 }
1831
1832 /// <summary>
1833 /// Computes the outline of the geometry. The result is written back into a
1834 /// simplified geometry sink.
1835 /// </summary>
1836 COM_DECLSPEC_NOTHROW
1837 HRESULT
Outline(_In_opt_ CONST D2D1_MATRIX_3X2_F * worldTransform,_In_ ID2D1SimplifiedGeometrySink * geometrySink)1838 Outline(
1839 _In_opt_ CONST D2D1_MATRIX_3X2_F *worldTransform,
1840 _In_ ID2D1SimplifiedGeometrySink *geometrySink
1841 ) CONST
1842 {
1843 return Outline(worldTransform, D2D1_DEFAULT_FLATTENING_TOLERANCE, geometrySink);
1844 }
1845
1846 /// <summary>
1847 /// Computes the outline of the geometry. The result is written back into a
1848 /// simplified geometry sink.
1849 /// </summary>
1850 COM_DECLSPEC_NOTHROW
1851 HRESULT
Outline(CONST D2D1_MATRIX_3X2_F & worldTransform,_In_ ID2D1SimplifiedGeometrySink * geometrySink)1852 Outline(
1853 CONST D2D1_MATRIX_3X2_F &worldTransform,
1854 _In_ ID2D1SimplifiedGeometrySink *geometrySink
1855 ) CONST
1856 {
1857 return Outline(&worldTransform, D2D1_DEFAULT_FLATTENING_TOLERANCE, geometrySink);
1858 }
1859
1860 /// <summary>
1861 /// Computes the area of the geometry.
1862 /// </summary>
1863 COM_DECLSPEC_NOTHROW
1864 HRESULT
ComputeArea(CONST D2D1_MATRIX_3X2_F & worldTransform,FLOAT flatteningTolerance,_Out_ FLOAT * area)1865 ComputeArea(
1866 CONST D2D1_MATRIX_3X2_F &worldTransform,
1867 FLOAT flatteningTolerance,
1868 _Out_ FLOAT *area
1869 ) CONST
1870 {
1871 return ComputeArea(&worldTransform, flatteningTolerance, area);
1872 }
1873
1874 /// <summary>
1875 /// Computes the area of the geometry.
1876 /// </summary>
1877 COM_DECLSPEC_NOTHROW
1878 HRESULT
ComputeArea(_In_opt_ CONST D2D1_MATRIX_3X2_F * worldTransform,_Out_ FLOAT * area)1879 ComputeArea(
1880 _In_opt_ CONST D2D1_MATRIX_3X2_F *worldTransform,
1881 _Out_ FLOAT *area
1882 ) CONST
1883 {
1884 return ComputeArea(worldTransform, D2D1_DEFAULT_FLATTENING_TOLERANCE, area);
1885 }
1886
1887 /// <summary>
1888 /// Computes the area of the geometry.
1889 /// </summary>
1890 COM_DECLSPEC_NOTHROW
1891 HRESULT
ComputeArea(CONST D2D1_MATRIX_3X2_F & worldTransform,_Out_ FLOAT * area)1892 ComputeArea(
1893 CONST D2D1_MATRIX_3X2_F &worldTransform,
1894 _Out_ FLOAT *area
1895 ) CONST
1896 {
1897 return ComputeArea(&worldTransform, D2D1_DEFAULT_FLATTENING_TOLERANCE, area);
1898 }
1899
1900 /// <summary>
1901 /// Computes the length of the geometry.
1902 /// </summary>
1903 COM_DECLSPEC_NOTHROW
1904 HRESULT
ComputeLength(CONST D2D1_MATRIX_3X2_F & worldTransform,FLOAT flatteningTolerance,_Out_ FLOAT * length)1905 ComputeLength(
1906 CONST D2D1_MATRIX_3X2_F &worldTransform,
1907 FLOAT flatteningTolerance,
1908 _Out_ FLOAT *length
1909 ) CONST
1910 {
1911 return ComputeLength(&worldTransform, flatteningTolerance, length);
1912 }
1913
1914 /// <summary>
1915 /// Computes the length of the geometry.
1916 /// </summary>
1917 COM_DECLSPEC_NOTHROW
1918 HRESULT
ComputeLength(_In_opt_ CONST D2D1_MATRIX_3X2_F * worldTransform,_Out_ FLOAT * length)1919 ComputeLength(
1920 _In_opt_ CONST D2D1_MATRIX_3X2_F *worldTransform,
1921 _Out_ FLOAT *length
1922 ) CONST
1923 {
1924 return ComputeLength(worldTransform, D2D1_DEFAULT_FLATTENING_TOLERANCE, length);
1925 }
1926
1927 /// <summary>
1928 /// Computes the length of the geometry.
1929 /// </summary>
1930 COM_DECLSPEC_NOTHROW
1931 HRESULT
ComputeLength(CONST D2D1_MATRIX_3X2_F & worldTransform,_Out_ FLOAT * length)1932 ComputeLength(
1933 CONST D2D1_MATRIX_3X2_F &worldTransform,
1934 _Out_ FLOAT *length
1935 ) CONST
1936 {
1937 return ComputeLength(&worldTransform, D2D1_DEFAULT_FLATTENING_TOLERANCE, length);
1938 }
1939
1940 /// <summary>
1941 /// Computes the point and tangent a given distance along the path.
1942 /// </summary>
1943 COM_DECLSPEC_NOTHROW
1944 HRESULT
ComputePointAtLength(FLOAT length,CONST D2D1_MATRIX_3X2_F & worldTransform,FLOAT flatteningTolerance,_Out_opt_ D2D1_POINT_2F * point,_Out_opt_ D2D1_POINT_2F * unitTangentVector)1945 ComputePointAtLength(
1946 FLOAT length,
1947 CONST D2D1_MATRIX_3X2_F &worldTransform,
1948 FLOAT flatteningTolerance,
1949 _Out_opt_ D2D1_POINT_2F *point,
1950 _Out_opt_ D2D1_POINT_2F *unitTangentVector
1951 ) CONST
1952 {
1953 return ComputePointAtLength(length, &worldTransform, flatteningTolerance, point, unitTangentVector);
1954 }
1955
1956 /// <summary>
1957 /// Computes the point and tangent a given distance along the path.
1958 /// </summary>
1959 COM_DECLSPEC_NOTHROW
1960 HRESULT
ComputePointAtLength(FLOAT length,_In_opt_ CONST D2D1_MATRIX_3X2_F * worldTransform,_Out_opt_ D2D1_POINT_2F * point,_Out_opt_ D2D1_POINT_2F * unitTangentVector)1961 ComputePointAtLength(
1962 FLOAT length,
1963 _In_opt_ CONST D2D1_MATRIX_3X2_F *worldTransform,
1964 _Out_opt_ D2D1_POINT_2F *point,
1965 _Out_opt_ D2D1_POINT_2F *unitTangentVector
1966 ) CONST
1967 {
1968 return ComputePointAtLength(length, worldTransform, D2D1_DEFAULT_FLATTENING_TOLERANCE, point, unitTangentVector);
1969 }
1970
1971 /// <summary>
1972 /// Computes the point and tangent a given distance along the path.
1973 /// </summary>
1974 COM_DECLSPEC_NOTHROW
1975 HRESULT
ComputePointAtLength(FLOAT length,CONST D2D1_MATRIX_3X2_F & worldTransform,_Out_opt_ D2D1_POINT_2F * point,_Out_opt_ D2D1_POINT_2F * unitTangentVector)1976 ComputePointAtLength(
1977 FLOAT length,
1978 CONST D2D1_MATRIX_3X2_F &worldTransform,
1979 _Out_opt_ D2D1_POINT_2F *point,
1980 _Out_opt_ D2D1_POINT_2F *unitTangentVector
1981 ) CONST
1982 {
1983 return ComputePointAtLength(length, &worldTransform, D2D1_DEFAULT_FLATTENING_TOLERANCE, point, unitTangentVector);
1984 }
1985
1986 /// <summary>
1987 /// Get the geometry and widen it as well as apply an optional pen style.
1988 /// </summary>
1989 COM_DECLSPEC_NOTHROW
1990 HRESULT
Widen(FLOAT strokeWidth,_In_opt_ ID2D1StrokeStyle * strokeStyle,CONST D2D1_MATRIX_3X2_F & worldTransform,FLOAT flatteningTolerance,_In_ ID2D1SimplifiedGeometrySink * geometrySink)1991 Widen(
1992 FLOAT strokeWidth,
1993 _In_opt_ ID2D1StrokeStyle *strokeStyle,
1994 CONST D2D1_MATRIX_3X2_F &worldTransform,
1995 FLOAT flatteningTolerance,
1996 _In_ ID2D1SimplifiedGeometrySink *geometrySink
1997 ) CONST
1998 {
1999 return Widen(strokeWidth, strokeStyle, &worldTransform, flatteningTolerance, geometrySink);
2000 }
2001
2002 /// <summary>
2003 /// Get the geometry and widen it as well as apply an optional pen style.
2004 /// </summary>
2005 COM_DECLSPEC_NOTHROW
2006 HRESULT
Widen(FLOAT strokeWidth,_In_opt_ ID2D1StrokeStyle * strokeStyle,_In_opt_ CONST D2D1_MATRIX_3X2_F * worldTransform,_In_ ID2D1SimplifiedGeometrySink * geometrySink)2007 Widen(
2008 FLOAT strokeWidth,
2009 _In_opt_ ID2D1StrokeStyle *strokeStyle,
2010 _In_opt_ CONST D2D1_MATRIX_3X2_F *worldTransform,
2011 _In_ ID2D1SimplifiedGeometrySink *geometrySink
2012 ) CONST
2013 {
2014 return Widen(strokeWidth, strokeStyle, worldTransform, D2D1_DEFAULT_FLATTENING_TOLERANCE, geometrySink);
2015 }
2016
2017 /// <summary>
2018 /// Get the geometry and widen it as well as apply an optional pen style.
2019 /// </summary>
2020 COM_DECLSPEC_NOTHROW
2021 HRESULT
Widen(FLOAT strokeWidth,_In_opt_ ID2D1StrokeStyle * strokeStyle,CONST D2D1_MATRIX_3X2_F & worldTransform,_In_ ID2D1SimplifiedGeometrySink * geometrySink)2022 Widen(
2023 FLOAT strokeWidth,
2024 _In_opt_ ID2D1StrokeStyle *strokeStyle,
2025 CONST D2D1_MATRIX_3X2_F &worldTransform,
2026 _In_ ID2D1SimplifiedGeometrySink *geometrySink
2027 ) CONST
2028 {
2029 return Widen(strokeWidth, strokeStyle, &worldTransform, D2D1_DEFAULT_FLATTENING_TOLERANCE, geometrySink);
2030 }
2031 }; // interface ID2D1Geometry
2032
2033 /// <summary>
2034 /// Describes a two-dimensional rectangle.
2035 /// </summary>
2036 interface DX_DECLARE_INTERFACE("2cd906a2-12e2-11dc-9fed-001143a055f9") ID2D1RectangleGeometry : public ID2D1Geometry
2037 {
2038
2039 STDMETHOD_(void, GetRect)(
2040 _Out_ D2D1_RECT_F *rect
2041 ) CONST PURE;
2042 }; // interface ID2D1RectangleGeometry
2043
2044 /// <summary>
2045 /// Describes a rounded rectangle.
2046 /// </summary>
2047 interface DX_DECLARE_INTERFACE("2cd906a3-12e2-11dc-9fed-001143a055f9") ID2D1RoundedRectangleGeometry : public ID2D1Geometry
2048 {
2049
2050 STDMETHOD_(void, GetRoundedRect)(
2051 _Out_ D2D1_ROUNDED_RECT *roundedRect
2052 ) CONST PURE;
2053 }; // interface ID2D1RoundedRectangleGeometry
2054
2055 /// <summary>
2056 /// Represents an ellipse.
2057 /// </summary>
2058 interface DX_DECLARE_INTERFACE("2cd906a4-12e2-11dc-9fed-001143a055f9") ID2D1EllipseGeometry : public ID2D1Geometry
2059 {
2060
2061 STDMETHOD_(void, GetEllipse)(
2062 _Out_ D2D1_ELLIPSE *ellipse
2063 ) CONST PURE;
2064 }; // interface ID2D1EllipseGeometry
2065
2066 /// <summary>
2067 /// Represents a composite geometry, composed of other ID2D1Geometry objects.
2068 /// </summary>
2069 interface DX_DECLARE_INTERFACE("2cd906a6-12e2-11dc-9fed-001143a055f9") ID2D1GeometryGroup : public ID2D1Geometry
2070 {
2071
2072 STDMETHOD_(D2D1_FILL_MODE, GetFillMode)(
2073 ) CONST PURE;
2074
2075 STDMETHOD_(UINT32, GetSourceGeometryCount)(
2076 ) CONST PURE;
2077
2078 STDMETHOD_(void, GetSourceGeometries)(
2079 _Out_writes_(geometriesCount) ID2D1Geometry **geometries,
2080 UINT32 geometriesCount
2081 ) CONST PURE;
2082 }; // interface ID2D1GeometryGroup
2083
2084 /// <summary>
2085 /// Represents a geometry that has been transformed.
2086 /// </summary>
2087 interface DX_DECLARE_INTERFACE("2cd906bb-12e2-11dc-9fed-001143a055f9") ID2D1TransformedGeometry : public ID2D1Geometry
2088 {
2089
2090 STDMETHOD_(void, GetSourceGeometry)(
2091 _Outptr_ ID2D1Geometry **sourceGeometry
2092 ) CONST PURE;
2093
2094 STDMETHOD_(void, GetTransform)(
2095 _Out_ D2D1_MATRIX_3X2_F *transform
2096 ) CONST PURE;
2097 }; // interface ID2D1TransformedGeometry
2098
2099 /// <summary>
2100 /// Describes a geometric path that does not contain quadratic bezier curves or
2101 /// arcs.
2102 /// </summary>
2103 interface DX_DECLARE_INTERFACE("2cd9069e-12e2-11dc-9fed-001143a055f9") ID2D1SimplifiedGeometrySink : public IUnknown
2104 {
2105
2106 STDMETHOD_(void, SetFillMode)(
2107 D2D1_FILL_MODE fillMode
2108 ) PURE;
2109
2110 STDMETHOD_(void, SetSegmentFlags)(
2111 D2D1_PATH_SEGMENT vertexFlags
2112 ) PURE;
2113
2114 STDMETHOD_(void, BeginFigure)(
2115 D2D1_POINT_2F startPoint,
2116 D2D1_FIGURE_BEGIN figureBegin
2117 ) PURE;
2118
2119 STDMETHOD_(void, AddLines)(
2120 _In_reads_(pointsCount) CONST D2D1_POINT_2F *points,
2121 UINT32 pointsCount
2122 ) PURE;
2123
2124 STDMETHOD_(void, AddBeziers)(
2125 _In_reads_(beziersCount) CONST D2D1_BEZIER_SEGMENT *beziers,
2126 UINT32 beziersCount
2127 ) PURE;
2128
2129 STDMETHOD_(void, EndFigure)(
2130 D2D1_FIGURE_END figureEnd
2131 ) PURE;
2132
2133 STDMETHOD(Close)(
2134 ) PURE;
2135 }; // interface ID2D1SimplifiedGeometrySink
2136
2137 /// <summary>
2138 /// Describes a geometric path that can contain lines, arcs, cubic Bezier curves,
2139 /// and quadratic Bezier curves.
2140 /// </summary>
2141 interface DX_DECLARE_INTERFACE("2cd9069f-12e2-11dc-9fed-001143a055f9") ID2D1GeometrySink : public ID2D1SimplifiedGeometrySink
2142 {
2143
2144 STDMETHOD_(void, AddLine)(
2145 D2D1_POINT_2F point
2146 ) PURE;
2147
2148 STDMETHOD_(void, AddBezier)(
2149 _In_ CONST D2D1_BEZIER_SEGMENT *bezier
2150 ) PURE;
2151
2152 STDMETHOD_(void, AddQuadraticBezier)(
2153 _In_ CONST D2D1_QUADRATIC_BEZIER_SEGMENT *bezier
2154 ) PURE;
2155
2156 STDMETHOD_(void, AddQuadraticBeziers)(
2157 _In_reads_(beziersCount) CONST D2D1_QUADRATIC_BEZIER_SEGMENT *beziers,
2158 UINT32 beziersCount
2159 ) PURE;
2160
2161 STDMETHOD_(void, AddArc)(
2162 _In_ CONST D2D1_ARC_SEGMENT *arc
2163 ) PURE;
2164
2165 COM_DECLSPEC_NOTHROW
2166 void
AddBezier(CONST D2D1_BEZIER_SEGMENT & bezier)2167 AddBezier(
2168 CONST D2D1_BEZIER_SEGMENT &bezier
2169 )
2170 {
2171 AddBezier(&bezier);
2172 }
2173
2174 COM_DECLSPEC_NOTHROW
2175 void
AddQuadraticBezier(CONST D2D1_QUADRATIC_BEZIER_SEGMENT & bezier)2176 AddQuadraticBezier(
2177 CONST D2D1_QUADRATIC_BEZIER_SEGMENT &bezier
2178 )
2179 {
2180 AddQuadraticBezier(&bezier);
2181 }
2182
2183 COM_DECLSPEC_NOTHROW
2184 void
AddArc(CONST D2D1_ARC_SEGMENT & arc)2185 AddArc(
2186 CONST D2D1_ARC_SEGMENT &arc
2187 )
2188 {
2189 AddArc(&arc);
2190 }
2191 }; // interface ID2D1GeometrySink
2192
2193 /// <summary>
2194 /// Populates an ID2D1Mesh object with triangles.
2195 /// </summary>
2196 interface DX_DECLARE_INTERFACE("2cd906c1-12e2-11dc-9fed-001143a055f9") ID2D1TessellationSink : public IUnknown
2197 {
2198
2199 STDMETHOD_(void, AddTriangles)(
2200 _In_reads_(trianglesCount) CONST D2D1_TRIANGLE *triangles,
2201 UINT32 trianglesCount
2202 ) PURE;
2203
2204 STDMETHOD(Close)(
2205 ) PURE;
2206 }; // interface ID2D1TessellationSink
2207
2208 /// <summary>
2209 /// Represents a complex shape that may be composed of arcs, curves, and lines.
2210 /// </summary>
2211 interface DX_DECLARE_INTERFACE("2cd906a5-12e2-11dc-9fed-001143a055f9") ID2D1PathGeometry : public ID2D1Geometry
2212 {
2213
2214 /// <summary>
2215 /// Opens a geometry sink that will be used to create this path geometry.
2216 /// </summary>
2217 STDMETHOD(Open)(
2218 _COM_Outptr_ ID2D1GeometrySink **geometrySink
2219 ) PURE;
2220
2221 /// <summary>
2222 /// Retrieve the contents of this geometry. The caller passes an implementation of a
2223 /// ID2D1GeometrySink interface to receive the data.
2224 /// </summary>
2225 STDMETHOD(Stream)(
2226 _In_ ID2D1GeometrySink *geometrySink
2227 ) CONST PURE;
2228
2229 STDMETHOD(GetSegmentCount)(
2230 _Out_ UINT32 *count
2231 ) CONST PURE;
2232
2233 STDMETHOD(GetFigureCount)(
2234 _Out_ UINT32 *count
2235 ) CONST PURE;
2236 }; // interface ID2D1PathGeometry
2237
2238 /// <summary>
2239 /// Represents a set of vertices that form a list of triangles.
2240 /// </summary>
2241 interface DX_DECLARE_INTERFACE("2cd906c2-12e2-11dc-9fed-001143a055f9") ID2D1Mesh : public ID2D1Resource
2242 {
2243
2244 /// <summary>
2245 /// Opens the mesh for population.
2246 /// </summary>
2247 STDMETHOD(Open)(
2248 _COM_Outptr_ ID2D1TessellationSink **tessellationSink
2249 ) PURE;
2250 }; // interface ID2D1Mesh
2251
2252 /// <summary>
2253 /// Represents the backing store required to render a layer.
2254 /// </summary>
2255 interface DX_DECLARE_INTERFACE("2cd9069b-12e2-11dc-9fed-001143a055f9") ID2D1Layer : public ID2D1Resource
2256 {
2257
2258 STDMETHOD_(D2D1_SIZE_F, GetSize)(
2259 ) CONST PURE;
2260 }; // interface ID2D1Layer
2261
2262 /// <summary>
2263 /// Represents the drawing state of a render target: the antialiasing mode,
2264 /// transform, tags, and text-rendering options.
2265 /// </summary>
2266 interface DX_DECLARE_INTERFACE("28506e39-ebf6-46a1-bb47-fd85565ab957") ID2D1DrawingStateBlock : public ID2D1Resource
2267 {
2268
2269 /// <summary>
2270 /// Retrieves the state currently contained within this state block resource.
2271 /// </summary>
2272 STDMETHOD_(void, GetDescription)(
2273 _Out_ D2D1_DRAWING_STATE_DESCRIPTION *stateDescription
2274 ) CONST PURE;
2275
2276 /// <summary>
2277 /// Sets the state description of this state block resource.
2278 /// </summary>
2279 STDMETHOD_(void, SetDescription)(
2280 _In_ CONST D2D1_DRAWING_STATE_DESCRIPTION *stateDescription
2281 ) PURE;
2282
2283 /// <summary>
2284 /// Sets the text rendering parameters of this state block resource.
2285 /// </summary>
2286 STDMETHOD_(void, SetTextRenderingParams)(
2287 _In_opt_ IDWriteRenderingParams *textRenderingParams = NULL
2288 ) PURE;
2289
2290 /// <summary>
2291 /// Retrieves the text rendering parameters contained within this state block
2292 /// resource. If a NULL text rendering parameter was specified, NULL will be
2293 /// returned.
2294 /// </summary>
2295 STDMETHOD_(void, GetTextRenderingParams)(
2296 _Outptr_result_maybenull_ IDWriteRenderingParams **textRenderingParams
2297 ) CONST PURE;
2298
2299 COM_DECLSPEC_NOTHROW
2300 void
SetDescription(CONST D2D1_DRAWING_STATE_DESCRIPTION & stateDescription)2301 SetDescription(
2302 CONST D2D1_DRAWING_STATE_DESCRIPTION &stateDescription
2303 )
2304 {
2305 SetDescription(&stateDescription);
2306 }
2307 }; // interface ID2D1DrawingStateBlock
2308
2309 /// <summary>
2310 /// Represents an object that can receive drawing commands. Interfaces that inherit
2311 /// from ID2D1RenderTarget render the drawing commands they receive in different
2312 /// ways.
2313 /// </summary>
2314 interface DX_DECLARE_INTERFACE("2cd90694-12e2-11dc-9fed-001143a055f9") ID2D1RenderTarget : public ID2D1Resource
2315 {
2316
2317 /// <summary>
2318 /// Create a D2D bitmap by copying from memory, or create uninitialized.
2319 /// </summary>
2320 STDMETHOD(CreateBitmap)(
2321 D2D1_SIZE_U size,
2322 _In_opt_ CONST void *srcData,
2323 UINT32 pitch,
2324 _In_ CONST D2D1_BITMAP_PROPERTIES *bitmapProperties,
2325 _COM_Outptr_ ID2D1Bitmap **bitmap
2326 ) PURE;
2327
2328 /// <summary>
2329 /// Create a D2D bitmap by copying a WIC bitmap.
2330 /// </summary>
2331 STDMETHOD(CreateBitmapFromWicBitmap)(
2332 _In_ IWICBitmapSource *wicBitmapSource,
2333 _In_opt_ CONST D2D1_BITMAP_PROPERTIES *bitmapProperties,
2334 _COM_Outptr_ ID2D1Bitmap **bitmap
2335 ) PURE;
2336
2337 /// <summary>
2338 /// Create a D2D bitmap by sharing bits from another resource. The bitmap must be
2339 /// compatible with the render target for the call to succeed. For example, an
2340 /// IWICBitmap can be shared with a software target, or a DXGI surface can be shared
2341 /// with a DXGI render target.
2342 /// </summary>
2343 STDMETHOD(CreateSharedBitmap)(
2344 _In_ REFIID riid,
2345 _Inout_ void *data,
2346 _In_opt_ CONST D2D1_BITMAP_PROPERTIES *bitmapProperties,
2347 _COM_Outptr_ ID2D1Bitmap **bitmap
2348 ) PURE;
2349
2350 /// <summary>
2351 /// Creates a bitmap brush. The bitmap is scaled, rotated, skewed or tiled to fill
2352 /// or pen a geometry.
2353 /// </summary>
2354 STDMETHOD(CreateBitmapBrush)(
2355 _In_opt_ ID2D1Bitmap *bitmap,
2356 _In_opt_ CONST D2D1_BITMAP_BRUSH_PROPERTIES *bitmapBrushProperties,
2357 _In_opt_ CONST D2D1_BRUSH_PROPERTIES *brushProperties,
2358 _COM_Outptr_ ID2D1BitmapBrush **bitmapBrush
2359 ) PURE;
2360
2361 STDMETHOD(CreateSolidColorBrush)(
2362 _In_ CONST D2D1_COLOR_F *color,
2363 _In_opt_ CONST D2D1_BRUSH_PROPERTIES *brushProperties,
2364 _COM_Outptr_ ID2D1SolidColorBrush **solidColorBrush
2365 ) PURE;
2366
2367 /// <summary>
2368 /// A gradient stop collection represents a set of stops in an ideal unit length.
2369 /// This is the source resource for a linear gradient and radial gradient brush.
2370 /// </summary>
2371 /// <param name="colorInterpolationGamma">Specifies which space the color
2372 /// interpolation occurs in.</param>
2373 /// <param name="extendMode">Specifies how the gradient will be extended outside of
2374 /// the unit length.</param>
2375 STDMETHOD(CreateGradientStopCollection)(
2376 _In_reads_(gradientStopsCount) CONST D2D1_GRADIENT_STOP *gradientStops,
2377 _In_range_(>=,1) UINT32 gradientStopsCount,
2378 D2D1_GAMMA colorInterpolationGamma,
2379 D2D1_EXTEND_MODE extendMode,
2380 _COM_Outptr_ ID2D1GradientStopCollection **gradientStopCollection
2381 ) PURE;
2382
2383 STDMETHOD(CreateLinearGradientBrush)(
2384 _In_ CONST D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES *linearGradientBrushProperties,
2385 _In_opt_ CONST D2D1_BRUSH_PROPERTIES *brushProperties,
2386 _In_ ID2D1GradientStopCollection *gradientStopCollection,
2387 _COM_Outptr_ ID2D1LinearGradientBrush **linearGradientBrush
2388 ) PURE;
2389
2390 STDMETHOD(CreateRadialGradientBrush)(
2391 _In_ CONST D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES *radialGradientBrushProperties,
2392 _In_opt_ CONST D2D1_BRUSH_PROPERTIES *brushProperties,
2393 _In_ ID2D1GradientStopCollection *gradientStopCollection,
2394 _COM_Outptr_ ID2D1RadialGradientBrush **radialGradientBrush
2395 ) PURE;
2396
2397 /// <summary>
2398 /// Creates a bitmap render target whose bitmap can be used as a source for
2399 /// rendering in the API.
2400 /// </summary>
2401 /// <param name="desiredSize">The requested size of the target in DIPs. If the pixel
2402 /// size is not specified, the DPI is inherited from the parent target. However, the
2403 /// render target will never contain a fractional number of pixels.</param>
2404 /// <param name="desiredPixelSize">The requested size of the render target in
2405 /// pixels. If the DIP size is also specified, the DPI is calculated from these two
2406 /// values. If the desired size is not specified, the DPI is inherited from the
2407 /// parent render target. If neither value is specified, the compatible render
2408 /// target will be the same size and have the same DPI as the parent target.</param>
2409 /// <param name="desiredFormat">The desired pixel format. The format must be
2410 /// compatible with the parent render target type. If the format is not specified,
2411 /// it will be inherited from the parent render target.</param>
2412 /// <param name="options">Allows the caller to retrieve a GDI compatible render
2413 /// target.</param>
2414 /// <param name="bitmapRenderTarget">The returned bitmap render target.</param>
2415 STDMETHOD(CreateCompatibleRenderTarget)(
2416 _In_opt_ CONST D2D1_SIZE_F *desiredSize,
2417 _In_opt_ CONST D2D1_SIZE_U *desiredPixelSize,
2418 _In_opt_ CONST D2D1_PIXEL_FORMAT *desiredFormat,
2419 D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS options,
2420 _COM_Outptr_ ID2D1BitmapRenderTarget **bitmapRenderTarget
2421 ) PURE;
2422
2423 /// <summary>
2424 /// Creates a layer resource that can be used on any target and which will resize
2425 /// under the covers if necessary.
2426 /// </summary>
2427 /// <param name="size">The resolution independent minimum size hint for the layer
2428 /// resource. Specify this to prevent unwanted reallocation of the layer backing
2429 /// store. The size is in DIPs, but, it is unaffected by the current world
2430 /// transform. If the size is unspecified, the returned resource is a placeholder
2431 /// and the backing store will be allocated to be the minimum size that can hold the
2432 /// content when the layer is pushed.</param>
2433 STDMETHOD(CreateLayer)(
2434 _In_opt_ CONST D2D1_SIZE_F *size,
2435 _COM_Outptr_ ID2D1Layer **layer
2436 ) PURE;
2437
2438 /// <summary>
2439 /// Create a D2D mesh.
2440 /// </summary>
2441 STDMETHOD(CreateMesh)(
2442 _COM_Outptr_ ID2D1Mesh **mesh
2443 ) PURE;
2444
2445 STDMETHOD_(void, DrawLine)(
2446 D2D1_POINT_2F point0,
2447 D2D1_POINT_2F point1,
2448 _In_ ID2D1Brush *brush,
2449 FLOAT strokeWidth = 1.0f,
2450 _In_opt_ ID2D1StrokeStyle *strokeStyle = NULL
2451 ) PURE;
2452
2453 STDMETHOD_(void, DrawRectangle)(
2454 _In_ CONST D2D1_RECT_F *rect,
2455 _In_ ID2D1Brush *brush,
2456 FLOAT strokeWidth = 1.0f,
2457 _In_opt_ ID2D1StrokeStyle *strokeStyle = NULL
2458 ) PURE;
2459
2460 STDMETHOD_(void, FillRectangle)(
2461 _In_ CONST D2D1_RECT_F *rect,
2462 _In_ ID2D1Brush *brush
2463 ) PURE;
2464
2465 STDMETHOD_(void, DrawRoundedRectangle)(
2466 _In_ CONST D2D1_ROUNDED_RECT *roundedRect,
2467 _In_ ID2D1Brush *brush,
2468 FLOAT strokeWidth = 1.0f,
2469 _In_opt_ ID2D1StrokeStyle *strokeStyle = NULL
2470 ) PURE;
2471
2472 STDMETHOD_(void, FillRoundedRectangle)(
2473 _In_ CONST D2D1_ROUNDED_RECT *roundedRect,
2474 _In_ ID2D1Brush *brush
2475 ) PURE;
2476
2477 STDMETHOD_(void, DrawEllipse)(
2478 _In_ CONST D2D1_ELLIPSE *ellipse,
2479 _In_ ID2D1Brush *brush,
2480 FLOAT strokeWidth = 1.0f,
2481 _In_opt_ ID2D1StrokeStyle *strokeStyle = NULL
2482 ) PURE;
2483
2484 STDMETHOD_(void, FillEllipse)(
2485 _In_ CONST D2D1_ELLIPSE *ellipse,
2486 _In_ ID2D1Brush *brush
2487 ) PURE;
2488
2489 STDMETHOD_(void, DrawGeometry)(
2490 _In_ ID2D1Geometry *geometry,
2491 _In_ ID2D1Brush *brush,
2492 FLOAT strokeWidth = 1.0f,
2493 _In_opt_ ID2D1StrokeStyle *strokeStyle = NULL
2494 ) PURE;
2495
2496 /// <param name="opacityBrush">An optionally specified opacity brush. Only the alpha
2497 /// channel of the corresponding brush will be sampled and will be applied to the
2498 /// entire fill of the geometry. If this brush is specified, the fill brush must be
2499 /// a bitmap brush with an extend mode of D2D1_EXTEND_MODE_CLAMP.</param>
2500 STDMETHOD_(void, FillGeometry)(
2501 _In_ ID2D1Geometry *geometry,
2502 _In_ ID2D1Brush *brush,
2503 _In_opt_ ID2D1Brush *opacityBrush = NULL
2504 ) PURE;
2505
2506 /// <summary>
2507 /// Fill a mesh. Since meshes can only render aliased content, the render target
2508 /// antialiasing mode must be set to aliased.
2509 /// </summary>
2510 STDMETHOD_(void, FillMesh)(
2511 _In_ ID2D1Mesh *mesh,
2512 _In_ ID2D1Brush *brush
2513 ) PURE;
2514
2515 /// <summary>
2516 /// Fill using the alpha channel of the supplied opacity mask bitmap. The brush
2517 /// opacity will be modulated by the mask. The render target antialiasing mode must
2518 /// be set to aliased.
2519 /// </summary>
2520 STDMETHOD_(void, FillOpacityMask)(
2521 _In_ ID2D1Bitmap *opacityMask,
2522 _In_ ID2D1Brush *brush,
2523 D2D1_OPACITY_MASK_CONTENT content,
2524 _In_opt_ CONST D2D1_RECT_F *destinationRectangle = NULL,
2525 _In_opt_ CONST D2D1_RECT_F *sourceRectangle = NULL
2526 ) PURE;
2527
2528 STDMETHOD_(void, DrawBitmap)(
2529 _In_ ID2D1Bitmap *bitmap,
2530 _In_opt_ CONST D2D1_RECT_F *destinationRectangle = NULL,
2531 FLOAT opacity = 1.0f,
2532 D2D1_BITMAP_INTERPOLATION_MODE interpolationMode = D2D1_BITMAP_INTERPOLATION_MODE_LINEAR,
2533 _In_opt_ CONST D2D1_RECT_F *sourceRectangle = NULL
2534 ) PURE;
2535
2536 /// <summary>
2537 /// Draws the text within the given layout rectangle and by default also performs
2538 /// baseline snapping.
2539 /// </summary>
2540 STDMETHOD_(void, DrawText)(
2541 _In_reads_(stringLength) CONST WCHAR *string,
2542 UINT32 stringLength,
2543 _In_ IDWriteTextFormat *textFormat,
2544 _In_ CONST D2D1_RECT_F *layoutRect,
2545 _In_ ID2D1Brush *defaultFillBrush,
2546 D2D1_DRAW_TEXT_OPTIONS options = D2D1_DRAW_TEXT_OPTIONS_NONE,
2547 DWRITE_MEASURING_MODE measuringMode = DWRITE_MEASURING_MODE_NATURAL
2548 ) PURE;
2549
2550 /// <summary>
2551 /// Draw a text layout object. If the layout is not subsequently changed, this can
2552 /// be more efficient than DrawText when drawing the same layout repeatedly.
2553 /// </summary>
2554 /// <param name="options">The specified text options. If D2D1_DRAW_TEXT_OPTIONS_CLIP
2555 /// is used, the text is clipped to the layout bounds. These bounds are derived from
2556 /// the origin and the layout bounds of the corresponding IDWriteTextLayout object.
2557 /// </param>
2558 STDMETHOD_(void, DrawTextLayout)(
2559 D2D1_POINT_2F origin,
2560 _In_ IDWriteTextLayout *textLayout,
2561 _In_ ID2D1Brush *defaultFillBrush,
2562 D2D1_DRAW_TEXT_OPTIONS options = D2D1_DRAW_TEXT_OPTIONS_NONE
2563 ) PURE;
2564
2565 STDMETHOD_(void, DrawGlyphRun)(
2566 D2D1_POINT_2F baselineOrigin,
2567 _In_ CONST DWRITE_GLYPH_RUN *glyphRun,
2568 _In_ ID2D1Brush *foregroundBrush,
2569 DWRITE_MEASURING_MODE measuringMode = DWRITE_MEASURING_MODE_NATURAL
2570 ) PURE;
2571
2572 STDMETHOD_(void, SetTransform)(
2573 _In_ CONST D2D1_MATRIX_3X2_F *transform
2574 ) PURE;
2575
2576 STDMETHOD_(void, GetTransform)(
2577 _Out_ D2D1_MATRIX_3X2_F *transform
2578 ) CONST PURE;
2579
2580 STDMETHOD_(void, SetAntialiasMode)(
2581 D2D1_ANTIALIAS_MODE antialiasMode
2582 ) PURE;
2583
2584 STDMETHOD_(D2D1_ANTIALIAS_MODE, GetAntialiasMode)(
2585 ) CONST PURE;
2586
2587 STDMETHOD_(void, SetTextAntialiasMode)(
2588 D2D1_TEXT_ANTIALIAS_MODE textAntialiasMode
2589 ) PURE;
2590
2591 STDMETHOD_(D2D1_TEXT_ANTIALIAS_MODE, GetTextAntialiasMode)(
2592 ) CONST PURE;
2593
2594 STDMETHOD_(void, SetTextRenderingParams)(
2595 _In_opt_ IDWriteRenderingParams *textRenderingParams = NULL
2596 ) PURE;
2597
2598 /// <summary>
2599 /// Retrieve the text render parameters. NOTE: If NULL is specified to
2600 /// SetTextRenderingParameters, NULL will be returned.
2601 /// </summary>
2602 STDMETHOD_(void, GetTextRenderingParams)(
2603 _Outptr_result_maybenull_ IDWriteRenderingParams **textRenderingParams
2604 ) CONST PURE;
2605
2606 /// <summary>
2607 /// Set a tag to correspond to the succeeding primitives. If an error occurs
2608 /// rendering a primitive, the tags can be returned from the Flush or EndDraw call.
2609 /// </summary>
2610 STDMETHOD_(void, SetTags)(
2611 D2D1_TAG tag1,
2612 D2D1_TAG tag2
2613 ) PURE;
2614
2615 /// <summary>
2616 /// Retrieves the currently set tags. This does not retrieve the tags corresponding
2617 /// to any primitive that is in error.
2618 /// </summary>
2619 STDMETHOD_(void, GetTags)(
2620 _Out_opt_ D2D1_TAG *tag1 = NULL,
2621 _Out_opt_ D2D1_TAG *tag2 = NULL
2622 ) CONST PURE;
2623
2624 /// <summary>
2625 /// Start a layer of drawing calls. The way in which the layer must be resolved is
2626 /// specified first as well as the logical resource that stores the layer
2627 /// parameters. The supplied layer resource might grow if the specified content
2628 /// cannot fit inside it. The layer will grow monotonically on each axis. If a NULL
2629 /// ID2D1Layer is provided, then a layer resource will be allocated automatically.
2630 /// </summary>
2631 STDMETHOD_(void, PushLayer)(
2632 _In_ CONST D2D1_LAYER_PARAMETERS *layerParameters,
2633 _In_opt_ ID2D1Layer *layer
2634 ) PURE;
2635
2636 /// <summary>
2637 /// Ends a layer that was defined with particular layer resources.
2638 /// </summary>
2639 STDMETHOD_(void, PopLayer)(
2640 ) PURE;
2641
2642 STDMETHOD(Flush)(
2643 _Out_opt_ D2D1_TAG *tag1 = NULL,
2644 _Out_opt_ D2D1_TAG *tag2 = NULL
2645 ) PURE;
2646
2647 /// <summary>
2648 /// Gets the current drawing state and saves it into the supplied
2649 /// IDrawingStatckBlock.
2650 /// </summary>
2651 STDMETHOD_(void, SaveDrawingState)(
2652 _Inout_ ID2D1DrawingStateBlock *drawingStateBlock
2653 ) CONST PURE;
2654
2655 /// <summary>
2656 /// Copies the state stored in the block interface.
2657 /// </summary>
2658 STDMETHOD_(void, RestoreDrawingState)(
2659 _In_ ID2D1DrawingStateBlock *drawingStateBlock
2660 ) PURE;
2661
2662 /// <summary>
2663 /// Pushes a clip. The clip can be antialiased. The clip must be axis aligned. If
2664 /// the current world transform is not axis preserving, then the bounding box of the
2665 /// transformed clip rect will be used. The clip will remain in effect until a
2666 /// PopAxisAligned clip call is made.
2667 /// </summary>
2668 STDMETHOD_(void, PushAxisAlignedClip)(
2669 _In_ CONST D2D1_RECT_F *clipRect,
2670 D2D1_ANTIALIAS_MODE antialiasMode
2671 ) PURE;
2672
2673 STDMETHOD_(void, PopAxisAlignedClip)(
2674 ) PURE;
2675
2676 STDMETHOD_(void, Clear)(
2677 _In_opt_ CONST D2D1_COLOR_F *clearColor = NULL
2678 ) PURE;
2679
2680 /// <summary>
2681 /// Start drawing on this render target. Draw calls can only be issued between a
2682 /// BeginDraw and EndDraw call.
2683 /// </summary>
2684 STDMETHOD_(void, BeginDraw)(
2685 ) PURE;
2686
2687 /// <summary>
2688 /// Ends drawing on the render target, error results can be retrieved at this time,
2689 /// or when calling flush.
2690 /// </summary>
2691 STDMETHOD(EndDraw)(
2692 _Out_opt_ D2D1_TAG *tag1 = NULL,
2693 _Out_opt_ D2D1_TAG *tag2 = NULL
2694 ) PURE;
2695
2696 STDMETHOD_(D2D1_PIXEL_FORMAT, GetPixelFormat)(
2697 ) CONST PURE;
2698
2699 /// <summary>
2700 /// Sets the DPI on the render target. This results in the render target being
2701 /// interpreted to a different scale. Neither DPI can be negative. If zero is
2702 /// specified for both, the system DPI is chosen. If one is zero and the other
2703 /// unspecified, the DPI is not changed.
2704 /// </summary>
2705 STDMETHOD_(void, SetDpi)(
2706 FLOAT dpiX,
2707 FLOAT dpiY
2708 ) PURE;
2709
2710 /// <summary>
2711 /// Return the current DPI from the target.
2712 /// </summary>
2713 STDMETHOD_(void, GetDpi)(
2714 _Out_ FLOAT *dpiX,
2715 _Out_ FLOAT *dpiY
2716 ) CONST PURE;
2717
2718 /// <summary>
2719 /// Returns the size of the render target in DIPs.
2720 /// </summary>
2721 STDMETHOD_(D2D1_SIZE_F, GetSize)(
2722 ) CONST PURE;
2723
2724 /// <summary>
2725 /// Returns the size of the render target in pixels.
2726 /// </summary>
2727 STDMETHOD_(D2D1_SIZE_U, GetPixelSize)(
2728 ) CONST PURE;
2729
2730 /// <summary>
2731 /// Returns the maximum bitmap and render target size that is guaranteed to be
2732 /// supported by the render target.
2733 /// </summary>
2734 STDMETHOD_(UINT32, GetMaximumBitmapSize)(
2735 ) CONST PURE;
2736
2737 /// <summary>
2738 /// Returns true if the given properties are supported by this render target. The
2739 /// DPI is ignored. NOTE: If the render target type is software, then neither
2740 /// D2D1_FEATURE_LEVEL_9 nor D2D1_FEATURE_LEVEL_10 will be considered to be
2741 /// supported.
2742 /// </summary>
2743 STDMETHOD_(BOOL, IsSupported)(
2744 _In_ CONST D2D1_RENDER_TARGET_PROPERTIES *renderTargetProperties
2745 ) CONST PURE;
2746
2747 COM_DECLSPEC_NOTHROW
2748 HRESULT
CreateBitmap(D2D1_SIZE_U size,_In_opt_ CONST void * srcData,UINT32 pitch,CONST D2D1_BITMAP_PROPERTIES & bitmapProperties,_COM_Outptr_ ID2D1Bitmap ** bitmap)2749 CreateBitmap(
2750 D2D1_SIZE_U size,
2751 _In_opt_ CONST void *srcData,
2752 UINT32 pitch,
2753 CONST D2D1_BITMAP_PROPERTIES &bitmapProperties,
2754 _COM_Outptr_ ID2D1Bitmap **bitmap
2755 )
2756 {
2757 return CreateBitmap(size, srcData, pitch, &bitmapProperties, bitmap);
2758 }
2759
2760 COM_DECLSPEC_NOTHROW
2761 HRESULT
CreateBitmap(D2D1_SIZE_U size,CONST D2D1_BITMAP_PROPERTIES & bitmapProperties,_COM_Outptr_ ID2D1Bitmap ** bitmap)2762 CreateBitmap(
2763 D2D1_SIZE_U size,
2764 CONST D2D1_BITMAP_PROPERTIES &bitmapProperties,
2765 _COM_Outptr_ ID2D1Bitmap **bitmap
2766 )
2767 {
2768 return CreateBitmap(size, NULL, 0, &bitmapProperties, bitmap);
2769 }
2770
2771 /// <summary>
2772 /// Create a D2D bitmap by copying a WIC bitmap.
2773 /// </summary>
2774 COM_DECLSPEC_NOTHROW
2775 HRESULT
CreateBitmapFromWicBitmap(_In_ IWICBitmapSource * wicBitmapSource,CONST D2D1_BITMAP_PROPERTIES & bitmapProperties,_COM_Outptr_ ID2D1Bitmap ** bitmap)2776 CreateBitmapFromWicBitmap(
2777 _In_ IWICBitmapSource *wicBitmapSource,
2778 CONST D2D1_BITMAP_PROPERTIES &bitmapProperties,
2779 _COM_Outptr_ ID2D1Bitmap **bitmap
2780 )
2781 {
2782 return CreateBitmapFromWicBitmap(wicBitmapSource, &bitmapProperties, bitmap);
2783 }
2784
2785 /// <summary>
2786 /// Create a D2D bitmap by copying a WIC bitmap.
2787 /// </summary>
2788 COM_DECLSPEC_NOTHROW
2789 HRESULT
CreateBitmapFromWicBitmap(_In_ IWICBitmapSource * wicBitmapSource,_COM_Outptr_ ID2D1Bitmap ** bitmap)2790 CreateBitmapFromWicBitmap(
2791 _In_ IWICBitmapSource *wicBitmapSource,
2792 _COM_Outptr_ ID2D1Bitmap **bitmap
2793 )
2794 {
2795 return CreateBitmapFromWicBitmap(wicBitmapSource, NULL, bitmap);
2796 }
2797
2798 /// <summary>
2799 /// Creates a bitmap brush. The bitmap is scaled, rotated, skewed or tiled to fill
2800 /// or pen a geometry.
2801 /// </summary>
2802 COM_DECLSPEC_NOTHROW
2803 HRESULT
CreateBitmapBrush(_In_opt_ ID2D1Bitmap * bitmap,_COM_Outptr_ ID2D1BitmapBrush ** bitmapBrush)2804 CreateBitmapBrush(
2805 _In_opt_ ID2D1Bitmap *bitmap,
2806 _COM_Outptr_ ID2D1BitmapBrush **bitmapBrush
2807 )
2808 {
2809 return CreateBitmapBrush(bitmap, NULL, NULL, bitmapBrush);
2810 }
2811
2812 /// <summary>
2813 /// Creates a bitmap brush. The bitmap is scaled, rotated, skewed or tiled to fill
2814 /// or pen a geometry.
2815 /// </summary>
2816 COM_DECLSPEC_NOTHROW
2817 HRESULT
CreateBitmapBrush(_In_opt_ ID2D1Bitmap * bitmap,CONST D2D1_BITMAP_BRUSH_PROPERTIES & bitmapBrushProperties,_COM_Outptr_ ID2D1BitmapBrush ** bitmapBrush)2818 CreateBitmapBrush(
2819 _In_opt_ ID2D1Bitmap *bitmap,
2820 CONST D2D1_BITMAP_BRUSH_PROPERTIES &bitmapBrushProperties,
2821 _COM_Outptr_ ID2D1BitmapBrush **bitmapBrush
2822 )
2823 {
2824 return CreateBitmapBrush(bitmap, &bitmapBrushProperties, NULL, bitmapBrush);
2825 }
2826
2827 /// <summary>
2828 /// Creates a bitmap brush. The bitmap is scaled, rotated, skewed or tiled to fill
2829 /// or pen a geometry.
2830 /// </summary>
2831 COM_DECLSPEC_NOTHROW
2832 HRESULT
CreateBitmapBrush(_In_opt_ ID2D1Bitmap * bitmap,CONST D2D1_BITMAP_BRUSH_PROPERTIES & bitmapBrushProperties,CONST D2D1_BRUSH_PROPERTIES & brushProperties,_COM_Outptr_ ID2D1BitmapBrush ** bitmapBrush)2833 CreateBitmapBrush(
2834 _In_opt_ ID2D1Bitmap *bitmap,
2835 CONST D2D1_BITMAP_BRUSH_PROPERTIES &bitmapBrushProperties,
2836 CONST D2D1_BRUSH_PROPERTIES &brushProperties,
2837 _COM_Outptr_ ID2D1BitmapBrush **bitmapBrush
2838 )
2839 {
2840 return CreateBitmapBrush(bitmap, &bitmapBrushProperties, &brushProperties, bitmapBrush);
2841 }
2842
2843 COM_DECLSPEC_NOTHROW
2844 HRESULT
CreateSolidColorBrush(CONST D2D1_COLOR_F & color,_COM_Outptr_ ID2D1SolidColorBrush ** solidColorBrush)2845 CreateSolidColorBrush(
2846 CONST D2D1_COLOR_F &color,
2847 _COM_Outptr_ ID2D1SolidColorBrush **solidColorBrush
2848 )
2849 {
2850 return CreateSolidColorBrush(&color, NULL, solidColorBrush);
2851 }
2852
2853 COM_DECLSPEC_NOTHROW
2854 HRESULT
CreateSolidColorBrush(CONST D2D1_COLOR_F & color,CONST D2D1_BRUSH_PROPERTIES & brushProperties,_COM_Outptr_ ID2D1SolidColorBrush ** solidColorBrush)2855 CreateSolidColorBrush(
2856 CONST D2D1_COLOR_F &color,
2857 CONST D2D1_BRUSH_PROPERTIES &brushProperties,
2858 _COM_Outptr_ ID2D1SolidColorBrush **solidColorBrush
2859 )
2860 {
2861 return CreateSolidColorBrush(&color, &brushProperties, solidColorBrush);
2862 }
2863
2864 COM_DECLSPEC_NOTHROW
2865 HRESULT
CreateGradientStopCollection(_In_reads_ (gradientStopsCount)CONST D2D1_GRADIENT_STOP * gradientStops,UINT32 gradientStopsCount,_COM_Outptr_ ID2D1GradientStopCollection ** gradientStopCollection)2866 CreateGradientStopCollection(
2867 _In_reads_(gradientStopsCount) CONST D2D1_GRADIENT_STOP *gradientStops,
2868 UINT32 gradientStopsCount,
2869 _COM_Outptr_ ID2D1GradientStopCollection **gradientStopCollection
2870 )
2871 {
2872 return CreateGradientStopCollection(gradientStops, gradientStopsCount, D2D1_GAMMA_2_2, D2D1_EXTEND_MODE_CLAMP, gradientStopCollection);
2873 }
2874
2875 COM_DECLSPEC_NOTHROW
2876 HRESULT
CreateLinearGradientBrush(CONST D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES & linearGradientBrushProperties,_In_ ID2D1GradientStopCollection * gradientStopCollection,_COM_Outptr_ ID2D1LinearGradientBrush ** linearGradientBrush)2877 CreateLinearGradientBrush(
2878 CONST D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES &linearGradientBrushProperties,
2879 _In_ ID2D1GradientStopCollection *gradientStopCollection,
2880 _COM_Outptr_ ID2D1LinearGradientBrush **linearGradientBrush
2881 )
2882 {
2883 return CreateLinearGradientBrush(&linearGradientBrushProperties, NULL, gradientStopCollection, linearGradientBrush);
2884 }
2885
2886 COM_DECLSPEC_NOTHROW
2887 HRESULT
CreateLinearGradientBrush(CONST D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES & linearGradientBrushProperties,CONST D2D1_BRUSH_PROPERTIES & brushProperties,_In_ ID2D1GradientStopCollection * gradientStopCollection,_COM_Outptr_ ID2D1LinearGradientBrush ** linearGradientBrush)2888 CreateLinearGradientBrush(
2889 CONST D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES &linearGradientBrushProperties,
2890 CONST D2D1_BRUSH_PROPERTIES &brushProperties,
2891 _In_ ID2D1GradientStopCollection *gradientStopCollection,
2892 _COM_Outptr_ ID2D1LinearGradientBrush **linearGradientBrush
2893 )
2894 {
2895 return CreateLinearGradientBrush(&linearGradientBrushProperties, &brushProperties, gradientStopCollection, linearGradientBrush);
2896 }
2897
2898 COM_DECLSPEC_NOTHROW
2899 HRESULT
CreateRadialGradientBrush(CONST D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES & radialGradientBrushProperties,_In_ ID2D1GradientStopCollection * gradientStopCollection,_COM_Outptr_ ID2D1RadialGradientBrush ** radialGradientBrush)2900 CreateRadialGradientBrush(
2901 CONST D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES &radialGradientBrushProperties,
2902 _In_ ID2D1GradientStopCollection *gradientStopCollection,
2903 _COM_Outptr_ ID2D1RadialGradientBrush **radialGradientBrush
2904 )
2905 {
2906 return CreateRadialGradientBrush(&radialGradientBrushProperties, NULL, gradientStopCollection, radialGradientBrush);
2907 }
2908
2909 COM_DECLSPEC_NOTHROW
2910 HRESULT
CreateRadialGradientBrush(CONST D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES & radialGradientBrushProperties,CONST D2D1_BRUSH_PROPERTIES & brushProperties,_In_ ID2D1GradientStopCollection * gradientStopCollection,_COM_Outptr_ ID2D1RadialGradientBrush ** radialGradientBrush)2911 CreateRadialGradientBrush(
2912 CONST D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES &radialGradientBrushProperties,
2913 CONST D2D1_BRUSH_PROPERTIES &brushProperties,
2914 _In_ ID2D1GradientStopCollection *gradientStopCollection,
2915 _COM_Outptr_ ID2D1RadialGradientBrush **radialGradientBrush
2916 )
2917 {
2918 return CreateRadialGradientBrush(&radialGradientBrushProperties, &brushProperties, gradientStopCollection, radialGradientBrush);
2919 }
2920
2921 COM_DECLSPEC_NOTHROW
2922 HRESULT
CreateCompatibleRenderTarget(_COM_Outptr_ ID2D1BitmapRenderTarget ** bitmapRenderTarget)2923 CreateCompatibleRenderTarget(
2924 _COM_Outptr_ ID2D1BitmapRenderTarget **bitmapRenderTarget
2925 )
2926 {
2927 return CreateCompatibleRenderTarget(NULL, NULL, NULL, D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS_NONE, bitmapRenderTarget);
2928 }
2929
2930 COM_DECLSPEC_NOTHROW
2931 HRESULT
CreateCompatibleRenderTarget(D2D1_SIZE_F desiredSize,_COM_Outptr_ ID2D1BitmapRenderTarget ** bitmapRenderTarget)2932 CreateCompatibleRenderTarget(
2933 D2D1_SIZE_F desiredSize,
2934 _COM_Outptr_ ID2D1BitmapRenderTarget **bitmapRenderTarget
2935 )
2936 {
2937 return CreateCompatibleRenderTarget(&desiredSize, NULL, NULL, D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS_NONE, bitmapRenderTarget);
2938 }
2939
2940 COM_DECLSPEC_NOTHROW
2941 HRESULT
CreateCompatibleRenderTarget(D2D1_SIZE_F desiredSize,D2D1_SIZE_U desiredPixelSize,_COM_Outptr_ ID2D1BitmapRenderTarget ** bitmapRenderTarget)2942 CreateCompatibleRenderTarget(
2943 D2D1_SIZE_F desiredSize,
2944 D2D1_SIZE_U desiredPixelSize,
2945 _COM_Outptr_ ID2D1BitmapRenderTarget **bitmapRenderTarget
2946 )
2947 {
2948 return CreateCompatibleRenderTarget(&desiredSize, &desiredPixelSize, NULL, D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS_NONE, bitmapRenderTarget);
2949 }
2950
2951 COM_DECLSPEC_NOTHROW
2952 HRESULT
CreateCompatibleRenderTarget(D2D1_SIZE_F desiredSize,D2D1_SIZE_U desiredPixelSize,D2D1_PIXEL_FORMAT desiredFormat,_COM_Outptr_ ID2D1BitmapRenderTarget ** bitmapRenderTarget)2953 CreateCompatibleRenderTarget(
2954 D2D1_SIZE_F desiredSize,
2955 D2D1_SIZE_U desiredPixelSize,
2956 D2D1_PIXEL_FORMAT desiredFormat,
2957 _COM_Outptr_ ID2D1BitmapRenderTarget **bitmapRenderTarget
2958 )
2959 {
2960 return CreateCompatibleRenderTarget(&desiredSize, &desiredPixelSize, &desiredFormat, D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS_NONE, bitmapRenderTarget);
2961 }
2962
2963 COM_DECLSPEC_NOTHROW
2964 HRESULT
CreateCompatibleRenderTarget(D2D1_SIZE_F desiredSize,D2D1_SIZE_U desiredPixelSize,D2D1_PIXEL_FORMAT desiredFormat,D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS options,_COM_Outptr_ ID2D1BitmapRenderTarget ** bitmapRenderTarget)2965 CreateCompatibleRenderTarget(
2966 D2D1_SIZE_F desiredSize,
2967 D2D1_SIZE_U desiredPixelSize,
2968 D2D1_PIXEL_FORMAT desiredFormat,
2969 D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS options,
2970 _COM_Outptr_ ID2D1BitmapRenderTarget **bitmapRenderTarget
2971 )
2972 {
2973 return CreateCompatibleRenderTarget(&desiredSize, &desiredPixelSize, &desiredFormat, options, bitmapRenderTarget);
2974 }
2975
2976 COM_DECLSPEC_NOTHROW
2977 HRESULT
CreateLayer(D2D1_SIZE_F size,_COM_Outptr_ ID2D1Layer ** layer)2978 CreateLayer(
2979 D2D1_SIZE_F size,
2980 _COM_Outptr_ ID2D1Layer **layer
2981 )
2982 {
2983 return CreateLayer(&size, layer);
2984 }
2985
2986 COM_DECLSPEC_NOTHROW
2987 HRESULT
CreateLayer(_COM_Outptr_ ID2D1Layer ** layer)2988 CreateLayer(
2989 _COM_Outptr_ ID2D1Layer **layer
2990 )
2991 {
2992 return CreateLayer(NULL, layer);
2993 }
2994
2995 COM_DECLSPEC_NOTHROW
2996 void
2997 DrawRectangle(
2998 CONST D2D1_RECT_F &rect,
2999 _In_ ID2D1Brush *brush,
3000 FLOAT strokeWidth = 1.0f,
3001 _In_opt_ ID2D1StrokeStyle *strokeStyle = NULL
3002 )
3003 {
3004 DrawRectangle(&rect, brush, strokeWidth, strokeStyle);
3005 }
3006
3007 COM_DECLSPEC_NOTHROW
3008 void
FillRectangle(CONST D2D1_RECT_F & rect,_In_ ID2D1Brush * brush)3009 FillRectangle(
3010 CONST D2D1_RECT_F &rect,
3011 _In_ ID2D1Brush *brush
3012 )
3013 {
3014 FillRectangle(&rect, brush);
3015 }
3016
3017 COM_DECLSPEC_NOTHROW
3018 void
3019 DrawRoundedRectangle(
3020 CONST D2D1_ROUNDED_RECT &roundedRect,
3021 _In_ ID2D1Brush *brush,
3022 FLOAT strokeWidth = 1.0f,
3023 _In_opt_ ID2D1StrokeStyle *strokeStyle = NULL
3024 )
3025 {
3026 DrawRoundedRectangle(&roundedRect, brush, strokeWidth, strokeStyle);
3027 }
3028
3029 COM_DECLSPEC_NOTHROW
3030 void
FillRoundedRectangle(CONST D2D1_ROUNDED_RECT & roundedRect,_In_ ID2D1Brush * brush)3031 FillRoundedRectangle(
3032 CONST D2D1_ROUNDED_RECT &roundedRect,
3033 _In_ ID2D1Brush *brush
3034 )
3035 {
3036 FillRoundedRectangle(&roundedRect, brush);
3037 }
3038
3039 COM_DECLSPEC_NOTHROW
3040 void
3041 DrawEllipse(
3042 CONST D2D1_ELLIPSE &ellipse,
3043 _In_ ID2D1Brush *brush,
3044 FLOAT strokeWidth = 1.0f,
3045 _In_opt_ ID2D1StrokeStyle *strokeStyle = NULL
3046 )
3047 {
3048 DrawEllipse(&ellipse, brush, strokeWidth, strokeStyle);
3049 }
3050
3051 COM_DECLSPEC_NOTHROW
3052 void
FillEllipse(CONST D2D1_ELLIPSE & ellipse,_In_ ID2D1Brush * brush)3053 FillEllipse(
3054 CONST D2D1_ELLIPSE &ellipse,
3055 _In_ ID2D1Brush *brush
3056 )
3057 {
3058 FillEllipse(&ellipse, brush);
3059 }
3060
3061 COM_DECLSPEC_NOTHROW
3062 void
FillOpacityMask(_In_ ID2D1Bitmap * opacityMask,_In_ ID2D1Brush * brush,D2D1_OPACITY_MASK_CONTENT content,CONST D2D1_RECT_F & destinationRectangle,CONST D2D1_RECT_F & sourceRectangle)3063 FillOpacityMask(
3064 _In_ ID2D1Bitmap *opacityMask,
3065 _In_ ID2D1Brush *brush,
3066 D2D1_OPACITY_MASK_CONTENT content,
3067 CONST D2D1_RECT_F &destinationRectangle,
3068 CONST D2D1_RECT_F &sourceRectangle
3069 )
3070 {
3071 FillOpacityMask(opacityMask, brush, content, &destinationRectangle, &sourceRectangle);
3072 }
3073
3074 COM_DECLSPEC_NOTHROW
3075 void
3076 DrawBitmap(
3077 _In_ ID2D1Bitmap *bitmap,
3078 CONST D2D1_RECT_F &destinationRectangle,
3079 FLOAT opacity = 1.0f,
3080 D2D1_BITMAP_INTERPOLATION_MODE interpolationMode = D2D1_BITMAP_INTERPOLATION_MODE_LINEAR,
3081 _In_opt_ CONST D2D1_RECT_F *sourceRectangle = NULL
3082 )
3083 {
3084 DrawBitmap(bitmap, &destinationRectangle, opacity, interpolationMode, sourceRectangle);
3085 }
3086
3087 COM_DECLSPEC_NOTHROW
3088 void
DrawBitmap(_In_ ID2D1Bitmap * bitmap,CONST D2D1_RECT_F & destinationRectangle,FLOAT opacity,D2D1_BITMAP_INTERPOLATION_MODE interpolationMode,CONST D2D1_RECT_F & sourceRectangle)3089 DrawBitmap(
3090 _In_ ID2D1Bitmap *bitmap,
3091 CONST D2D1_RECT_F &destinationRectangle,
3092 FLOAT opacity,
3093 D2D1_BITMAP_INTERPOLATION_MODE interpolationMode,
3094 CONST D2D1_RECT_F &sourceRectangle
3095 )
3096 {
3097 DrawBitmap(bitmap, &destinationRectangle, opacity, interpolationMode, &sourceRectangle);
3098 }
3099
3100 COM_DECLSPEC_NOTHROW
3101 void
SetTransform(CONST D2D1_MATRIX_3X2_F & transform)3102 SetTransform(
3103 CONST D2D1_MATRIX_3X2_F &transform
3104 )
3105 {
3106 SetTransform(&transform);
3107 }
3108
3109 COM_DECLSPEC_NOTHROW
3110 void
PushLayer(CONST D2D1_LAYER_PARAMETERS & layerParameters,_In_opt_ ID2D1Layer * layer)3111 PushLayer(
3112 CONST D2D1_LAYER_PARAMETERS &layerParameters,
3113 _In_opt_ ID2D1Layer *layer
3114 )
3115 {
3116 PushLayer(&layerParameters, layer);
3117 }
3118
3119 COM_DECLSPEC_NOTHROW
3120 void
PushAxisAlignedClip(CONST D2D1_RECT_F & clipRect,D2D1_ANTIALIAS_MODE antialiasMode)3121 PushAxisAlignedClip(
3122 CONST D2D1_RECT_F &clipRect,
3123 D2D1_ANTIALIAS_MODE antialiasMode
3124 )
3125 {
3126 return PushAxisAlignedClip(&clipRect, antialiasMode);
3127 }
3128
3129 COM_DECLSPEC_NOTHROW
3130 void
Clear(CONST D2D1_COLOR_F & clearColor)3131 Clear(
3132 CONST D2D1_COLOR_F &clearColor
3133 )
3134 {
3135 return Clear(&clearColor);
3136 }
3137
3138 /// <summary>
3139 /// Draws the text within the given layout rectangle and by default also performs
3140 /// baseline snapping.
3141 /// </summary>
3142 COM_DECLSPEC_NOTHROW
3143 void
3144 DrawText(
_In_reads_(stringLength)3145 _In_reads_(stringLength) CONST WCHAR *string,
3146 UINT32 stringLength,
3147 _In_ IDWriteTextFormat *textFormat,
3148 CONST D2D1_RECT_F &layoutRect,
3149 _In_ ID2D1Brush *defaultFillBrush,
3150 D2D1_DRAW_TEXT_OPTIONS options = D2D1_DRAW_TEXT_OPTIONS_NONE,
3151 DWRITE_MEASURING_MODE measuringMode = DWRITE_MEASURING_MODE_NATURAL
3152 )
3153 {
3154 return DrawText(string, stringLength, textFormat, &layoutRect, defaultFillBrush, options, measuringMode);
3155 }
3156
3157 COM_DECLSPEC_NOTHROW
3158 BOOL
IsSupported(CONST D2D1_RENDER_TARGET_PROPERTIES & renderTargetProperties)3159 IsSupported(
3160 CONST D2D1_RENDER_TARGET_PROPERTIES &renderTargetProperties
3161 ) CONST
3162 {
3163 return IsSupported(&renderTargetProperties);
3164 }
3165 }; // interface ID2D1RenderTarget
3166
3167 /// <summary>
3168 /// Renders to an intermediate texture created by the CreateCompatibleRenderTarget
3169 /// method.
3170 /// </summary>
3171 interface DX_DECLARE_INTERFACE("2cd90695-12e2-11dc-9fed-001143a055f9") ID2D1BitmapRenderTarget : public ID2D1RenderTarget
3172 {
3173
3174 STDMETHOD(GetBitmap)(
3175 _COM_Outptr_ ID2D1Bitmap **bitmap
3176 ) PURE;
3177 }; // interface ID2D1BitmapRenderTarget
3178
3179 /// <summary>
3180 /// Renders drawing instructions to a window.
3181 /// </summary>
3182 interface DX_DECLARE_INTERFACE("2cd90698-12e2-11dc-9fed-001143a055f9") ID2D1HwndRenderTarget : public ID2D1RenderTarget
3183 {
3184
3185 STDMETHOD_(D2D1_WINDOW_STATE, CheckWindowState)(
3186 ) PURE;
3187
3188 /// <summary>
3189 /// Resize the buffer underlying the render target. This operation might fail if
3190 /// there is insufficient video memory or system memory, or if the render target is
3191 /// resized beyond the maximum bitmap size. If the method fails, the render target
3192 /// will be placed in a zombie state and D2DERR_RECREATE_TARGET will be returned
3193 /// from it when EndDraw is called. In addition an appropriate failure result will
3194 /// be returned from Resize.
3195 /// </summary>
3196 STDMETHOD(Resize)(
3197 _In_ CONST D2D1_SIZE_U *pixelSize
3198 ) PURE;
3199
3200 STDMETHOD_(HWND, GetHwnd)(
3201 ) CONST PURE;
3202
3203 COM_DECLSPEC_NOTHROW
3204 HRESULT
Resize(CONST D2D1_SIZE_U & pixelSize)3205 Resize(
3206 CONST D2D1_SIZE_U &pixelSize
3207 )
3208 {
3209 return Resize(&pixelSize);
3210 }
3211 }; // interface ID2D1HwndRenderTarget
3212
3213 /*#endif*/ /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) */
3214 /*#pragma endregion*/
3215
3216 /*#pragma region Desktop Family*/
3217 /*#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)*/
3218
3219 /// <summary>
3220 /// Provides access to an device context that can accept GDI drawing commands.
3221 /// </summary>
3222 interface DX_DECLARE_INTERFACE("e0db51c3-6f77-4bae-b3d5-e47509b35838") ID2D1GdiInteropRenderTarget : public IUnknown
3223 {
3224
3225 STDMETHOD(GetDC)(
3226 D2D1_DC_INITIALIZE_MODE mode,
3227 _Out_ HDC *hdc
3228 ) PURE;
3229
3230 STDMETHOD(ReleaseDC)(
3231 _In_opt_ CONST RECT *update
3232 ) PURE;
3233 }; // interface ID2D1GdiInteropRenderTarget
3234
3235 /*#endif*/ /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) */
3236 /*#pragma endregion*/
3237
3238 /*#pragma region Application Family*/
3239 /*#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)*/
3240
3241 /// <summary>
3242 /// Issues drawing commands to a GDI device context.
3243 /// </summary>
3244 interface DX_DECLARE_INTERFACE("1c51bc64-de61-46fd-9899-63a5d8f03950") ID2D1DCRenderTarget : public ID2D1RenderTarget
3245 {
3246
3247 STDMETHOD(BindDC)(
3248 _In_ CONST HDC hDC,
3249 _In_ CONST RECT *pSubRect
3250 ) PURE;
3251 }; // interface ID2D1DCRenderTarget
3252
3253 /// <summary>
3254 /// The root factory interface for all of D2D's objects.
3255 /// </summary>
3256 interface DX_DECLARE_INTERFACE("06152247-6f50-465a-9245-118bfd3b6007") ID2D1Factory : public IUnknown
3257 {
3258
3259 /// <summary>
3260 /// Cause the factory to refresh any system metrics that it might have been snapped
3261 /// on factory creation.
3262 /// </summary>
3263 STDMETHOD(ReloadSystemMetrics)(
3264 ) PURE;
3265
3266 /// <summary>
3267 /// Retrieves the current desktop DPI. To refresh this, call ReloadSystemMetrics.
3268 /// </summary>
3269 STDMETHOD_(void, GetDesktopDpi)(
3270 _Out_ FLOAT *dpiX,
3271 _Out_ FLOAT *dpiY
3272 ) PURE;
3273
3274 STDMETHOD(CreateRectangleGeometry)(
3275 _In_ CONST D2D1_RECT_F *rectangle,
3276 _COM_Outptr_ ID2D1RectangleGeometry **rectangleGeometry
3277 ) PURE;
3278
3279 STDMETHOD(CreateRoundedRectangleGeometry)(
3280 _In_ CONST D2D1_ROUNDED_RECT *roundedRectangle,
3281 _COM_Outptr_ ID2D1RoundedRectangleGeometry **roundedRectangleGeometry
3282 ) PURE;
3283
3284 STDMETHOD(CreateEllipseGeometry)(
3285 _In_ CONST D2D1_ELLIPSE *ellipse,
3286 _COM_Outptr_ ID2D1EllipseGeometry **ellipseGeometry
3287 ) PURE;
3288
3289 /// <summary>
3290 /// Create a geometry which holds other geometries.
3291 /// </summary>
3292 STDMETHOD(CreateGeometryGroup)(
3293 D2D1_FILL_MODE fillMode,
3294 _In_reads_(geometriesCount) ID2D1Geometry **geometries,
3295 UINT32 geometriesCount,
3296 _COM_Outptr_ ID2D1GeometryGroup **geometryGroup
3297 ) PURE;
3298
3299 STDMETHOD(CreateTransformedGeometry)(
3300 _In_ ID2D1Geometry *sourceGeometry,
3301 _In_ CONST D2D1_MATRIX_3X2_F *transform,
3302 _COM_Outptr_ ID2D1TransformedGeometry **transformedGeometry
3303 ) PURE;
3304
3305 /// <summary>
3306 /// Returns an initially empty path geometry interface. A geometry sink is created
3307 /// off the interface to populate it.
3308 /// </summary>
3309 STDMETHOD(CreatePathGeometry)(
3310 _COM_Outptr_ ID2D1PathGeometry **pathGeometry
3311 ) PURE;
3312
3313 /// <summary>
3314 /// Allows a non-default stroke style to be specified for a given geometry at draw
3315 /// time.
3316 /// </summary>
3317 STDMETHOD(CreateStrokeStyle)(
3318 _In_ CONST D2D1_STROKE_STYLE_PROPERTIES *strokeStyleProperties,
3319 _In_reads_opt_(dashesCount) CONST FLOAT *dashes,
3320 UINT32 dashesCount,
3321 _COM_Outptr_ ID2D1StrokeStyle **strokeStyle
3322 ) PURE;
3323
3324 /// <summary>
3325 /// Creates a new drawing state block, this can be used in subsequent
3326 /// SaveDrawingState and RestoreDrawingState operations on the render target.
3327 /// </summary>
3328 STDMETHOD(CreateDrawingStateBlock)(
3329 _In_opt_ CONST D2D1_DRAWING_STATE_DESCRIPTION *drawingStateDescription,
3330 _In_opt_ IDWriteRenderingParams *textRenderingParams,
3331 _COM_Outptr_ ID2D1DrawingStateBlock **drawingStateBlock
3332 ) PURE;
3333
3334 /// <summary>
3335 /// Creates a render target which is a source of bitmaps.
3336 /// </summary>
3337 STDMETHOD(CreateWicBitmapRenderTarget)(
3338 _In_ IWICBitmap *target,
3339 _In_ CONST D2D1_RENDER_TARGET_PROPERTIES *renderTargetProperties,
3340 _COM_Outptr_ ID2D1RenderTarget **renderTarget
3341 ) PURE;
3342
3343 /// <summary>
3344 /// Creates a render target that appears on the display.
3345 /// </summary>
3346 STDMETHOD(CreateHwndRenderTarget)(
3347 _In_ CONST D2D1_RENDER_TARGET_PROPERTIES *renderTargetProperties,
3348 _In_ CONST D2D1_HWND_RENDER_TARGET_PROPERTIES *hwndRenderTargetProperties,
3349 _COM_Outptr_ ID2D1HwndRenderTarget **hwndRenderTarget
3350 ) PURE;
3351
3352 /// <summary>
3353 /// Creates a render target that draws to a DXGI Surface. The device that owns the
3354 /// surface is used for rendering.
3355 /// </summary>
3356 STDMETHOD(CreateDxgiSurfaceRenderTarget)(
3357 _In_ IDXGISurface *dxgiSurface,
3358 _In_ CONST D2D1_RENDER_TARGET_PROPERTIES *renderTargetProperties,
3359 _COM_Outptr_ ID2D1RenderTarget **renderTarget
3360 ) PURE;
3361
3362 /// <summary>
3363 /// Creates a render target that draws to a GDI device context.
3364 /// </summary>
3365 STDMETHOD(CreateDCRenderTarget)(
3366 _In_ CONST D2D1_RENDER_TARGET_PROPERTIES *renderTargetProperties,
3367 _COM_Outptr_ ID2D1DCRenderTarget **dcRenderTarget
3368 ) PURE;
3369
3370 COM_DECLSPEC_NOTHROW
3371 HRESULT
CreateRectangleGeometry(CONST D2D1_RECT_F & rectangle,_COM_Outptr_ ID2D1RectangleGeometry ** rectangleGeometry)3372 CreateRectangleGeometry(
3373 CONST D2D1_RECT_F &rectangle,
3374 _COM_Outptr_ ID2D1RectangleGeometry **rectangleGeometry
3375 )
3376 {
3377 return CreateRectangleGeometry(&rectangle, rectangleGeometry);
3378 }
3379
3380 COM_DECLSPEC_NOTHROW
3381 HRESULT
CreateRoundedRectangleGeometry(CONST D2D1_ROUNDED_RECT & roundedRectangle,_COM_Outptr_ ID2D1RoundedRectangleGeometry ** roundedRectangleGeometry)3382 CreateRoundedRectangleGeometry(
3383 CONST D2D1_ROUNDED_RECT &roundedRectangle,
3384 _COM_Outptr_ ID2D1RoundedRectangleGeometry **roundedRectangleGeometry
3385 )
3386 {
3387 return CreateRoundedRectangleGeometry(&roundedRectangle, roundedRectangleGeometry);
3388 }
3389
3390 COM_DECLSPEC_NOTHROW
3391 HRESULT
CreateEllipseGeometry(CONST D2D1_ELLIPSE & ellipse,_COM_Outptr_ ID2D1EllipseGeometry ** ellipseGeometry)3392 CreateEllipseGeometry(
3393 CONST D2D1_ELLIPSE &ellipse,
3394 _COM_Outptr_ ID2D1EllipseGeometry **ellipseGeometry
3395 )
3396 {
3397 return CreateEllipseGeometry(&ellipse, ellipseGeometry);
3398 }
3399
3400 COM_DECLSPEC_NOTHROW
3401 HRESULT
CreateTransformedGeometry(_In_ ID2D1Geometry * sourceGeometry,CONST D2D1_MATRIX_3X2_F & transform,_COM_Outptr_ ID2D1TransformedGeometry ** transformedGeometry)3402 CreateTransformedGeometry(
3403 _In_ ID2D1Geometry *sourceGeometry,
3404 CONST D2D1_MATRIX_3X2_F &transform,
3405 _COM_Outptr_ ID2D1TransformedGeometry **transformedGeometry
3406 )
3407 {
3408 return CreateTransformedGeometry(sourceGeometry, &transform, transformedGeometry);
3409 }
3410
3411 COM_DECLSPEC_NOTHROW
3412 HRESULT
CreateStrokeStyle(CONST D2D1_STROKE_STYLE_PROPERTIES & strokeStyleProperties,_In_reads_opt_ (dashesCount)CONST FLOAT * dashes,UINT32 dashesCount,_COM_Outptr_ ID2D1StrokeStyle ** strokeStyle)3413 CreateStrokeStyle(
3414 CONST D2D1_STROKE_STYLE_PROPERTIES &strokeStyleProperties,
3415 _In_reads_opt_(dashesCount) CONST FLOAT *dashes,
3416 UINT32 dashesCount,
3417 _COM_Outptr_ ID2D1StrokeStyle **strokeStyle
3418 )
3419 {
3420 return CreateStrokeStyle(&strokeStyleProperties, dashes, dashesCount, strokeStyle);
3421 }
3422
3423 COM_DECLSPEC_NOTHROW
3424 HRESULT
CreateDrawingStateBlock(CONST D2D1_DRAWING_STATE_DESCRIPTION & drawingStateDescription,_COM_Outptr_ ID2D1DrawingStateBlock ** drawingStateBlock)3425 CreateDrawingStateBlock(
3426 CONST D2D1_DRAWING_STATE_DESCRIPTION &drawingStateDescription,
3427 _COM_Outptr_ ID2D1DrawingStateBlock **drawingStateBlock
3428 )
3429 {
3430 return CreateDrawingStateBlock(&drawingStateDescription, NULL, drawingStateBlock);
3431 }
3432
3433 COM_DECLSPEC_NOTHROW
3434 HRESULT
CreateDrawingStateBlock(_COM_Outptr_ ID2D1DrawingStateBlock ** drawingStateBlock)3435 CreateDrawingStateBlock(
3436 _COM_Outptr_ ID2D1DrawingStateBlock **drawingStateBlock
3437 )
3438 {
3439 return CreateDrawingStateBlock(NULL, NULL, drawingStateBlock);
3440 }
3441
3442 COM_DECLSPEC_NOTHROW
3443 HRESULT
CreateWicBitmapRenderTarget(_In_ IWICBitmap * target,CONST D2D1_RENDER_TARGET_PROPERTIES & renderTargetProperties,_COM_Outptr_ ID2D1RenderTarget ** renderTarget)3444 CreateWicBitmapRenderTarget(
3445 _In_ IWICBitmap *target,
3446 CONST D2D1_RENDER_TARGET_PROPERTIES &renderTargetProperties,
3447 _COM_Outptr_ ID2D1RenderTarget **renderTarget
3448 )
3449 {
3450 return CreateWicBitmapRenderTarget(target, &renderTargetProperties, renderTarget);
3451 }
3452
3453 COM_DECLSPEC_NOTHROW
3454 HRESULT
CreateHwndRenderTarget(CONST D2D1_RENDER_TARGET_PROPERTIES & renderTargetProperties,CONST D2D1_HWND_RENDER_TARGET_PROPERTIES & hwndRenderTargetProperties,_COM_Outptr_ ID2D1HwndRenderTarget ** hwndRenderTarget)3455 CreateHwndRenderTarget(
3456 CONST D2D1_RENDER_TARGET_PROPERTIES &renderTargetProperties,
3457 CONST D2D1_HWND_RENDER_TARGET_PROPERTIES &hwndRenderTargetProperties,
3458 _COM_Outptr_ ID2D1HwndRenderTarget **hwndRenderTarget
3459 )
3460 {
3461 return CreateHwndRenderTarget(&renderTargetProperties, &hwndRenderTargetProperties, hwndRenderTarget);
3462 }
3463
3464 COM_DECLSPEC_NOTHROW
3465 HRESULT
CreateDxgiSurfaceRenderTarget(_In_ IDXGISurface * dxgiSurface,CONST D2D1_RENDER_TARGET_PROPERTIES & renderTargetProperties,_COM_Outptr_ ID2D1RenderTarget ** renderTarget)3466 CreateDxgiSurfaceRenderTarget(
3467 _In_ IDXGISurface *dxgiSurface,
3468 CONST D2D1_RENDER_TARGET_PROPERTIES &renderTargetProperties,
3469 _COM_Outptr_ ID2D1RenderTarget **renderTarget
3470 )
3471 {
3472 return CreateDxgiSurfaceRenderTarget(dxgiSurface, &renderTargetProperties, renderTarget);
3473 }
3474 }; // interface ID2D1Factory
3475
3476 /*#endif*/ /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) */
3477 /*#pragma endregion*/
3478
3479 #endif
3480
3481 #ifdef D2D_USE_C_DEFINITIONS
3482
3483 /*#pragma region Application Family*/
3484 /*#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)*/
3485
3486 typedef interface ID2D1Resource ID2D1Resource;
3487
3488 typedef interface ID2D1Image ID2D1Image;
3489
3490 typedef interface ID2D1Bitmap ID2D1Bitmap;
3491
3492 typedef interface ID2D1GradientStopCollection ID2D1GradientStopCollection;
3493
3494 typedef interface ID2D1Brush ID2D1Brush;
3495
3496 typedef interface ID2D1BitmapBrush ID2D1BitmapBrush;
3497
3498 typedef interface ID2D1SolidColorBrush ID2D1SolidColorBrush;
3499
3500 typedef interface ID2D1LinearGradientBrush ID2D1LinearGradientBrush;
3501
3502 typedef interface ID2D1RadialGradientBrush ID2D1RadialGradientBrush;
3503
3504 typedef interface ID2D1StrokeStyle ID2D1StrokeStyle;
3505
3506 typedef interface ID2D1Geometry ID2D1Geometry;
3507
3508 typedef interface ID2D1RectangleGeometry ID2D1RectangleGeometry;
3509
3510 typedef interface ID2D1RoundedRectangleGeometry ID2D1RoundedRectangleGeometry;
3511
3512 typedef interface ID2D1EllipseGeometry ID2D1EllipseGeometry;
3513
3514 typedef interface ID2D1GeometryGroup ID2D1GeometryGroup;
3515
3516 typedef interface ID2D1TransformedGeometry ID2D1TransformedGeometry;
3517
3518 typedef interface ID2D1SimplifiedGeometrySink ID2D1SimplifiedGeometrySink;
3519
3520 typedef interface ID2D1GeometrySink ID2D1GeometrySink;
3521
3522 typedef interface ID2D1TessellationSink ID2D1TessellationSink;
3523
3524 typedef interface ID2D1PathGeometry ID2D1PathGeometry;
3525
3526 typedef interface ID2D1Mesh ID2D1Mesh;
3527
3528 typedef interface ID2D1Layer ID2D1Layer;
3529
3530 typedef interface ID2D1DrawingStateBlock ID2D1DrawingStateBlock;
3531
3532 typedef interface ID2D1RenderTarget ID2D1RenderTarget;
3533
3534 typedef interface ID2D1BitmapRenderTarget ID2D1BitmapRenderTarget;
3535
3536 typedef interface ID2D1HwndRenderTarget ID2D1HwndRenderTarget;
3537
3538 /*#endif*/ /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) */
3539 /*#pragma endregion*/
3540
3541 /*#pragma region Application Family*/
3542 /*#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)*/
3543
3544 typedef interface ID2D1GdiInteropRenderTarget ID2D1GdiInteropRenderTarget;
3545
3546 /*#endif*/ /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) */
3547 /*#pragma endregion*/
3548
3549 /*#pragma region Application Family*/
3550 /*#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)*/
3551
3552 typedef interface ID2D1DCRenderTarget ID2D1DCRenderTarget;
3553
3554 typedef interface ID2D1Factory ID2D1Factory;
3555
3556 /*#endif*/ /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) */
3557 /*#pragma endregion*/
3558
3559 #endif
3560
3561 /*#pragma region Application Family*/
3562 /*#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)*/
3563
3564 #ifdef __cplusplus
3565 extern "C"
3566 {
3567 #endif
3568
3569 //
3570 // This export cannot be in a namespace because compiler name mangling isn't consistent
3571 // also, this must be 'C' callable.
3572 //
3573 HRESULT WINAPI
3574 D2D1CreateFactory(
3575 _In_ D2D1_FACTORY_TYPE factoryType,
3576 _In_ REFIID riid,
3577 _In_opt_ CONST D2D1_FACTORY_OPTIONS *pFactoryOptions,
3578 _Out_ void **ppIFactory
3579 );
3580
3581 void WINAPI
3582 D2D1MakeRotateMatrix(
3583 _In_ FLOAT angle,
3584 _In_ D2D1_POINT_2F center,
3585 _Out_ D2D1_MATRIX_3X2_F *matrix
3586 );
3587
3588 void WINAPI
3589 D2D1MakeSkewMatrix(
3590 _In_ FLOAT angleX,
3591 _In_ FLOAT angleY,
3592 _In_ D2D1_POINT_2F center,
3593 _Out_ D2D1_MATRIX_3X2_F *matrix
3594 );
3595
3596 BOOL WINAPI
3597 D2D1IsMatrixInvertible(
3598 _In_ CONST D2D1_MATRIX_3X2_F *matrix
3599 );
3600
3601 BOOL WINAPI
3602 D2D1InvertMatrix(
3603 _Inout_ D2D1_MATRIX_3X2_F *matrix
3604 );
3605
3606 #ifdef __cplusplus
3607 }
3608 #endif
3609
3610 #ifndef D2D1FORCEINLINE
3611 #define D2D1FORCEINLINE FORCEINLINE
3612 #endif // #ifndef D2D1FORCEINLINE
3613
3614 #include <d2d1helper.h>
3615
3616 #ifndef D2D_USE_C_DEFINITIONS
3617
3618 COM_DECLSPEC_NOTHROW
3619 inline
3620 HRESULT
D2D1CreateFactory(_In_ D2D1_FACTORY_TYPE factoryType,_In_ REFIID riid,_Out_ void ** factory)3621 D2D1CreateFactory(
3622 _In_ D2D1_FACTORY_TYPE factoryType,
3623 _In_ REFIID riid,
3624 _Out_ void **factory
3625 )
3626 {
3627 return
3628 D2D1CreateFactory(
3629 factoryType,
3630 riid,
3631 NULL,
3632 factory);
3633 }
3634
3635 template<class Factory>
3636 COM_DECLSPEC_NOTHROW
3637 HRESULT
D2D1CreateFactory(_In_ D2D1_FACTORY_TYPE factoryType,_Out_ Factory ** factory)3638 D2D1CreateFactory(
3639 _In_ D2D1_FACTORY_TYPE factoryType,
3640 _Out_ Factory **factory
3641 )
3642 {
3643 return
3644 D2D1CreateFactory(
3645 factoryType,
3646 __uuidof(Factory),
3647 reinterpret_cast<void **>(factory));
3648 }
3649
3650 template<class Factory>
3651 COM_DECLSPEC_NOTHROW
3652 HRESULT
D2D1CreateFactory(_In_ D2D1_FACTORY_TYPE factoryType,_In_ CONST D2D1_FACTORY_OPTIONS & factoryOptions,_Out_ Factory ** ppFactory)3653 D2D1CreateFactory(
3654 _In_ D2D1_FACTORY_TYPE factoryType,
3655 _In_ CONST D2D1_FACTORY_OPTIONS &factoryOptions,
3656 _Out_ Factory **ppFactory
3657 )
3658 {
3659 return
3660 D2D1CreateFactory(
3661 factoryType,
3662 __uuidof(Factory),
3663 &factoryOptions,
3664 reinterpret_cast<void **>(ppFactory));
3665 }
3666
3667 #endif // #ifndef D2D_USE_C_DEFINITIONS
3668
3669 /*#endif*/ /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) */
3670 /*#pragma endregion*/
3671
3672 #endif // #ifndef _D2D1_H_
3673