ReactOS 0.4.17-dev-357-ga8f14ff
dib.cpp
Go to the documentation of this file.
1/*
2 * PROJECT: PAINT for ReactOS
3 * LICENSE: LGPL-2.0-or-later (https://spdx.org/licenses/LGPL-2.0-or-later)
4 * PURPOSE: Some DIB related functions
5 * COPYRIGHT: Copyright 2015 Benedikt Freisen <b.freisen@gmx.net>
6 */
7
8#include "precomp.h"
9
11float g_xDpi = 96;
12float g_yDpi = 96;
14
15#define WIDTHBYTES(i) (((i) + 31) / 32 * 4)
16
18{
20};
21
22/* FUNCTIONS ********************************************************/
23
24// Convert DPI (dots per inch) into PPCM (pixels per centimeter)
25float PpcmFromDpi(float dpi)
26{
27 // 1 DPI is 0.0254 meter. 1 centimeter is 1/100 meter.
28 return dpi / (0.0254f * 100.0f);
29}
30
33{
34 BITMAPINFO bmi;
35 ZeroMemory(&bmi, sizeof(BITMAPINFO));
36 bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
39 bmi.bmiHeader.biPlanes = 1;
40 bmi.bmiHeader.biBitCount = 24;
41 return CreateDIBSection(NULL, &bmi, DIB_RGB_COLORS, NULL, NULL, 0);
42}
43
46{
48 if (hbm == NULL)
49 return NULL;
50
51 if (bWhite)
52 {
54 HGDIOBJ hbmOld = SelectObject(hdc, hbm);
55 RECT rc = { 0, 0, width, height };
56 FillRect(hdc, &rc, (HBRUSH)GetStockObject(WHITE_BRUSH));
57 SelectObject(hdc, hbmOld);
59 }
60
61 return hbm;
62}
63
66{
68 if (!ret)
69 return NULL;
70
71 if (rgb)
72 {
74 HGDIOBJ hbmOld = SelectObject(hdc, ret);
75 RECT rc;
76 SetRect(&rc, 0, 0, width, height);
77 HBRUSH hbr = CreateSolidBrush(rgb);
78 FillRect(hdc, &rc, hbr);
79 DeleteObject(hbr);
80 SelectObject(hdc, hbmOld);
82 }
83
84 return ret;
85}
86
88{
89 BITMAP bm;
90 if (!::GetObjectW(hbm, sizeof(bm), &bm))
91 return NULL;
92
93 if (cx == 0 || cy == 0)
94 {
95 cx = bm.bmWidth;
96 cy = bm.bmHeight;
97 }
98
101 HBITMAP hbmNew = ::CreateBitmap(cx, cy, 1, 1, NULL);
102 HGDIOBJ hbm1Old = ::SelectObject(hdc1, hbm);
103 HGDIOBJ hbm2Old = ::SelectObject(hdc2, hbmNew);
104 ::SetStretchBltMode(hdc2, stretchMode);
105 ::StretchBlt(hdc2, 0, 0, cx, cy, hdc1, 0, 0, bm.bmWidth, bm.bmHeight, SRCCOPY);
106 ::SelectObject(hdc1, hbm1Old);
107 ::SelectObject(hdc2, hbm2Old);
110 return hbmNew;
111}
112
114{
115 if (stretchMode == STRETCH_HALFTONE)
117
118 BITMAP bm;
119 if (!::GetObjectW(hbm, sizeof(bm), &bm))
120 return NULL;
121
122 if (cx == 0 || cy == 0)
123 {
124 cx = bm.bmWidth;
125 cy = bm.bmHeight;
126 }
127
131 HGDIOBJ hbm1Old = ::SelectObject(hdc1, hbm);
132 HGDIOBJ hbm2Old = ::SelectObject(hdc2, hbmNew);
133 ::SetStretchBltMode(hdc2, stretchMode);
134 ::StretchBlt(hdc2, 0, 0, cx, cy, hdc1, 0, 0, bm.bmWidth, bm.bmHeight, SRCCOPY);
135 ::SelectObject(hdc1, hbm1Old);
136 ::SelectObject(hdc2, hbm2Old);
139 return hbmNew;
140}
141
142HBITMAP CachedBufferDIB(HBITMAP hbm, int minimalWidth, int minimalHeight)
143{
144 if (minimalWidth <= 0)
145 minimalWidth = 1;
146 if (minimalHeight <= 0)
147 minimalHeight = 1;
148
149 BITMAP bm;
150 if (!GetObjectW(hbm, sizeof(bm), &bm))
151 hbm = NULL;
152
153 if (hbm && minimalWidth <= bm.bmWidth && minimalHeight <= bm.bmHeight)
154 return hbm;
155
156 if (hbm)
158
159 return CreateDIBWithProperties((minimalWidth * 3) / 2, (minimalHeight * 3) / 2);
160}
161
162int
164{
165 BITMAP bm;
166 ::GetObjectW(hBitmap, sizeof(BITMAP), &bm);
167 return bm.bmWidth;
168}
169
170int
172{
173 BITMAP bm;
174 ::GetObjectW(hBitmap, sizeof(BITMAP), &bm);
175 return bm.bmHeight;
176}
177
179{
180 CWaitCursor waitCursor;
181
183 img.Attach(hBitmap);
184 HRESULT hr = img.SaveDx(FileName, guidFileType, g_xDpi, g_yDpi);
185 img.Detach();
186
187 if (FAILED(hr))
188 {
190 return FALSE;
191 }
192
193 if (!fIsMainFile)
194 return TRUE;
195
198 if (hFind == INVALID_HANDLE_VALUE)
199 {
201 return FALSE;
202 }
203 ::FindClose(hFind);
204
207 return TRUE;
208}
209
211{
212 // update file time and size
213 if (pFound)
214 {
215 FILETIME ft;
218
219 g_fileSize = pFound->nFileSizeLow;
220 }
221 else
222 {
224 g_fileSize = 0;
225 }
226
227 // update g_szFileName
228 if (name && name[0])
229 {
230 CStringW strName = name;
232 // The following code won't work correctly when (name == g_szFileName):
233 // ::GetFullPathNameW(name, _countof(g_szFileName), g_szFileName, NULL);
234 }
235 else
236 {
238 }
239
240 // set title
241 CStringW strTitle;
243 mainWindow.SetWindowText(strTitle);
244
245 // update file info and recent
246 g_isAFile = isAFile;
247 if (g_isAFile)
249
251}
252
254{
255 COLORREF white = RGB(255, 255, 255);
257 if (hBitmap == NULL)
258 {
261 return NULL;
262 }
263
264 HDC hScreenDC = ::GetDC(NULL);
265 g_xDpi = (float)::GetDeviceCaps(hScreenDC, LOGPIXELSX);
266 g_yDpi = (float)::GetDeviceCaps(hScreenDC, LOGPIXELSY);
267 ::ReleaseDC(NULL, hScreenDC);
268
269 return SetBitmapAndInfo(hBitmap, name, pFound, isFile);
270}
271
273{
274 // update image
278
279 SetFileInfo(name, pFound, isFile);
281 return hBitmap;
282}
283
285{
286 CWaitCursor waitCursor;
287
288 // find the file
290 HANDLE hFind = ::FindFirstFileW(name, &find);
291 if (hFind == INVALID_HANDLE_VALUE) // does not exist
292 {
294 return NULL;
295 }
296 ::FindClose(hFind);
297
298 // is file empty?
299 if (find.nFileSizeLow == 0 && find.nFileSizeHigh == 0)
300 {
301 if (fIsMainFile)
302 return InitializeImage(name, &find, TRUE);
303 }
304
305 // load the image
307 float xDpi = 0, yDpi = 0;
308 HRESULT hr = img.LoadDx(name, &xDpi, &yDpi);
309 if (FAILED(hr) && fIsMainFile)
310 {
312 hr = img.LoadDx(name, &xDpi, &yDpi);
313 }
314 if (FAILED(hr))
315 {
316 ATLTRACE("hr: 0x%08lX\n", hr);
318 return NULL;
319 }
320
321 HBITMAP hBitmap = img.Detach();
322 if (!fIsMainFile)
323 return hBitmap;
324
325 if (xDpi <= 0 || yDpi <= 0)
326 {
327 HDC hDC = ::GetDC(NULL);
331 }
332
333 g_xDpi = xDpi;
334 g_yDpi = yDpi;
335
337 return hBitmap;
338}
339
341{
342 HBITMAP hbm2;
343 if (bMono)
344 hbm2 = ::CreateBitmap(cy, cx, 1, 1, NULL);
345 else
347 if (!hbm2)
348 return NULL;
349
351 HGDIOBJ hbm2Old = SelectObject(hDC2, hbm2);
352 if (bRight)
353 {
354 for (INT y = 0; y < cy; ++y)
355 {
356 for (INT x = 0; x < cx; ++x)
357 {
358 COLORREF rgb = GetPixel(hDC1, x, y);
359 SetPixelV(hDC2, cy - (y + 1), x, rgb);
360 }
361 }
362 }
363 else
364 {
365 for (INT y = 0; y < cy; ++y)
366 {
367 for (INT x = 0; x < cx; ++x)
368 {
369 COLORREF rgb = GetPixel(hDC1, x, y);
370 SetPixelV(hDC2, y, cx - (x + 1), rgb);
371 }
372 }
373 }
374 SelectObject(hDC2, hbm2Old);
375 DeleteDC(hDC2);
376 return hbm2;
377}
378
379HBITMAP SkewDIB(HDC hDC1, HBITMAP hbm, INT nDegree, BOOL bVertical, BOOL bMono)
380{
381 CWaitCursor waitCursor;
382
383 if (nDegree == 0)
384 return CopyDIBImage(hbm);
385
386 const double eTan = tan(abs(nDegree) * M_PI / 180);
387
388 BITMAP bm;
389 ::GetObjectW(hbm, sizeof(bm), &bm);
390 INT cx = bm.bmWidth, cy = bm.bmHeight, dx = 0, dy = 0;
391 if (bVertical)
392 dy = INT(cx * eTan);
393 else
394 dx = INT(cy * eTan);
395
396 if (dx == 0 && dy == 0)
397 return CopyDIBImage(hbm);
398
399 HBITMAP hbmNew;
400 if (bMono)
401 hbmNew = CreateMonoBitmap(cx + dx, cy + dy, FALSE);
402 else
403 hbmNew = CreateColorDIB(cx + dx, cy + dy, RGB(255, 255, 255));
404 if (!hbmNew)
405 return NULL;
406
408 HGDIOBJ hbm2Old = SelectObject(hDC2, hbmNew);
409 if (bVertical)
410 {
411 for (INT x = 0; x < cx; ++x)
412 {
413 INT delta = INT(x * eTan);
414 if (nDegree > 0)
415 ::BitBlt(hDC2, x, (dy - delta), 1, cy, hDC1, x, 0, SRCCOPY);
416 else
417 ::BitBlt(hDC2, x, delta, 1, cy, hDC1, x, 0, SRCCOPY);
418 }
419 }
420 else
421 {
422 for (INT y = 0; y < cy; ++y)
423 {
424 INT delta = INT(y * eTan);
425 if (nDegree > 0)
426 ::BitBlt(hDC2, (dx - delta), y, cx, 1, hDC1, 0, y, SRCCOPY);
427 else
428 ::BitBlt(hDC2, delta, y, cx, 1, hDC1, 0, y, SRCCOPY);
429 }
430 }
431
432 SelectObject(hDC2, hbm2Old);
433 DeleteDC(hDC2);
434 return hbmNew;
435}
436
437HBITMAP getSubImage(HBITMAP hbmWhole, const RECT& rcPartial)
438{
439 CRect rc = rcPartial;
440 HBITMAP hbmPart = CreateDIBWithProperties(rc.Width(), rc.Height());
441 if (!hbmPart)
442 return NULL;
443
446 HGDIOBJ hbm1Old = ::SelectObject(hDC1, hbmWhole);
447 HGDIOBJ hbm2Old = ::SelectObject(hDC2, hbmPart);
448 ::BitBlt(hDC2, 0, 0, rc.Width(), rc.Height(), hDC1, rc.left, rc.top, SRCCOPY);
449 ::SelectObject(hDC1, hbm1Old);
450 ::SelectObject(hDC2, hbm2Old);
451 ::DeleteDC(hDC1);
452 ::DeleteDC(hDC2);
453 return hbmPart;
454}
455
456void putSubImage(HBITMAP hbmWhole, const RECT& rcPartial, HBITMAP hbmPart)
457{
458 CRect rc = rcPartial;
461 HGDIOBJ hbm1Old = ::SelectObject(hDC1, hbmWhole);
462 HGDIOBJ hbm2Old = ::SelectObject(hDC2, hbmPart);
463 ::BitBlt(hDC1, rc.left, rc.top, rc.Width(), rc.Height(), hDC2, 0, 0, SRCCOPY);
464 ::SelectObject(hDC1, hbm1Old);
465 ::SelectObject(hDC2, hbm2Old);
466 ::DeleteDC(hDC1);
467 ::DeleteDC(hDC2);
468}
469
471{
473};
474
476{
477 CWaitCursor waitCursor;
478
479 BITMAP bm;
480 if (!GetObjectW(hBitmap, sizeof(BITMAP), &bm))
481 return NULL;
482
483 BITMAPINFODX bmi;
484 ZeroMemory(&bmi, sizeof(bmi));
485 bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
486 bmi.bmiHeader.biWidth = bm.bmWidth;
487 bmi.bmiHeader.biHeight = bm.bmHeight;
488 bmi.bmiHeader.biPlanes = 1;
492
493 INT cColors;
494 if (bm.bmBitsPixel < 16)
495 cColors = 1 << bm.bmBitsPixel;
496 else
497 cColors = 0;
498
500
501 if (cColors)
502 {
503 HGDIOBJ hbmOld = SelectObject(hDC, hBitmap);
504 cColors = GetDIBColorTable(hDC, 0, cColors, bmi.bmiColors);
505 SelectObject(hDC, hbmOld);
506 }
507
508 DWORD cbColors = cColors * sizeof(RGBQUAD);
509 DWORD dwSize = sizeof(BITMAPINFOHEADER) + cbColors + bmi.bmiHeader.biSizeImage;
511 if (hGlobal)
512 {
513 LPBYTE pb = (LPBYTE)GlobalLock(hGlobal);
514 if (pb)
515 {
516 CopyMemory(pb, &bmi, sizeof(BITMAPINFOHEADER));
517 pb += sizeof(BITMAPINFOHEADER);
518
519 CopyMemory(pb, bmi.bmiColors, cbColors);
520 pb += cbColors;
521
522 GetDIBits(hDC, hBitmap, 0, bm.bmHeight, pb, &bmi, DIB_RGB_COLORS);
523
524 GlobalUnlock(hGlobal);
525 }
526 else
527 {
528 GlobalFree(hGlobal);
529 hGlobal = NULL;
530 }
531 }
532
533 DeleteDC(hDC);
534
535 return hGlobal;
536}
537
539{
540 CWaitCursor waitCursor;
541
542 LPBYTE pb = (LPBYTE)GlobalLock(hGlobal);
543 if (!pb)
544 return NULL;
545
547 pb += pbmi->bmiHeader.biSize;
548
549 INT cColors = 0, cbColors = 0;
550 if (pbmi->bmiHeader.biSize == sizeof(BITMAPCOREHEADER))
551 {
553 WORD BitCount = pbmci->bmciHeader.bcBitCount;
554 if (BitCount < 16)
555 {
556 cColors = (1 << BitCount);
557 cbColors = cColors * sizeof(RGBTRIPLE);
558 pb += cbColors;
559 }
560 }
561 else if (pbmi->bmiHeader.biSize >= sizeof(BITMAPINFOHEADER))
562 {
563 WORD BitCount = pbmi->bmiHeader.biBitCount;
564 if (BitCount < 16)
565 {
566 cColors = (1 << BitCount);
567 cbColors = cColors * sizeof(RGBQUAD);
568 pb += cbColors;
569 }
570 }
571
574 if (hBitmap)
575 {
577 }
578 DeleteDC(hDC);
579
580 GlobalUnlock(hGlobal);
581
582 return hBitmap;
583}
584
585HBITMAP BitmapFromHEMF(HENHMETAFILE hEMF)
586{
587 CWaitCursor waitCursor;
588
590 if (!GetEnhMetaFileHeader(hEMF, sizeof(header), &header))
591 return NULL;
592
593 CRect rc = *(LPRECT)&header.rclBounds;
594 INT cx = rc.Width(), cy = rc.Height();
595 HBITMAP hbm = CreateColorDIB(cx, cy, RGB(255, 255, 255));
596 if (!hbm)
597 return NULL;
598
600 HGDIOBJ hbmOld = SelectObject(hDC, hbm);
601 PlayEnhMetaFile(hDC, hEMF, &rc);
602 SelectObject(hDC, hbmOld);
603 DeleteDC(hDC);
604
605 return hbm;
606}
607
609{
610 CWaitCursor waitCursor;
611
612 BITMAP bm;
613 if (!::GetObjectW(hbm, sizeof(bm), &bm))
614 return FALSE;
615
616 if (bm.bmBitsPixel == 1)
617 return TRUE;
618
619 BITMAPINFOEX bmi;
620 ZeroMemory(&bmi, sizeof(bmi));
621 bmi.bmiHeader.biSize = sizeof(bmi.bmiHeader);
622 bmi.bmiHeader.biWidth = bm.bmWidth;
623 bmi.bmiHeader.biHeight = bm.bmHeight;
624 bmi.bmiHeader.biPlanes = 1;
625 bmi.bmiHeader.biBitCount = 24;
626
627 DWORD widthbytes = WIDTHBYTES(24 * bm.bmWidth);
628 DWORD cbBits = widthbytes * bm.bmHeight;
629 LPBYTE pbBits = new BYTE[cbBits];
630
632 ::GetDIBits(hdc, hbm, 0, bm.bmHeight, pbBits, &bmi, DIB_RGB_COLORS);
634
635 BOOL bBlackAndWhite = TRUE;
636 for (LONG y = 0; y < bm.bmHeight; ++y)
637 {
638 LPBYTE pbLine = &pbBits[widthbytes * y];
639 for (LONG x = 0; x < bm.bmWidth; ++x)
640 {
641 BYTE Blue = *pbLine++;
642 BYTE Green = *pbLine++;
643 BYTE Red = *pbLine++;
644 COLORREF rgbColor = RGB(Red, Green, Blue);
645 if (rgbColor != RGB(0, 0, 0) && rgbColor != RGB(255, 255, 255))
646 {
647 bBlackAndWhite = FALSE;
648 goto Finish;
649 }
650 }
651 }
652
653Finish:
654 delete[] pbBits;
655
656 return bBlackAndWhite;
657}
658
660{
661 CWaitCursor waitCursor;
662
663 BITMAP bm;
664 if (!::GetObjectW(hbm, sizeof(bm), &bm))
665 return NULL;
666
667 BITMAPINFOEX bmi;
668 ZeroMemory(&bmi, sizeof(bmi));
669 bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
670 bmi.bmiHeader.biWidth = bm.bmWidth;
671 bmi.bmiHeader.biHeight = bm.bmHeight;
672 bmi.bmiHeader.biPlanes = 1;
673 bmi.bmiHeader.biBitCount = 1;
674 bmi.bmiColors[1].rgbBlue = 255;
675 bmi.bmiColors[1].rgbGreen = 255;
676 bmi.bmiColors[1].rgbRed = 255;
678 LPVOID pvMonoBits;
679 HBITMAP hMonoBitmap = ::CreateDIBSection(hdc, &bmi, DIB_RGB_COLORS, &pvMonoBits, NULL, 0);
680 if (!hMonoBitmap)
681 {
683 return NULL;
684 }
685
686 HBITMAP hNewBitmap = CreateDIBWithProperties(bm.bmWidth, bm.bmHeight);
687 if (hNewBitmap)
688 {
689 ::GetDIBits(hdc, hbm, 0, bm.bmHeight, pvMonoBits, &bmi, DIB_RGB_COLORS);
690 ::SetDIBits(hdc, hNewBitmap, 0, bm.bmHeight, pvMonoBits, &bmi, DIB_RGB_COLORS);
691 }
692 ::DeleteObject(hMonoBitmap);
694
695 return hNewBitmap;
696}
static HDC hDC
Definition: 3dtext.c:33
HDC hdc1
Definition: SelectObject.c:10
HDC hdc2
Definition: SelectObject.c:10
#define ATLTRACE(format,...)
Definition: atltrace.h:269
VOID ShowError(DWORD dwLastError)
Definition: progress.c:29
BOOL g_imageSaved
Definition: main.cpp:21
WCHAR g_szFileName[MAX_LONG_PATH]
Definition: main.cpp:18
CMainWindow mainWindow
Definition: main.cpp:25
void ShowOutOfMemory(void)
Definition: main.cpp:34
BOOL g_isAFile
Definition: main.cpp:20
HINSTANCE g_hinstExe
Definition: main.cpp:17
RegistrySettings registrySettings
Definition: registry.cpp:14
#define IDS_DEFAULTFILENAME
Definition: resource.h:194
#define IDS_LOADERRORTEXT
Definition: resource.h:222
#define IDS_WINDOWTITLE
Definition: resource.h:189
#define IDS_SAVEERROR
Definition: resource.h:231
DWORD GetPixel(LPDIRECTDRAWSURFACE7 Surface, UINT x, UINT y)
Definition: blt.cpp:2
CCanvasWindow canvasWindow
Definition: canvas.cpp:11
void __cdecl Format(UINT nFormatID,...)
Definition: cstringt.h:818
BOOL SetWindowText(LPCTSTR lpszString)
Definition: atlwin.h:1300
VOID updateScrollPos(INT x=0, INT y=0)
Definition: canvas.cpp:402
int Width() const noexcept
Definition: atltypes.h:461
int Height() const noexcept
Definition: atltypes.h:318
void PushImageForUndo()
Definition: history.cpp:125
void ClearHistory(void)
Definition: history.cpp:114
DWORD BMPWidth
Definition: registry.h:19
void SetMostRecentFile(LPCWSTR szPathName)
Definition: registry.cpp:277
DWORD BMPHeight
Definition: registry.h:18
static TAGID TAGID find
Definition: db.cpp:156
HRESULT hr
Definition: delayimp.cpp:582
void putSubImage(HBITMAP hbmWhole, const RECT &rcPartial, HBITMAP hbmPart)
Definition: dib.cpp:456
HBITMAP CreateDIBWithProperties(int width, int height)
Definition: dib.cpp:32
void SetFileInfo(LPCWSTR name, LPWIN32_FIND_DATAW pFound, BOOL isAFile)
Definition: dib.cpp:210
HBITMAP InitializeImage(LPCWSTR name, LPWIN32_FIND_DATAW pFound, BOOL isFile)
Definition: dib.cpp:253
BOOL SaveDIBToFile(HBITMAP hBitmap, LPCWSTR FileName, BOOL fIsMainFile, REFGUID guidFileType)
Definition: dib.cpp:178
HGLOBAL BitmapToClipboardDIB(HBITMAP hBitmap)
Definition: dib.cpp:475
HBITMAP BitmapFromHEMF(HENHMETAFILE hEMF)
Definition: dib.cpp:585
HBITMAP getSubImage(HBITMAP hbmWhole, const RECT &rcPartial)
Definition: dib.cpp:437
HBITMAP CopyMonoImage(HBITMAP hbm, INT cx, INT cy, INT stretchMode)
Definition: dib.cpp:87
HBITMAP CachedBufferDIB(HBITMAP hbm, int minimalWidth, int minimalHeight)
Definition: dib.cpp:142
HBITMAP BitmapFromClipboardDIB(HGLOBAL hGlobal)
Definition: dib.cpp:538
HBITMAP SkewDIB(HDC hDC1, HBITMAP hbm, INT nDegree, BOOL bVertical, BOOL bMono)
Definition: dib.cpp:379
float g_xDpi
Definition: dib.cpp:11
HBITMAP Rotate90DegreeBlt(HDC hDC1, INT cx, INT cy, BOOL bRight, BOOL bMono)
Definition: dib.cpp:340
HBITMAP ConvertToBlackAndWhite(HBITMAP hbm)
Definition: dib.cpp:659
float g_yDpi
Definition: dib.cpp:12
HBITMAP DoLoadImageFile(HWND hwnd, LPCWSTR name, BOOL fIsMainFile)
Definition: dib.cpp:284
int GetDIBHeight(HBITMAP hBitmap)
Definition: dib.cpp:171
SYSTEMTIME g_fileTime
Definition: dib.cpp:13
float PpcmFromDpi(float dpi)
Definition: dib.cpp:25
HBITMAP CreateMonoBitmap(int width, int height, BOOL bWhite)
Definition: dib.cpp:45
HBITMAP SetBitmapAndInfo(HBITMAP hBitmap, LPCWSTR name, LPWIN32_FIND_DATAW pFound, BOOL isFile)
Definition: dib.cpp:272
INT g_fileSize
Definition: dib.cpp:10
BOOL IsBitmapBlackAndWhite(HBITMAP hbm)
Definition: dib.cpp:608
HBITMAP CopyDIBImage(HBITMAP hbm, INT cx, INT cy, INT stretchMode)
Definition: dib.cpp:113
HBITMAP CreateColorDIB(int width, int height, COLORREF rgb)
Definition: dib.cpp:65
int GetDIBWidth(HBITMAP hBitmap)
Definition: dib.cpp:163
#define WIDTHBYTES(i)
Definition: dib.cpp:15
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
static HBITMAP hBitmap
Definition: timezone.c:26
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
HANDLE WINAPI FindFirstFileW(IN LPCWSTR lpFileName, OUT LPWIN32_FIND_DATAW lpFindFileData)
Definition: find.c:320
BOOL WINAPI FindClose(HANDLE hFindFile)
Definition: find.c:502
DWORD WINAPI GetFullPathNameW(IN LPCWSTR lpFileName, IN DWORD nBufferLength, OUT LPWSTR lpBuffer, OUT LPWSTR *lpFilePart)
Definition: path.c:1106
BOOL WINAPI FileTimeToSystemTime(IN CONST FILETIME *lpFileTime, OUT LPSYSTEMTIME lpSystemTime)
Definition: time.c:183
BOOL WINAPI FileTimeToLocalFileTime(IN CONST FILETIME *lpFileTime, OUT LPFILETIME lpLocalFileTime)
Definition: time.c:216
WCHAR *WINAPI PathFindFileNameW(const WCHAR *path)
Definition: path.c:1677
_ACRTIMP double __cdecl tan(double)
Definition: tan.c:122
_ACRTIMP __msvcrt_long __cdecl labs(__msvcrt_long)
Definition: math.c:680
static VOID BitBlt(_In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Width, _In_ ULONG Height, _In_reads_bytes_(Height *Stride) PUCHAR Buffer, _In_ ULONG BitsPerPixel, _In_ ULONG Stride)
Definition: common.c:42
#define RGB(r, g, b)
Definition: precomp.h:67
ULONG RGBQUAD
Definition: precomp.h:47
return ret
Definition: mutex.c:146
#define abs(i)
Definition: fconv.c:206
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
pKey DeleteObject()
GLint GLvoid * img
Definition: gl.h:1956
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLint GLint GLsizei width
Definition: gl.h:1546
HGLOBAL NTAPI GlobalFree(HGLOBAL hMem)
Definition: heapmem.c:611
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
ImageModel imageModel
Definition: history.cpp:11
#define FAILED(hr)
Definition: intsafe.h:51
static ERESOURCE GlobalLock
Definition: sys_arch.c:8
GLint dy
Definition: linetemp.h:97
GLint dx
Definition: linetemp.h:97
#define M_PI
Definition: macros.h:263
#define ZeroMemory
Definition: minwinbase.h:31
#define CopyMemory
Definition: minwinbase.h:29
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
HDC hdc
Definition: main.c:9
static HBITMAP
Definition: button.c:44
static HDC
Definition: imagelist.c:88
static float(__cdecl *square_half_float)(float x
long LONG
Definition: pedump.c:60
#define INT
Definition: polytest.cpp:20
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:586
_Out_opt_ int * cx
Definition: commctrl.h:585
_In_ HBITMAP hbm
Definition: ntgdi.h:2776
_In_ HBITMAP _In_ UINT _In_ UINT _Inout_ LPBITMAPINFO pbmi
Definition: ntgdi.h:2780
#define LoadStringW
Definition: utils.h:64
#define _countof(array)
Definition: sndvol32.h:70
RGBQUAD bmiColorsAdditional[256 - 1]
Definition: dib.cpp:472
RGBQUAD bmiColorsExtra[256 - 1]
Definition: dib.cpp:19
BITMAPCOREHEADER bmciHeader
Definition: wingdi.h:1899
Definition: scsiwmi.h:51
FILETIME ftLastWriteTime
Definition: minwinbase.h:286
Definition: name.c:39
USHORT biBitCount
Definition: precomp.h:34
ULONG biCompression
Definition: precomp.h:35
BITMAPINFOHEADER bmiHeader
Definition: wingdi.h:1922
RGBQUAD bmiColors[1]
Definition: wingdi.h:1923
LONG bmHeight
Definition: wingdi.h:1869
LONG bmWidth
Definition: wingdi.h:1868
LONG bmWidthBytes
Definition: wingdi.h:1870
WORD bmBitsPixel
Definition: wingdi.h:1872
LONG top
Definition: windef.h:107
LONG left
Definition: windef.h:106
UCHAR rgbBlue
Definition: bootanim.c:103
UCHAR rgbRed
Definition: bootanim.c:105
UCHAR rgbGreen
Definition: bootanim.c:104
const uint16_t * LPCWSTR
Definition: typedefs.h:57
unsigned char * LPBYTE
Definition: typedefs.h:53
int32_t INT
Definition: typedefs.h:58
#define BI_RGB
Definition: uefivid.c:46
#define LPRECT
Definition: precomp.h:28
HBITMAP WINAPI CreateDIBSection(HDC hDC, CONST BITMAPINFO *BitmapInfo, UINT Usage, VOID **Bits, HANDLE hSection, DWORD dwOffset)
Definition: bitmap.c:245
UINT WINAPI GetDIBColorTable(HDC hDC, UINT iStartIndex, UINT cEntries, RGBQUAD *pColors)
Definition: palette.c:123
#define dpi
Definition: sysparams.c:23
#define GHND
Definition: winbase.h:321
#define GMEM_SHARE
Definition: winbase.h:329
_In_ ULONG _In_ ULONG rgb
Definition: winddi.h:3521
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
DWORD COLORREF
Definition: windef.h:100
#define STRETCH_HALFTONE
Definition: wingdi.h:959
#define DIB_RGB_COLORS
Definition: wingdi.h:367
HGDIOBJ WINAPI GetStockObject(_In_ int)
int WINAPI GetObjectW(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
HBITMAP WINAPI CreateBitmap(_In_ INT cx, _In_ INT cy, _In_ UINT cPlanes, _In_ UINT cBitsPerPel, _In_opt_ const VOID *pvBits)
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
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)
struct _BITMAPCOREINFO * LPBITMAPCOREINFO
struct tagRGBTRIPLE RGBTRIPLE
#define LOGPIXELSY
Definition: wingdi.h:719
int WINAPI SetDIBits(_In_opt_ HDC, _In_ HBITMAP, _In_ UINT, _In_ UINT, _In_ CONST VOID *, _In_ CONST BITMAPINFO *, _In_ UINT)
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1546
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
struct tagBITMAPINFO * LPBITMAPINFO
BOOL WINAPI StretchBlt(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int, _In_opt_ HDC, _In_ int, _In_ int, _In_ int, _In_ int, _In_ DWORD)
#define SRCCOPY
Definition: wingdi.h:333
#define WHITE_BRUSH
Definition: wingdi.h:902
BOOL WINAPI SetPixelV(_In_ HDC, _In_ int, _In_ int, _In_ COLORREF)
#define LOGPIXELSX
Definition: wingdi.h:718
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
UINT WINAPI GetEnhMetaFileHeader(_In_ HENHMETAFILE hemf, _In_ UINT nSize, _Out_writes_bytes_opt_(nSize) LPENHMETAHEADER lpEnhMetaHeader)
HBRUSH WINAPI CreateSolidBrush(_In_ COLORREF)
BOOL WINAPI DeleteDC(_In_ HDC)
int WINAPI SetStretchBltMode(_In_ HDC, _In_ int)
Definition: dc.c:1373
BOOL WINAPI PlayEnhMetaFile(_In_ HDC, _In_ HENHMETAFILE, _In_ LPCRECT)
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define IMAGE_BITMAP
Definition: winuser.h:211
#define LR_CREATEDIBSECTION
Definition: winuser.h:1109
HANDLE WINAPI CopyImage(_In_ HANDLE, _In_ UINT, _In_ int, _In_ int, _In_ UINT)
Definition: cursoricon.c:2307
HDC WINAPI GetDC(_In_opt_ HWND)
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)
unsigned char BYTE
Definition: xxhash.c:193