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