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