1 | /* $Id: dibsect.h,v 1.8 1999-12-04 13:53:14 hugh Exp $ */
|
---|
2 |
|
---|
3 | /*
|
---|
4 | * GDI32 DIB sections
|
---|
5 | * Copyright 1998 Sander van Leeuwen (sandervl@xs4all.nl)
|
---|
6 | * Project Odin Software License can be found in LICENSE.TXT
|
---|
7 | */
|
---|
8 | #ifndef __DIBSECT_H__
|
---|
9 | #define __DIBSECT_H__
|
---|
10 |
|
---|
11 | #ifdef OS2_ONLY
|
---|
12 | typedef struct
|
---|
13 | {
|
---|
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 | typedef struct
|
---|
41 | {
|
---|
42 | INT bmType;
|
---|
43 | INT bmWidth;
|
---|
44 | INT bmHeight;
|
---|
45 | INT bmWidthBytes;
|
---|
46 | WORD bmPlanes;
|
---|
47 | WORD bmBitsPixel;
|
---|
48 | LPVOID bmBits;
|
---|
49 | } WINBITMAP, *LPWINBITMAP;
|
---|
50 |
|
---|
51 | #ifdef OS2_ONLY
|
---|
52 | typedef struct
|
---|
53 | {
|
---|
54 | WINBITMAP dsBm;
|
---|
55 | WINBITMAPINFOHEADER dsBmih;
|
---|
56 | DWORD dsBitfields[3];
|
---|
57 | HANDLE dshSection;
|
---|
58 | DWORD dsOffset;
|
---|
59 | } DIBSECTION,*LPDIBSECTION;
|
---|
60 | #endif
|
---|
61 |
|
---|
62 | class DIBSection
|
---|
63 | {
|
---|
64 | public:
|
---|
65 | DIBSection(WINBITMAPINFOHEADER *pbmi, DWORD handle, int fFlip);
|
---|
66 | ~DIBSection();
|
---|
67 |
|
---|
68 | char *GetDIBObject() { return bmpBits; };
|
---|
69 | void SelectDIBObject(HDC hdc);
|
---|
70 | char GetBitCount();
|
---|
71 | void UnSelectDIBObject() { this->hdc = 0; };
|
---|
72 |
|
---|
73 | BOOL BitBlt(HDC hdcDest, int nXdest, int nYDest,
|
---|
74 | int nDestWidth, int nDestHeight,
|
---|
75 | int nXsrc, int nYSrc,
|
---|
76 | int nSrcWidth, int nSrcHeight,
|
---|
77 | DWORD Rop);
|
---|
78 |
|
---|
79 | int SetDIBColorTable(int startIdx, int cEntries, RGBQUAD *rgb);
|
---|
80 |
|
---|
81 | int SetDIBits(HDC hdc, HBITMAP hbitmap, UINT startscan, UINT
|
---|
82 | lines, const VOID *bits, WINBITMAPINFOHEADER *pbmi,
|
---|
83 | UINT coloruse);
|
---|
84 |
|
---|
85 | int GetDIBSection(int iSize , DIBSECTION *pDIBSection);
|
---|
86 |
|
---|
87 | static DIBSection *getSection() { return section; } ;
|
---|
88 | static DIBSection *find(DWORD handle);
|
---|
89 | static DIBSection *findHDC(HDC hdc);
|
---|
90 | static void deleteSection(DWORD handle);
|
---|
91 | protected:
|
---|
92 |
|
---|
93 | private:
|
---|
94 | DWORD handle;
|
---|
95 | HWND hwndParent;
|
---|
96 | HDC hdc;
|
---|
97 | char *bmpBits;
|
---|
98 | BOOL fFlip;
|
---|
99 | int bmpsize;
|
---|
100 | BITMAPINFO2 *pOS2bmp;
|
---|
101 | // Linked list management
|
---|
102 | DIBSection* next; // Next DIB section
|
---|
103 | static DIBSection* section; // List of DIB sections
|
---|
104 | };
|
---|
105 |
|
---|
106 | #endif
|
---|
107 |
|
---|
108 |
|
---|