| Line | |
|---|
| 1 | /*
|
|---|
| 2 | * GDI32 DIB sections
|
|---|
| 3 | *
|
|---|
| 4 | * Copyright 1998 Sander van Leeuwen (sandervl@xs4all.nl)
|
|---|
| 5 | *
|
|---|
| 6 | * Project Odin Software License can be found in LICENSE.TXT
|
|---|
| 7 | *
|
|---|
| 8 | */
|
|---|
| 9 | #ifndef __DIBSECT_H__
|
|---|
| 10 | #define __DIBSECT_H__
|
|---|
| 11 |
|
|---|
| 12 | #ifdef OS2_ONLY
|
|---|
| 13 | typedef struct {
|
|---|
| 14 | BYTE rgbBlue;
|
|---|
| 15 | BYTE rgbGreen;
|
|---|
| 16 | BYTE rgbRed;
|
|---|
| 17 | BYTE rgbReserved;
|
|---|
| 18 | } RGBQUAD, *LPRGBQUAD;
|
|---|
| 19 | #else
|
|---|
| 20 | #define BITMAPINFO2 DWORD
|
|---|
| 21 | #endif
|
|---|
| 22 |
|
|---|
| 23 | #define FLIP_VERT 1
|
|---|
| 24 | #define FLIP_HOR 2
|
|---|
| 25 |
|
|---|
| 26 | typedef struct {
|
|---|
| 27 | DWORD biSize;
|
|---|
| 28 | LONG biWidth;
|
|---|
| 29 | LONG biHeight;
|
|---|
| 30 | WORD biPlanes;
|
|---|
| 31 | WORD biBitCount;
|
|---|
| 32 | DWORD biCompression;
|
|---|
| 33 | DWORD biSizeImage;
|
|---|
| 34 | LONG biXPelsPerMeter;
|
|---|
| 35 | LONG biYPelsPerMeter;
|
|---|
| 36 | DWORD biClrUsed;
|
|---|
| 37 | DWORD biClrImportant;
|
|---|
| 38 | } WINBITMAPINFOHEADER;
|
|---|
| 39 |
|
|---|
| 40 | class DIBSection
|
|---|
| 41 | {
|
|---|
| 42 | public:
|
|---|
| 43 | DIBSection(WINBITMAPINFOHEADER *pbmi, DWORD handle, int fFlip);
|
|---|
| 44 | ~DIBSection();
|
|---|
| 45 |
|
|---|
| 46 | char *GetDIBObject() { return bmpBits; };
|
|---|
| 47 | void SelectDIBObject(HDC hdc);
|
|---|
| 48 |
|
|---|
| 49 | void UnSelectDIBObject() { this->hdc = 0; };
|
|---|
| 50 |
|
|---|
| 51 | BOOL BitBlt(HDC hdcDest, HWND hwndDest, int nXdest, int nYDest,
|
|---|
| 52 | int nWidth, int nHeight, int nXsrc, int nYSrc, DWORD Rop);
|
|---|
| 53 |
|
|---|
| 54 | int SetDIBColorTable(int startIdx, int cEntries, RGBQUAD *rgb);
|
|---|
| 55 | static DIBSection *getSection() { return section; } ;
|
|---|
| 56 | static DIBSection *find(DWORD handle);
|
|---|
| 57 | static DIBSection *findHDC(HDC hdc);
|
|---|
| 58 | static void deleteSection(DWORD handle);
|
|---|
| 59 | protected:
|
|---|
| 60 |
|
|---|
| 61 | private:
|
|---|
| 62 | DWORD handle;
|
|---|
| 63 | HWND hwndParent;
|
|---|
| 64 | HDC hdc;
|
|---|
| 65 | char *bmpBits;
|
|---|
| 66 | BOOL fFlip;
|
|---|
| 67 |
|
|---|
| 68 | BITMAPINFO2 *pOS2bmp;
|
|---|
| 69 | // Linked list management
|
|---|
| 70 | DIBSection* next; // Next DIB section
|
|---|
| 71 | static DIBSection* section; // List of DIB sections
|
|---|
| 72 | };
|
|---|
| 73 |
|
|---|
| 74 | #endif
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.