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

Last change on this file since 4310 was 4127, checked in by sandervl, 25 years ago

workaround for palette problems in PowerDVD

File size: 3.4 KB
Line 
1/* $Id: dibsect.h,v 1.20 2000-08-30 18:05:24 sandervl 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{
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
26typedef 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} BITMAPINFOHEADER_W;
39
40typedef struct
41{
42 INT bmType;
43 INT bmWidth;
44 INT bmHeight;
45 INT bmWidthBytes;
46 WORD bmPlanes;
47 WORD bmBitsPixel;
48 LPVOID bmBits;
49} BITMAP_W, *LPBITMAP_W;
50
51typedef struct {
52 BITMAPINFOHEADER_W bmiHeader;
53 RGBQUAD bmiColors[1];
54} BITMAPINFO_W;
55typedef BITMAPINFO *LPBITMAPINFO;
56
57#ifdef OS2_ONLY
58#define DIB_RGB_COLORS 0
59#define DIB_PAL_COLORS 1
60
61typedef struct
62{
63 BITMAP_W dsBm;
64 BITMAPINFOHEADER_W dsBmih;
65 DWORD dsBitfields[3];
66 HANDLE dshSection;
67 DWORD dsOffset;
68} DIBSECTION,*LPDIBSECTION;
69#endif
70
71class DIBSection
72{
73public:
74 DIBSection(BITMAPINFOHEADER_W *pbmi, char *pColors, DWORD iUsage, DWORD hSection, DWORD dwOffset, DWORD handle, int fFlip);
75 ~DIBSection();
76
77 char *GetDIBObject() { return bmpBits; };
78 void SelectDIBObject(HDC hdc);
79 int GetBitCount();
80 int GetHeight();
81 void UnSelectDIBObject() { this->hdc = 0; };
82
83 DWORD GetBitmapHandle() { return handle; };
84 void SetBitmapHandle(DWORD bmphandle) { handle = bmphandle; };
85 DWORD GetRGBUsage() { return iUsage; };
86
87 BOOL BitBlt(HDC hdcDest, int nXdest, int nYDest,
88 int nDestWidth, int nDestHeight,
89 int nXsrc, int nYSrc,
90 int nSrcWidth, int nSrcHeight,
91 DWORD Rop);
92 void sync(HDC hdc, DWORD nYdest, DWORD nDestHeight);
93 void sync(DWORD xDst, DWORD yDst, DWORD widthDst, DWORD heightDst, PVOID bits);
94 int SetDIBColorTable(int startIdx, int cEntries, RGBQUAD *rgb);
95
96 int SetDIBits(HDC hdc, HBITMAP hbitmap, UINT startscan, UINT
97 lines, const VOID *bits, BITMAPINFOHEADER_W *pbmi,
98 UINT coloruse);
99
100 int GetDIBSection(int iSize , void *lpBuffer);
101
102 static DIBSection *getSection() { return section; } ;
103 static DIBSection *find(DWORD handle);
104 static DIBSection *findHDC(HDC hdc);
105 static void deleteSection(DWORD handle);
106protected:
107
108private:
109 DWORD handle, iUsage;
110 DWORD hSection, dwOffset;
111 HWND hwndParent;
112 HDC hdc;
113 char *bmpBits, *bmpBitsDblBuffer;
114 BOOL fFlip;
115 int bmpsize, os2bmphdrsize;
116 DIBSECTION dibinfo;
117
118 BITMAPINFO2 *pOS2bmp;
119 // Linked list management
120 DIBSection* next; // Next DIB section
121 static DIBSection* section; // List of DIB sections
122};
123
124#endif
125
126
Note: See TracBrowser for help on using the repository browser.