source: trunk/src/gdi32/dibsect.h@ 1657

Last change on this file since 1657 was 1533, checked in by achimha, 26 years ago

Added DIB changes from Markus Montkowski to return initalized DIB structure + various bug fixes in DIB handling

File size: 2.4 KB
Line 
1/* $Id: dibsect.h,v 1.4 1999-10-31 21:38:16 achimha 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
12typedef struct {
13 BYTE rgbBlue;
14 BYTE rgbGreen;
15 BYTE rgbRed;
16 BYTE rgbReserved;
17} RGBQUAD, *LPRGBQUAD;
18#else
19#define BITMAPINFO2 DWORD
20#endif
21
22#define FLIP_VERT 1
23#define FLIP_HOR 2
24
25typedef struct {
26 DWORD biSize;
27 LONG biWidth;
28 LONG biHeight;
29 WORD biPlanes;
30 WORD biBitCount;
31 DWORD biCompression;
32 DWORD biSizeImage;
33 LONG biXPelsPerMeter;
34 LONG biYPelsPerMeter;
35 DWORD biClrUsed;
36 DWORD biClrImportant;
37} WINBITMAPINFOHEADER;
38
39typedef struct
40{
41 INT bmType;
42 INT bmWidth;
43 INT bmHeight;
44 INT bmWidthBytes;
45 WORD bmPlanes;
46 WORD bmBitsPixel;
47 LPVOID bmBits;
48} WINBITMAP, *LPWINBITMAP;
49
50#ifdef OS2_ONLY
51typedef struct
52{
53 WINBITMAP dsBm;
54 WINBITMAPINFOHEADER dsBmih;
55 DWORD dsBitfields[3];
56 HANDLE dshSection;
57 DWORD dsOffset;
58} DIBSECTION,*LPDIBSECTION;
59#endif
60
61class DIBSection
62{
63public:
64 DIBSection(WINBITMAPINFOHEADER *pbmi, DWORD handle, int fFlip);
65 ~DIBSection();
66
67 char *GetDIBObject() { return bmpBits; };
68 void SelectDIBObject(HDC hdc);
69
70 void UnSelectDIBObject() { this->hdc = 0; };
71
72 BOOL BitBlt(HDC hdcDest, HWND hwndDest, int nXdest, int nYDest,
73 int nWidth, int nHeight, int nXsrc, int nYSrc, DWORD Rop);
74
75 int SetDIBColorTable(int startIdx, int cEntries, RGBQUAD *rgb);
76
77 int GetDIBSection(int iSize , DIBSECTION *pDIBSection);
78
79 static DIBSection *getSection() { return section; } ;
80 static DIBSection *find(DWORD handle);
81 static DIBSection *findHDC(HDC hdc);
82 static void deleteSection(DWORD handle);
83protected:
84
85private:
86 DWORD handle;
87 HWND hwndParent;
88 HDC hdc;
89 char *bmpBits;
90 BOOL fFlip;
91 int bmpsize;
92 BITMAPINFO2 *pOS2bmp;
93 // Linked list management
94 DIBSection* next; // Next DIB section
95 static DIBSection* section; // List of DIB sections
96};
97
98#endif
99
Note: See TracBrowser for help on using the repository browser.