ReactOS  0.4.14-dev-342-gdc047f9
TextTransform.c
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS api tests
3  * LICENSE: GPL - See COPYING in the top level directory
4  * PURPOSE: Test for World Transformation and font rendering
5  * PROGRAMMERS: Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
6  */
7 
8 #include "precomp.h"
9 
10 typedef struct tagBITMAPINFOEX
11 {
15 
16 #if 1
17  #define SaveBitmapToFile(f, h)
18 #else
20 {
21  BOOL f;
23  BITMAPINFOEX bmi;
24  BITMAPINFOHEADER *pbmih;
25  DWORD cb, cbColors;
26  HDC hDC;
27  HANDLE hFile;
28  LPVOID pBits;
29  BITMAP bm;
30 
31  if (!GetObjectW(hbm, sizeof(BITMAP), &bm))
32  return FALSE;
33 
34  pbmih = &bmi.bmiHeader;
35  ZeroMemory(pbmih, sizeof(BITMAPINFOHEADER));
36  pbmih->biSize = sizeof(BITMAPINFOHEADER);
37  pbmih->biWidth = bm.bmWidth;
38  pbmih->biHeight = bm.bmHeight;
39  pbmih->biPlanes = 1;
40  pbmih->biBitCount = bm.bmBitsPixel;
41  pbmih->biCompression = BI_RGB;
42  pbmih->biSizeImage = bm.bmWidthBytes * bm.bmHeight;
43 
44  if (bm.bmBitsPixel < 16)
45  cbColors = (1 << bm.bmBitsPixel) * sizeof(RGBQUAD);
46  else
47  cbColors = 0;
48 
49  bf.bfType = 0x4d42;
50  bf.bfReserved1 = 0;
51  bf.bfReserved2 = 0;
52  cb = sizeof(BITMAPFILEHEADER) + pbmih->biSize + cbColors;
53  bf.bfOffBits = cb;
54  bf.bfSize = cb + pbmih->biSizeImage;
55 
56  pBits = HeapAlloc(GetProcessHeap(), 0, pbmih->biSizeImage);
57  if (pBits == NULL)
58  return FALSE;
59 
60  f = FALSE;
62  if (hDC)
63  {
64  if (GetDIBits(hDC, hbm, 0, bm.bmHeight, pBits, (BITMAPINFO *)&bmi,
66  {
71  {
72  f = WriteFile(hFile, &bf, sizeof(BITMAPFILEHEADER), &cb, NULL) &&
73  WriteFile(hFile, &bmi, sizeof(BITMAPINFOHEADER), &cb, NULL) &&
74  WriteFile(hFile, bmi.bmiColors, cbColors, &cb, NULL) &&
75  WriteFile(hFile, pBits, pbmih->biSizeImage, &cb, NULL);
77 
78  if (!f)
80  }
81  }
82  DeleteDC(hDC);
83  }
84  HeapFree(GetProcessHeap(), 0, pBits);
85  return f;
86 }
87 #endif
88 
89 typedef struct TEST_ENTRY
90 {
91  INT line; // line number
92  INT GraphicsMode; // GM_COMPATIBLE or GM_ADVANCED
93  POINT ptRef; // reference point
98  INT cWhitePoints; // number of white points
100  INT cBlackPoints; // number of black points
102 } TEST_ENTRY;
103 
104 #define WIDTH 400
105 #define HEIGHT 400
106 #define XCENTER (WIDTH / 2)
107 #define YCENTER (HEIGHT / 2)
108 #define BLACK RGB(0, 0, 0)
109 #define WHITE RGB(255, 255, 255)
110 #define LFHEIGHT -100
111 
112 static const RECT s_rc = {0, 0, WIDTH, HEIGHT};
113 static HBRUSH s_hWhiteBrush = NULL;
114 static HPEN s_hRedPen = NULL;
115 
116 #define POS(ix, iy) {XCENTER + (ix) * WIDTH/8, YCENTER + (iy) * HEIGHT/8}
117 
118 #define NO_TRANS_1 \
119  3, {POS(1, 1), POS(-1, 1), POS(-1, -1)}, 1, {POS(1, -1)}
120 
121 #define NO_TRANS_2 \
122  3, {POS(1, -1), POS(-1, 1), POS(-1, -1)}, 1, {POS(1, 1)}
123 
124 static const TEST_ENTRY s_entries[] =
125 {
126  // GM_COMPATIBLE TA_BOTTOM
127  {__LINE__, GM_COMPATIBLE, {XCENTER, YCENTER}, TA_LEFT | TA_BOTTOM, {1, 0, 0, 1, 0, 0}, FALSE, L"000.bmp", NO_TRANS_1},
128  {__LINE__, GM_COMPATIBLE, {XCENTER, YCENTER}, TA_LEFT | TA_BOTTOM, {1.5, 0, 0, 1, 0, 0}, FALSE, L"001.bmp", NO_TRANS_1},
129  {__LINE__, GM_COMPATIBLE, {XCENTER, YCENTER}, TA_LEFT | TA_BOTTOM, {1, 0, 0, 1.5, 0, 0}, FALSE, L"002.bmp", NO_TRANS_1},
130  {__LINE__, GM_COMPATIBLE, {XCENTER, YCENTER}, TA_LEFT | TA_BOTTOM, {-1, 0, 0, 1, 0, 0}, FALSE, L"003.bmp", NO_TRANS_1},
131  {__LINE__, GM_COMPATIBLE, {XCENTER, YCENTER}, TA_LEFT | TA_BOTTOM, {1, 0, 0, -1, 0, 0}, FALSE, L"004.bmp", NO_TRANS_1},
132  {__LINE__, GM_COMPATIBLE, {XCENTER, YCENTER}, TA_LEFT | TA_BOTTOM, {0, 1, 1, 0, 0, 0}, FALSE, L"005.bmp", NO_TRANS_1},
133  {__LINE__, GM_COMPATIBLE, {XCENTER, YCENTER}, TA_LEFT | TA_BOTTOM, {0, -1, 1, 0, 0, 0}, FALSE, L"006.bmp", NO_TRANS_1},
134  {__LINE__, GM_COMPATIBLE, {XCENTER, YCENTER}, TA_LEFT | TA_BOTTOM, {0, 1, -1, 0, 0, 0}, FALSE, L"007.bmp", NO_TRANS_1},
135  {__LINE__, GM_COMPATIBLE, {XCENTER, YCENTER}, TA_LEFT | TA_BOTTOM, {0, -1, -1, 0, 0, 0}, FALSE, L"009.bmp", NO_TRANS_1},
136  {__LINE__, GM_COMPATIBLE, {XCENTER, YCENTER}, TA_LEFT | TA_BOTTOM, {0, 1, 0, 1, 0, 0}, FALSE, L"009.bmp", NO_TRANS_1},
137  {__LINE__, GM_COMPATIBLE, {XCENTER, YCENTER}, TA_LEFT | TA_BOTTOM, {1, 1, 1, 1, 0, 0}, FALSE, L"010.bmp", NO_TRANS_1},
138  {__LINE__, GM_COMPATIBLE, {XCENTER, YCENTER}, TA_LEFT | TA_BOTTOM, {0, 0, 0, 0, 0, 0}, FALSE, L"011.bmp", NO_TRANS_1},
139  {__LINE__, GM_COMPATIBLE, {XCENTER, YCENTER}, TA_LEFT | TA_BOTTOM, {0, 0, 0, 0, 1000, 0}, FALSE, L"012.bmp", NO_TRANS_1},
140  {__LINE__, GM_COMPATIBLE, {XCENTER, YCENTER}, TA_LEFT | TA_BOTTOM, {0, 0, 0, 0, 0, 1000}, FALSE, L"013.bmp", NO_TRANS_1},
141 
142  // GM_COMPATIBLE TA_TOP
143  {__LINE__, GM_COMPATIBLE, {XCENTER, YCENTER}, TA_LEFT | TA_TOP, {1, 0, 0, 1, 0, 0}, FALSE, L"100.bmp", NO_TRANS_2},
144  {__LINE__, GM_COMPATIBLE, {XCENTER, YCENTER}, TA_LEFT | TA_TOP, {1.5, 0, 0, 1, 0, 0}, FALSE, L"101.bmp", NO_TRANS_2},
145  {__LINE__, GM_COMPATIBLE, {XCENTER, YCENTER}, TA_LEFT | TA_TOP, {1, 0, 0, 1.5, 0, 0}, FALSE, L"102.bmp", NO_TRANS_2},
146  {__LINE__, GM_COMPATIBLE, {XCENTER, YCENTER}, TA_LEFT | TA_TOP, {-1, 0, 0, 1, 0, 0}, FALSE, L"103.bmp", NO_TRANS_2},
147  {__LINE__, GM_COMPATIBLE, {XCENTER, YCENTER}, TA_LEFT | TA_TOP, {1, 0, 0, -1, 0, 0}, FALSE, L"104.bmp", NO_TRANS_2},
148  {__LINE__, GM_COMPATIBLE, {XCENTER, YCENTER}, TA_LEFT | TA_TOP, {0, 1, 1, 0, 0, 0}, FALSE, L"105.bmp", NO_TRANS_2},
149  {__LINE__, GM_COMPATIBLE, {XCENTER, YCENTER}, TA_LEFT | TA_TOP, {0, -1, 1, 0, 0, 0}, FALSE, L"106.bmp", NO_TRANS_2},
150  {__LINE__, GM_COMPATIBLE, {XCENTER, YCENTER}, TA_LEFT | TA_TOP, {0, 1, -1, 0, 0, 0}, FALSE, L"107.bmp", NO_TRANS_2},
151  {__LINE__, GM_COMPATIBLE, {XCENTER, YCENTER}, TA_LEFT | TA_TOP, {0, -1, -1, 0, 0, 0}, FALSE, L"109.bmp", NO_TRANS_2},
152  {__LINE__, GM_COMPATIBLE, {XCENTER, YCENTER}, TA_LEFT | TA_TOP, {0, 1, 0, 1, 0, 0}, FALSE, L"109.bmp", NO_TRANS_2},
153  {__LINE__, GM_COMPATIBLE, {XCENTER, YCENTER}, TA_LEFT | TA_TOP, {1, 1, 1, 1, 0, 0}, FALSE, L"110.bmp", NO_TRANS_2},
154  {__LINE__, GM_COMPATIBLE, {XCENTER, YCENTER}, TA_LEFT | TA_TOP, {0, 0, 0, 0, 0, 0}, FALSE, L"111.bmp", NO_TRANS_2},
155  {__LINE__, GM_COMPATIBLE, {XCENTER, YCENTER}, TA_LEFT | TA_TOP, {0, 0, 0, 0, 1000, 0}, FALSE, L"112.bmp", NO_TRANS_2},
156  {__LINE__, GM_COMPATIBLE, {XCENTER, YCENTER}, TA_LEFT | TA_TOP, {0, 0, 0, 0, 0, 1000}, FALSE, L"113.bmp", NO_TRANS_2},
157 
158  // GM_ADVANCED TA_LEFT TA_BOTTOM
159  {__LINE__, GM_ADVANCED, {XCENTER, YCENTER}, TA_LEFT | TA_BOTTOM, {1, 0, 0, 1, 0, 0}, TRUE, L"200.bmp", NO_TRANS_1},
160  {__LINE__, GM_ADVANCED, {XCENTER, YCENTER}, TA_LEFT | TA_BOTTOM, {1.5, 0, 0, 1, 0, 0}, TRUE, L"201.bmp",
161  4, {POS(-1, -1), POS(1, -1), POS(-1, 1), POS(1, 1)}, 1, {POS(3, -1)}},
162  {__LINE__, GM_ADVANCED, {XCENTER, YCENTER}, TA_LEFT | TA_BOTTOM, {1, 0, 0, 1.5, 0, 0}, TRUE, L"202.bmp",
163  3, {POS(-1, -1), POS(-1, 1), POS(1, -1)}, 1, {POS(1, 1)}},
164  {__LINE__, GM_ADVANCED, {-XCENTER, YCENTER}, TA_LEFT | TA_BOTTOM, {-1, 0, 0, 1, 0, 0}, TRUE, L"203.bmp",
165  3, {POS(1, -1), POS(-1, 1), POS(1, -1)}, 1, {POS(-1, -1)}},
166  {__LINE__, GM_ADVANCED, {XCENTER, -YCENTER}, TA_LEFT | TA_BOTTOM, {1, 0, 0, -1, 0, 0}, TRUE, L"204.bmp",
167  3, {POS(-1, -1), POS(-1, 1), POS(1, -1)}, 1, {POS(1, 1)}},
168  {__LINE__, GM_ADVANCED, {XCENTER, YCENTER}, TA_LEFT | TA_BOTTOM, {0, 1, 1, 0, 0, 0}, TRUE, L"205.bmp",
169  3, {POS(-1, -1), POS(1, 1), POS(1, -1)}, 1, {POS(-1, 1)}},
170  {__LINE__, GM_ADVANCED, {-XCENTER, YCENTER}, TA_LEFT | TA_BOTTOM, {0, -1, 1, 0, 0, 0}, TRUE, L"206.bmp",
171  3, {POS(-1, 1), POS(1, 1), POS(1, -1)}, 1, {POS(-1, -1)}},
172  {__LINE__, GM_ADVANCED, {XCENTER, -YCENTER}, TA_LEFT | TA_BOTTOM, {0, 1, -1, 0, 0, 0}, TRUE, L"207.bmp",
173  3, {POS(-1, 1), POS(-1, -1), POS(1, -1)}, 1, {POS(1, 1)}},
174  {__LINE__, GM_ADVANCED, {-XCENTER, -YCENTER}, TA_LEFT | TA_BOTTOM, {0, -1, -1, 0, 0, 0}, TRUE, L"208.bmp",
175  3, {POS(-1, 1), POS(-1, -1), POS(1, 1)}, 1, {POS(1, -1)}},
176  {__LINE__, GM_ADVANCED, {XCENTER, YCENTER}, TA_LEFT | TA_BOTTOM, {0, 1, 0, 1, 0, 0}, FALSE, L"209.bmp", NO_TRANS_1},
177  {__LINE__, GM_ADVANCED, {XCENTER, YCENTER}, TA_LEFT | TA_BOTTOM, {1, 1, 1, 1, 0, 0}, FALSE, L"210.bmp", NO_TRANS_1},
178  {__LINE__, GM_ADVANCED, {XCENTER, YCENTER}, TA_LEFT | TA_BOTTOM, {0, 0, 0, 0, 0, 0}, FALSE, L"211.bmp", NO_TRANS_1},
179  {__LINE__, GM_ADVANCED, {XCENTER, YCENTER}, TA_LEFT | TA_BOTTOM, {0, 0, 0, 0, 1000, 0}, FALSE, L"212.bmp", NO_TRANS_1},
180  {__LINE__, GM_ADVANCED, {XCENTER, YCENTER}, TA_LEFT | TA_BOTTOM, {0, 0, 0, 0, 0, 1000}, FALSE, L"213.bmp", NO_TRANS_1},
181 
182  // GM_ADVANCED TA_LEFT TA_TOP
183  {__LINE__, GM_ADVANCED, {0, 0}, TA_LEFT | TA_TOP, {2, 0, 0, 1, 0, 0}, TRUE, L"300.bmp",
184  4, {POS(-1, -1), POS(-1, 1), POS(1, -1), POS(1, 1)}, 2, {POS(-3, -3), POS(-1, -3)}},
185  {__LINE__, GM_ADVANCED, {0, 0}, TA_LEFT | TA_TOP, {1, 0, 0, 2, 0, 0}, TRUE, L"301.bmp",
186  4, {POS(-1, -1), POS(-1, 1), POS(1, -1), POS(1, 1)}, 2, {POS(-3, -3), POS(-3, -1)}},
187  {__LINE__, GM_ADVANCED, {0, 0}, TA_LEFT | TA_TOP, {2, 0, 0, 1, WIDTH/4, 0}, TRUE, L"302.bmp",
188  3, {POS(-1, 1), POS(1, -1), POS(1, 1)}, 2, {POS(-1, -3), POS(1, -3)}},
189  {__LINE__, GM_ADVANCED, {0, 0}, TA_LEFT | TA_TOP, {1, 0, 0, 2, WIDTH/4, 0}, TRUE, L"303.bmp",
190  3, {POS(-1, 1), POS(1, -1), POS(1, 1)}, 2, {POS(-1, -3), POS(-1, -1)}},
191  {__LINE__, GM_ADVANCED, {0, 0}, TA_LEFT | TA_TOP, {2, 0, 0, 1, 0, HEIGHT/4}, TRUE, L"304.bmp",
192  3, {POS(-1, 1), POS(1, -1), POS(1, 1)}, 2, {POS(-3, -1), POS(-1, -1)}},
193  {__LINE__, GM_ADVANCED, {0, 0}, TA_LEFT | TA_TOP, {1, 0, 0, 2, 0, HEIGHT/4}, TRUE, L"305.bmp",
194  4, {POS(-1, -1), POS(-1, 1), POS(1, -1), POS(1, 1)}, 2, {POS(-3, -1), POS(-3, 1)}},
195  {__LINE__, GM_ADVANCED, {0, YCENTER}, TA_LEFT | TA_TOP, {2, 0, 0, 1, 0, 0}, TRUE, L"306.bmp",
196  3, {POS(-1, -1), POS(1, -1), POS(1, 1)}, 2, {POS(-3, 1), POS(-1, 1)}},
197  {__LINE__, GM_ADVANCED, {0, YCENTER}, TA_LEFT | TA_TOP, {1, 0, 0, 2, 0, -HEIGHT/2}, TRUE, L"307.bmp",
198  4, {POS(-1, -1), POS(-1, 1), POS(1, -1), POS(1, 1)}, 2, {POS(-3, 3), POS(-3, 1)}},
199  {__LINE__, GM_ADVANCED, {0, YCENTER}, TA_LEFT | TA_TOP, {2, 0, 0, 1, WIDTH/4, 0}, TRUE, L"308.bmp",
200  2, {POS(-1, -1), POS(1, -1)}, 2, {POS(-1, 1), POS(1, 1)}},
201  {__LINE__, GM_ADVANCED, {0, YCENTER}, TA_LEFT | TA_TOP, {1, 0, 0, 2, WIDTH/4, -HEIGHT/2}, TRUE, L"309.bmp",
202  3, {POS(-1, -1), POS(1, -1), POS(1, 1)}, 2, {POS(-1, 1), POS(-1, 3)}},
203  {__LINE__, GM_ADVANCED, {0, YCENTER}, TA_LEFT | TA_TOP, {2, 0, 0, 1, 0, HEIGHT/4}, TRUE, L"310.bmp",
204  4, {POS(-1, -1), POS(1, -1), POS(1, -1), POS(1, 1)}, 2, {POS(-3, 3), POS(-1, 3)}},
205  {__LINE__, GM_ADVANCED, {0, YCENTER}, TA_LEFT | TA_TOP, {1, 0, 0, 2, 0, -HEIGHT/2}, TRUE, L"311.bmp",
206  4, {POS(-1, -1), POS(1, -1), POS(1, -1), POS(1, 1)}, 2, {POS(-3, 3), POS(-3, 1)}},
207 
208  // GM_ADVANCED TA_CENTER TA_TOP
209  {__LINE__, GM_ADVANCED, {XCENTER, 0}, TA_CENTER | TA_TOP, {2, 0, 0, 1, -WIDTH/4, 0}, TRUE, L"400.bmp",
210  4, {POS(-1, -1), POS(-1, 1), POS(1, -1), POS(1, 1)}, 2, {POS(1, -3), POS(3, -3)}},
211  {__LINE__, GM_ADVANCED, {XCENTER, 0}, TA_CENTER | TA_TOP, {1, 0, 0, 2, WIDTH/8, 0}, TRUE, L"401.bmp",
212  3, {POS(-1, -1), POS(-1, 1), POS(1, 1)}, 2, {POS(1, -3), POS(1, -1)}},
213  {__LINE__, GM_ADVANCED, {XCENTER, 0}, TA_CENTER | TA_TOP, {2, 0, 0, 2, -WIDTH/4, HEIGHT/4}, TRUE, L"402.bmp",
214  2, {POS(-1, 1), POS(-1, -1)}, 4, {POS(1, -1), POS(3, -1), POS(1, 1), POS(3, 1)}},
215  {__LINE__, GM_ADVANCED, {XCENTER, 0}, TA_CENTER | TA_TOP, {1, 0, 0, 2, WIDTH/8, 0}, TRUE, L"403.bmp",
216  3, {POS(-1, -1), POS(-1, 1), POS(1, 1)}, 2, {POS(1, -1), POS(1, -3)}},
217  {__LINE__, GM_ADVANCED, {XCENTER, 0}, TA_CENTER | TA_TOP, {2, 0, 0, 1, -WIDTH/4, HEIGHT/4}, TRUE, L"404.bmp",
218  2, {POS(-1, 1), POS(1, 1)}, 2, {POS(1, -1), POS(3, -1)}},
219  {__LINE__, GM_ADVANCED, {XCENTER, 0}, TA_CENTER | TA_TOP, {1, 0, 0, 2, WIDTH/8, HEIGHT/4}, TRUE, L"405.bmp",
220  2, {POS(-1, -1), POS(-1, 1)}, 2, {POS(1, -1), POS(1, 1)}},
221  {__LINE__, GM_ADVANCED, {0, YCENTER}, TA_CENTER | TA_TOP, {1, 0, 0, 2, WIDTH/8, -HEIGHT/2}, TRUE, L"406.bmp",
222  4, {POS(-1, -1), POS(1, -1), POS(-1, 1), POS(1, 1)}, 2, {POS(-3, 1), POS(-3, 3)}},
223  {__LINE__, GM_ADVANCED, {0, YCENTER}, TA_CENTER | TA_TOP, {2, 0, 0, 1, WIDTH/4, -HEIGHT/2}, TRUE, L"407.bmp",
224  4, {POS(-1, -1), POS(1, -1), POS(-1, 1), POS(1, 1)}, 2, {POS(-3, -3), POS(-1, -3)}},
225  {__LINE__, GM_ADVANCED, {0, YCENTER}, TA_CENTER | TA_TOP, {2, 0, 0, 2, WIDTH/4, -HEIGHT/2}, TRUE, L"408.bmp",
226  3, {POS(-1, -1), POS(1, -1), POS(1, 1)}, 4, {POS(-3, 3), POS(-3, 1), POS(-3, 1), POS(-1, 1)}},
227  {__LINE__, GM_ADVANCED, {0, YCENTER}, TA_CENTER | TA_TOP, {1, 0, 0, 2, WIDTH/8, -HEIGHT/2}, TRUE, L"409.bmp",
228  4, {POS(-1, -1), POS(-1, 1), POS(1, -1), POS(1, 1)}, 2, {POS(-3, 3), POS(-3, 1)}},
229  {__LINE__, GM_ADVANCED, {0, YCENTER}, TA_CENTER | TA_TOP, {2, 0, 0, 1, WIDTH/4, -HEIGHT/2}, TRUE, L"410.bmp",
230  4, {POS(-1, -1), POS(-1, 1), POS(1, -1), POS(1, 1)}, 2, {POS(-3, -3), POS(-1, -3)}},
231  {__LINE__, GM_ADVANCED, {0, YCENTER}, TA_CENTER | TA_TOP, {1, 0, 0, 2, WIDTH/8, -HEIGHT/2}, TRUE, L"411.bmp",
232  4, {POS(-1, -1), POS(-1, 1), POS(1, -1), POS(1, 1)}, 2, {POS(-3, 1), POS(-3, 3)}},
233 
234  // GM_ADVANCED TA_RIGHT TA_TOP
235  {__LINE__, GM_ADVANCED, {XCENTER, 0}, TA_RIGHT | TA_TOP, {2, 0, 0, 1, -WIDTH/4, 0}, TRUE, L"500.bmp",
236  4, {POS(-1, -1), POS(-1, 1), POS(1, -1), POS(1, 1)}, 2, {POS(-1, -3), POS(1, -3)}},
237  {__LINE__, GM_ADVANCED, {XCENTER, 0}, TA_RIGHT | TA_TOP, {1, 0, 0, 2, WIDTH/4, 0}, TRUE, L"501.bmp",
238  3, {POS(-1, -1), POS(-1, 1), POS(1, 1)}, 2, {POS(1, -3), POS(1, -1)}},
239  {__LINE__, GM_ADVANCED, {XCENTER, 0}, TA_RIGHT | TA_TOP, {2, 0, 0, 2, -WIDTH/4, HEIGHT/4}, TRUE, L"502.bmp",
240  0, {POS(0, 0)}, 4, {POS(-1, -1), POS(1, -1), POS(1, -1), POS(-1, -1)}},
241  {__LINE__, GM_ADVANCED, {XCENTER, 0}, TA_RIGHT | TA_TOP, {1, 0, 0, 2, WIDTH/4, 0}, TRUE, L"503.bmp",
242  3, {POS(-1, 1), POS(1, 1), POS(-1, -1)}, 2, {POS(1, -1), POS(1, -3)}},
243  {__LINE__, GM_ADVANCED, {XCENTER, 0}, TA_RIGHT | TA_TOP, {2, 0, 0, 1, -WIDTH/4, HEIGHT/4}, TRUE, L"504.bmp",
244  2, {POS(-1, 1), POS(1, 1)}, 2, {POS(-1, -1), POS(1, -1)}},
245  {__LINE__, GM_ADVANCED, {XCENTER, 0}, TA_RIGHT | TA_TOP, {1, 0, 0, 2, WIDTH/4, HEIGHT/4}, TRUE, L"505.bmp",
246  2, {POS(-1, -1), POS(-1, 1)}, 2, {POS(1, -1), POS(1, 1)}},
247  {__LINE__, GM_ADVANCED, {0, YCENTER}, TA_RIGHT | TA_TOP, {2, 0, 0, 1, WIDTH/2, -HEIGHT/2}, TRUE, L"506.bmp",
248  4, {POS(-1, -1), POS(-1, 1), POS(1, -1), POS(1, 1)}, 2, {POS(-3, -3), POS(-1, -3)}},
249  {__LINE__, GM_ADVANCED, {0, YCENTER}, TA_RIGHT | TA_TOP, {1, 0, 0, 2, WIDTH/2, -HEIGHT/2}, TRUE, L"507.bmp",
250  3, {POS(-1, -1), POS(1, -1), POS(1, 1)}, 2, {POS(-1, 3), POS(-1, 1)}},
251  {__LINE__, GM_ADVANCED, {0, YCENTER}, TA_RIGHT | TA_TOP, {2, 0, 0, 2, WIDTH, -HEIGHT/2}, TRUE, L"508.bmp",
252  3, {POS(-1, -1), POS(-1, 1), POS(1, -1)}, 4, {POS(1, 1), POS(3, 1), POS(1, 3), POS(3, 3)}},
253  {__LINE__, GM_ADVANCED, {0, YCENTER}, TA_RIGHT | TA_TOP, {1, 0, 0, 2, WIDTH/2, -HEIGHT/2}, TRUE, L"509.bmp",
254  3, {POS(-1, -1), POS(1, -1), POS(1, 1)}, 2, {POS(-1, 1), POS(-1, 3)}},
255  {__LINE__, GM_ADVANCED, {0, YCENTER}, TA_RIGHT | TA_TOP, {2, 0, 0, 1, WIDTH/2, -HEIGHT/4}, TRUE, L"510.bmp",
256  3, {POS(-1, 1), POS(1, -1), POS(1, 1)}, 2, {POS(-3, -1), POS(-1, -1)}},
257  {__LINE__, GM_ADVANCED, {0, YCENTER}, TA_RIGHT | TA_TOP, {1, 0, 0, 2, WIDTH/2, -HEIGHT/2}, TRUE, L"511.bmp",
258  3, {POS(-1, -1), POS(1, -1), POS(1, 1)}, 2, {POS(-1, 1), POS(-1, 3)}},
259 };
260 static const INT s_entry_count = (INT)(sizeof(s_entries) / sizeof(s_entries[0]));
261 
263 {
264  HGDIOBJ hbmOld, hPenOld;
265  INT i;
266  COLORREF rgb;
267  BOOL ret;
268  static const WCHAR s_chBlackBox = L'g';
269 
270  SetGraphicsMode(hDC, entry->GraphicsMode);
271 
272  hbmOld = SelectObject(hDC, hbm);
273  {
275 
277 
278  hPenOld = SelectObject(hDC, s_hRedPen);
279  {
280  MoveToEx(hDC, XCENTER / 2, 0, NULL);
281  LineTo(hDC, XCENTER / 2, HEIGHT);
282 
283  MoveToEx(hDC, XCENTER, 0, NULL);
285 
286  MoveToEx(hDC, XCENTER * 3 / 2, 0, NULL);
287  LineTo(hDC, XCENTER * 3 / 2, HEIGHT);
288 
289  MoveToEx(hDC, 0, YCENTER / 2, NULL);
290  LineTo(hDC, WIDTH, YCENTER / 2);
291 
292  MoveToEx(hDC, 0, YCENTER, NULL);
293  LineTo(hDC, WIDTH, YCENTER);
294 
295  MoveToEx(hDC, 0, YCENTER * 3 / 2, NULL);
296  LineTo(hDC, WIDTH, YCENTER * 3 / 2);
297  }
298  SelectObject(hDC, hPenOld);
299 
300  ret = SetWorldTransform(hDC, &entry->xform);
301  ok(ret == entry->xform_ok, "Line %d: SetWorldTransform returned %d\n", entry->line, ret);
302 
303  SetTextAlign(hDC, entry->TextAlign);
304 
305  TextOutW(hDC, entry->ptRef.x, entry->ptRef.y, &s_chBlackBox, 1);
306 
308 
309  for (i = 0; i < entry->cWhitePoints; ++i)
310  {
311  rgb = GetPixel(hDC, entry->WhitePoints[i].x, entry->WhitePoints[i].y);
312  ok(rgb == WHITE, "Line %d: %d: (%ld, %ld) is not white\n", entry->line, i,
313  entry->WhitePoints[i].x, entry->WhitePoints[i].y);
314  }
315 
316  for (i = 0; i < entry->cBlackPoints; ++i)
317  {
318  rgb = GetPixel(hDC, entry->BlackPoints[i].x, entry->BlackPoints[i].y);
319  ok(rgb == BLACK, "Line %d: %d: (%ld, %ld) is not black\n", entry->line, i,
320  entry->BlackPoints[i].x, entry->BlackPoints[i].y);
321  }
322  }
323  SelectObject(hDC, hbmOld);
324 
325  SaveBitmapToFile(entry->filename, hbm);
326 }
327 
328 START_TEST(TextTransform)
329 {
330  HDC hDC;
331  BITMAPINFO bmi;
332  LPVOID pvBits;
333  HBITMAP hbm;
334  LOGFONTA lf;
335  HFONT hFont;
336  HGDIOBJ hFontOld;
337  INT i;
338 
340  s_hRedPen = CreatePen(PS_SOLID, 1, RGB(255, 0, 0));
341 
343  ok(hDC != NULL, "hDC was NULL.\n");
344 
347 
348  ZeroMemory(&bmi, sizeof(bmi));
349  bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
350  bmi.bmiHeader.biWidth = WIDTH;
351  bmi.bmiHeader.biHeight = HEIGHT;
352  bmi.bmiHeader.biPlanes = 1;
353  bmi.bmiHeader.biBitCount = 24;
354  hbm = CreateDIBSection(hDC, &bmi, DIB_RGB_COLORS, &pvBits, NULL, 0);
355  ok(hbm != NULL, "hbm was NULL.\n");
356 
357  ZeroMemory(&lf, sizeof(lf));
358  lf.lfHeight = LFHEIGHT;
360  lstrcpyA(lf.lfFaceName, "Marlett");
361  hFont = CreateFontIndirectA(&lf);
362  ok(hFont != NULL, "hFont was NULL.\n");
363 
364  hFontOld = SelectObject(hDC, hFont);
365  for (i = 0; i < s_entry_count; ++i)
366  {
368  }
369  SelectObject(hDC, hFontOld);
370 
372  DeleteObject(hbm);
373 
376 
377  DeleteDC(hDC);
378 }
HGDIOBJ WINAPI GetStockObject(_In_ int)
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
#define TRUE
Definition: types.h:120
HPEN WINAPI CreatePen(_In_ int, _In_ int, _In_ COLORREF)
#define CloseHandle
Definition: compat.h:406
static HPEN s_hRedPen
BITMAPINFOHEADER bmiHeader
Definition: wingdi.h:1471
static void DoTestEntry(const TEST_ENTRY *entry, HDC hDC, HBITMAP hbm)
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
static const TEST_ENTRY s_entries[]
HFONT WINAPI CreateFontIndirectA(_In_ const LOGFONTA *)
#define SaveBitmapToFile(f, h)
Definition: TextTransform.c:17
struct tagBITMAPINFOHEADER BITMAPINFOHEADER
BITMAPINFOHEADER bmiHeader
Definition: TextTransform.c:12
#define INT
Definition: polytest.cpp:20
static HDC
Definition: imagelist.c:92
#define HEIGHT
#define YCENTER
POINT ptRef
Definition: TextTransform.c:93
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
#define INVALID_HANDLE_VALUE
Definition: compat.h:399
#define ZeroMemory
Definition: winbase.h:1642
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
BOOL WINAPI LineTo(_In_ HDC, _In_ int, _In_ int)
#define WHITE_BRUSH
Definition: wingdi.h:901
BYTE lfCharSet
Definition: dimm.idl:50
static HBRUSH s_hWhiteBrush
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
#define TA_LEFT
Definition: wingdi.h:931
#define LFHEIGHT
BOOL xform_ok
Definition: TextTransform.c:96
UINT WINAPI SetTextAlign(_In_ HDC, _In_ UINT)
Definition: text.c:853
DWORD GetPixel(LPDIRECTDRAWSURFACE7 Surface, UINT x, UINT y)
Definition: blt.cpp:2
#define DEFAULT_CHARSET
Definition: wingdi.h:383
POINT WhitePoints[4]
Definition: TextTransform.c:99
int32_t INT
Definition: typedefs.h:56
HFONT hFont
Definition: main.c:53
#define FILE_SHARE_READ
Definition: compat.h:125
BOOL WINAPI SetWorldTransform(_In_ HDC, _In_ const XFORM *)
#define POS(ix, iy)
static const RECT s_rc
BOOL WINAPI MoveToEx(_In_ HDC, _In_ int, _In_ int, _Out_opt_ LPPOINT)
#define PS_SOLID
Definition: wingdi.h:585
#define TA_TOP
Definition: wingdi.h:929
int WINAPI SetBkMode(_In_ HDC, _In_ int)
Definition: dc.c:1032
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int BOOL
Definition: ntddk_ex.h:94
INT cWhitePoints
Definition: TextTransform.c:98
int WINAPI SetMapMode(_In_ HDC, _In_ int)
LONG lfHeight
Definition: dimm.idl:42
#define GENERIC_WRITE
Definition: nt_native.h:90
#define FAR
Definition: guiddef.h:36
DWORD biCompression
Definition: amvideo.idl:35
WORD WORD PSZ PSZ pszFileName
Definition: vdmdbg.h:41
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
Definition: delete.c:39
#define TRANSPARENT
Definition: wingdi.h:949
#define TA_BOTTOM
Definition: wingdi.h:928
smooth NULL
Definition: ftsmooth.c:416
#define XCENTER
XFORM xform
Definition: TextTransform.c:95
POINT BlackPoints[4]
INT TextAlign
Definition: TextTransform.c:94
#define TA_RIGHT
Definition: wingdi.h:932
#define FILE_FLAG_WRITE_THROUGH
Definition: disk.h:47
GLfloat f
Definition: glext.h:7540
struct tagBITMAPINFOEX BITMAPINFOEX
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
RGBQUAD bmiColors[1]
Definition: wingdi.h:1472
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define BLACK
DWORD COLORREF
Definition: windef.h:285
BOOL WINAPI ModifyWorldTransform(_In_ HDC, _In_opt_ const XFORM *, _In_ DWORD)
#define RGB(r, g, b)
Definition: wingdi.h:2935
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD biSizeImage
Definition: amvideo.idl:36
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
#define GM_COMPATIBLE
Definition: wingdi.h:863
struct TEST_ENTRY TEST_ENTRY
LPCWSTR filename
Definition: TextTransform.c:97
int ret
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:126
RGBQUAD bmiColors[256]
Definition: TextTransform.c:13
#define WHITE
Definition: cmd.c:12
static const WCHAR L[]
Definition: oid.c:1250
INT cBlackPoints
#define MM_ANISOTROPIC
Definition: wingdi.h:866
uint32_t entry
Definition: isohybrid.c:63
START_TEST(TextTransform)
struct tagBITMAPINFOEX * LPBITMAPINFOEX
#define NO_TRANS_1
_In_ HANDLE hFile
Definition: mswsock.h:90
BOOL WINAPI TextOutW(_In_ HDC hdc, _In_ int x, _In_ int y, _In_reads_(c) LPCWSTR lpString, _In_ int c)
INT line
Definition: cmd.c:14
#define WIDTH
static HDC hDC
Definition: 3dtext.c:33
int WINAPI GetObjectW(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
#define CREATE_ALWAYS
Definition: disk.h:72
_In_ ULONG _In_ ULONG rgb
Definition: winddi.h:3520
BOOL WINAPI DeleteDC(_In_ HDC)
#define f
Definition: ke_i.h:83
HBITMAP WINAPI CreateDIBSection(HDC hDC, CONST BITMAPINFO *BitmapInfo, UINT Usage, VOID **Bits, HANDLE hSection, DWORD dwOffset)
Definition: bitmap.c:197
struct tagBITMAPFILEHEADER BITMAPFILEHEADER
_In_ HBITMAP hbm
Definition: ntgdi.h:2776
#define ok(value,...)
Definition: atltest.h:57
Definition: bl.h:1331
#define CreateFileW
Definition: compat.h:408
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
#define MWT_IDENTITY
Definition: wingdi.h:943
static HMODULE MODULEINFO DWORD cb
Definition: module.c:32
static const INT s_entry_count
int WINAPI GetDIBits(_In_ HDC hdc, _In_ HBITMAP hbm, _In_ UINT start, _In_ UINT cLines, _Out_opt_ LPVOID lpvBits, _At_((LPBITMAPINFOHEADER) lpbmi, _Inout_) LPBITMAPINFO lpbmi, _In_ UINT usage)
#define NO_TRANS_2
CHAR lfFaceName[LF_FACESIZE]
Definition: dimm.idl:55
INT GraphicsMode
Definition: TextTransform.c:92
static HBITMAP
Definition: button.c:44
#define TA_CENTER
Definition: wingdi.h:930
#define DIB_RGB_COLORS
Definition: wingdi.h:366
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
int WINAPI SetGraphicsMode(_In_ HDC, _In_ int)
Definition: dc.c:1202
#define BI_RGB
Definition: precomp.h:34
#define HeapFree(x, y, z)
Definition: compat.h:402
#define GM_ADVANCED
Definition: wingdi.h:864