1 module directx.dcommon;
2 //+--------------------------------------------------------------------------
3 //
4 //  Copyright (c) Microsoft Corporation.  All rights reserved.
5 //
6 //  Abstract:
7 //     Public API definitions for DWrite, D2D and DImage.
8 //
9 //----------------------------------------------------------------------------
10 
11 version(Windows):
12 
13 public import directx.dxgiformat;
14 
15 import directx.dxgi : IDXGISurface;
16 
17 /*
18 #ifndef DX_DECLARE_INTERFACE
19 #define DX_DECLARE_INTERFACE(x) DECLSPEC_UUID(x) DECLSPEC_NOVTABLE
20 #endif
21 
22 #ifndef CHECKMETHOD
23 #define CHECKMETHOD(method) virtual DECLSPEC_NOTHROW _Must_inspect_result_ HRESULT STDMETHODCALLTYPE method
24 #endif
25 */
26 
27 //
28 // Forward declarations
29 //
30 //export interface IDXGISurface;
31 
32 //+----------------------------------------------------------------------------
33 //
34 //  Enum:
35 //      DWRITE_MEASURING_MODE
36 //
37 //  Synopsis:
38 //      The measuring method used for text layout.
39 //
40 //-------------------------------------------------------------------------------
41 alias DWRITE_MEASURING_MODE = int;
42 enum : DWRITE_MEASURING_MODE
43 {
44     //
45     // Text is measured using glyph ideal metrics whose values are independent to the current display resolution.
46     //
47     DWRITE_MEASURING_MODE_NATURAL,
48 
49     //
50     // Text is measured using glyph display compatible metrics whose values tuned for the current display resolution.
51     //
52     DWRITE_MEASURING_MODE_GDI_CLASSIC,
53 
54     //
55     // Text is measured using the same glyph display metrics as text measured by GDI using a font
56     // created with CLEARTYPE_NATURAL_QUALITY.
57     //
58     DWRITE_MEASURING_MODE_GDI_NATURAL
59 
60 }
61 
62 //+-----------------------------------------------------------------------------
63 //
64 //  Enum:
65 //      D2D1_ALPHA_MODE
66 //
67 //  Synopsis:
68 //      Qualifies how alpha is to be treated in a bitmap or render target containing
69 //      alpha.
70 //
71 //------------------------------------------------------------------------------
72 alias D2D1_ALPHA_MODE = int;
73 enum : D2D1_ALPHA_MODE
74 {
75         
76         //
77         // Alpha mode should be determined implicitly. Some target surfaces do not supply
78         // or imply this information in which case alpha must be specified.
79         //
80         D2D1_ALPHA_MODE_UNKNOWN = 0,
81         
82         //
83         // Treat the alpha as premultipled.
84         //
85         D2D1_ALPHA_MODE_PREMULTIPLIED = 1,
86         
87         //
88         // Opacity is in the 'A' component only.
89         //
90         D2D1_ALPHA_MODE_STRAIGHT = 2,
91         
92         //
93         // Ignore any alpha channel information.
94         //
95         D2D1_ALPHA_MODE_IGNORE = 3,
96 
97         D2D1_ALPHA_MODE_FORCE_DWORD = 0xffffffff
98 
99 }
100 
101 //+-----------------------------------------------------------------------------
102 //
103 //  Struct:
104 //      D2D1_PIXEL_FORMAT
105 //
106 //------------------------------------------------------------------------------
107 struct D2D1_PIXEL_FORMAT
108 {
109     this(this) {}
110     DXGI_FORMAT format;
111     D2D1_ALPHA_MODE alphaMode;
112 }