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