diff options
| author | Pietro Gagliardi <[email protected]> | 2016-05-30 00:14:46 -0400 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2016-05-30 00:14:46 -0400 |
| commit | 52f7d276a6bb04b8827ac019ad1e135b43819cea (patch) | |
| tree | 5f0ebbfdf5885ef832e77e243b5916e59f46ba18 /prev/image_windows.c | |
| parent | c9b32c1333e4009b342eedc5f5b39127a724fb42 (diff) | |
Removed prev/.
Diffstat (limited to 'prev/image_windows.c')
| -rw-r--r-- | prev/image_windows.c | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/prev/image_windows.c b/prev/image_windows.c deleted file mode 100644 index bcea3c4..0000000 --- a/prev/image_windows.c +++ /dev/null @@ -1,35 +0,0 @@ -// 16 august 2014 - -#include "winapi_windows.h" -#include "_cgo_export.h" - -// TODO rename to images_windows.c? - -HBITMAP toBitmap(void *i, intptr_t dx, intptr_t dy) -{ - BITMAPINFO bi; - VOID *ppvBits; - HBITMAP bitmap; - - ZeroMemory(&bi, sizeof (BITMAPINFO)); - bi.bmiHeader.biSize = sizeof (BITMAPINFOHEADER); - bi.bmiHeader.biWidth = (LONG) dx; - bi.bmiHeader.biHeight = -((LONG) dy); // negative height to force top-down drawing; - bi.bmiHeader.biPlanes = 1; - bi.bmiHeader.biBitCount = 32; - bi.bmiHeader.biCompression = BI_RGB; - bi.bmiHeader.biSizeImage = (DWORD) (dx * dy * 4); - bitmap = CreateDIBSection(NULL, &bi, DIB_RGB_COLORS, &ppvBits, 0, 0); - if (bitmap == NULL) - xpanic("error creating HBITMAP in toBitmap()", GetLastError()); - // image lists use non-premultiplied RGBA - see http://stackoverflow.com/a/25578789/3408572 - // the TRUE here does the conversion - dotoARGB(i, (void *) ppvBits, TRUE); - return bitmap; -} - -void freeBitmap(uintptr_t bitmap) -{ - if (DeleteObject((HBITMAP) bitmap) == 0) - xpanic("error deleting bitmap in freeBitmap()", GetLastError()); -} |
