source: Daodan/MSYS2/mingw32/i686-w64-mingw32/include/d2d1_1helper.h

Last change on this file was 1166, checked in by rossy, 3 years ago

Daodan: Replace MinGW build env with an up-to-date MSYS2 env

File size: 4.1 KB
Line 
1/**
2 * This file has no copyright assigned and is placed in the Public Domain.
3 * This file is part of the mingw-w64 runtime package.
4 * No warranty is given; refer to the file DISCLAIMER.PD within this package.
5 */
6
7#ifndef _D2D1_1HELPER_H_
8#define _D2D1_1HELPER_H_
9
10#ifndef D2D_USE_C_DEFINITIONS
11
12namespace D2D1 {
13 template<> struct TypeTraits<INT32> {
14 typedef D2D1_POINT_2L Point;
15 typedef D2D1_RECT_L Rect;
16 };
17
18 template<> struct TypeTraits<LONG> {
19 typedef D2D1_POINT_2L Point;
20 typedef D2D1_RECT_L Rect;
21 };
22
23 D2D1FORCEINLINE D2D1_LAYER_PARAMETERS1 LayerParameters1(CONST D2D1_RECT_F &contentBounds = D2D1::InfiniteRect(),
24 ID2D1Geometry *geometricMask = NULL, D2D1_ANTIALIAS_MODE maskAntialiasMode = D2D1_ANTIALIAS_MODE_PER_PRIMITIVE,
25 D2D1_MATRIX_3X2_F maskTransform = D2D1::IdentityMatrix(), FLOAT opacity = 1.0, ID2D1Brush *opacityBrush = NULL,
26 D2D1_LAYER_OPTIONS1 layerOptions = D2D1_LAYER_OPTIONS1_NONE) {
27 D2D1_LAYER_PARAMETERS1 r = {contentBounds, geometricMask, maskAntialiasMode, maskTransform, opacity,
28 opacityBrush, layerOptions};
29 return r;
30 }
31
32 D2D1FORCEINLINE D2D1_IMAGE_BRUSH_PROPERTIES ImageBrushProperties(D2D1_RECT_F sourceRectangle,
33 D2D1_EXTEND_MODE extendModeX = D2D1_EXTEND_MODE_CLAMP, D2D1_EXTEND_MODE extendModeY = D2D1_EXTEND_MODE_CLAMP,
34 D2D1_INTERPOLATION_MODE interpolationMode = D2D1_INTERPOLATION_MODE_LINEAR) {
35 D2D1_IMAGE_BRUSH_PROPERTIES r = {sourceRectangle, extendModeX, extendModeY, interpolationMode};
36 return r;
37 }
38
39 D2D1FORCEINLINE D2D1_BITMAP_PROPERTIES1 BitmapProperties1(D2D1_BITMAP_OPTIONS bitmapOptions = D2D1_BITMAP_OPTIONS_NONE,
40 CONST D2D1_PIXEL_FORMAT pixelFormat = D2D1::PixelFormat(), FLOAT dpiX = 96.0f, FLOAT dpiY = 96.0f,
41 ID2D1ColorContext *colorContext = NULL) {
42 D2D1_BITMAP_PROPERTIES1 r = {pixelFormat, dpiX, dpiY, bitmapOptions, colorContext};
43 return r;
44 }
45
46 D2D1FORCEINLINE D2D1_BITMAP_BRUSH_PROPERTIES1 BitmapBrushProperties1(D2D1_EXTEND_MODE extendmodeX = D2D1_EXTEND_MODE_CLAMP,
47 D2D1_EXTEND_MODE extendmodeY = D2D1_EXTEND_MODE_CLAMP,
48 D2D1_INTERPOLATION_MODE interpolationMode = D2D1_INTERPOLATION_MODE_LINEAR) {
49 D2D1_BITMAP_BRUSH_PROPERTIES1 r = {extendmodeX, extendmodeY, interpolationMode};
50 return r;
51 }
52
53 class Matrix5x4F : public D2D1_MATRIX_5X4_F {
54 public:
55 inline Matrix5x4F(
56 FLOAT m11, FLOAT m12, FLOAT m13, FLOAT m14,
57 FLOAT m21, FLOAT m22, FLOAT m23, FLOAT m24,
58 FLOAT m31, FLOAT m32, FLOAT m33, FLOAT m34,
59 FLOAT m41, FLOAT m42, FLOAT m43, FLOAT m44,
60 FLOAT m51, FLOAT m52, FLOAT m53, FLOAT m54) {
61 _11 = m11; _12 = m12; _13 = m13; _14 = m14;
62 _21 = m21; _22 = m22; _23 = m23; _24 = m24;
63 _31 = m31; _32 = m32; _33 = m33; _34 = m34;
64 _41 = m41; _42 = m42; _43 = m43; _44 = m44;
65 _51 = m51; _52 = m52; _53 = m53; _54 = m54;
66 }
67
68 inline Matrix5x4F() {
69 _11 = 1; _12 = 0; _13 = 0; _14 = 0;
70 _21 = 0; _22 = 1; _23 = 0; _24 = 0;
71 _31 = 0; _32 = 0; _33 = 1; _34 = 0;
72 _41 = 0; _42 = 0; _43 = 0; _44 = 1;
73 _51 = 0; _52 = 0; _53 = 0; _54 = 0;
74 }
75 };
76
77 D2D1FORCEINLINE D2D1_VECTOR_2F Vector2F(FLOAT x = 0.0f, FLOAT y = 0.0f) {
78 D2D1_VECTOR_2F r = {x, y};
79 return r;
80 }
81
82 D2D1FORCEINLINE D2D1_VECTOR_3F Vector3F(FLOAT x = 0.0f, FLOAT y = 0.0f, FLOAT z = 0.0f) {
83 D2D1_VECTOR_3F r = {x, y, z};
84 return r;
85 }
86
87 D2D1FORCEINLINE D2D1_VECTOR_4F Vector4F(FLOAT x = 0.0f, FLOAT y = 0.0f, FLOAT z = 0.0f, FLOAT w = 0.0f) {
88 D2D1_VECTOR_4F r = {x, y, z, w};
89 return r;
90 }
91
92 D2D1FORCEINLINE D2D1_POINT_2L Point2L(INT32 x = 0, INT32 y = 0) {
93 return Point2<INT32>(x, y);
94 }
95
96 D2D1FORCEINLINE D2D1_RECT_L RectL(INT32 left = 0.0f, INT32 top = 0.0f, INT32 right = 0.0f, INT32 bottom = 0.0f) {
97 return Rect<INT32>(left, top, right, bottom);
98 }
99}
100
101#endif /* D2D_USE_C_DEFINITIONS */
102
103#endif /* _D2D1_1HELPER_H_ */
Note: See TracBrowser for help on using the repository browser.