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

Last change on this file since 3313 was 3302, checked in by sandervl, 25 years ago

dib sync bugfixes

File size: 3.0 KB
Line 
1/* $Id: dibsect.h,v 1.15 2000-04-02 12:24:40 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
51#ifdef OS2_ONLY
52#define DIB_RGB_COLORS 0
53#define DIB_PAL_COLORS 1
54
55typedef struct
56{
57 BITMAP_W dsBm;
58 BITMAPINFOHEADER_W dsBmih;
59 DWORD dsBitfields[3];
60 HANDLE dshSection;
61 DWORD dsOffset;
62} DIBSECTION,*LPDIBSECTION;
63#endif
64
65class DIBSection
66{
67public:
68 DIBSection(BITMAPINFOHEADER_W *pbmi, char *pColors, DWORD iUsage, DWORD hSection, DWORD dwOffset, DWORD handle, int fFlip);
69 ~DIBSection();
70
71 char *GetDIBObject() { return bmpBits; };
72 void SelectDIBObject(HDC hdc);
73 char GetBitCount();
74 void UnSelectDIBObject() { this->hdc = 0; };
75
76 DWORD GetBitmapHandle() { return handle; };
77 DWORD GetRGBUsage() { return iUsage; };
78
79 BOOL BitBlt(HDC hdcDest, int nXdest, int nYDest,
80 int nDestWidth, int nDestHeight,
81 int nXsrc, int nYSrc,
82 int nSrcWidth, int nSrcHeight,
83 DWORD Rop);
84
85 int SetDIBColorTable(int startIdx, int cEntries, RGBQUAD *rgb);
86
87 int SetDIBits(HDC hdc, HBITMAP hbitmap, UINT startscan, UINT
88 lines, const VOID *bits, BITMAPINFOHEADER_W *pbmi,
89 UINT coloruse);
90
91 int GetDIBSection(int iSize , void *lpBuffer);
92
93 static DIBSection *getSection() { return section; } ;
94 static DIBSection *find(DWORD handle);
95 static DIBSection *findHDC(HDC hdc);
96 static void deleteSection(DWORD handle);
97protected:
98
99private:
100 DWORD handle, iUsage;
101 DWORD hSection;
102 HWND hwndParent;
103 HDC hdc;
104 char *bmpBits, *bmpBitsRGB565;
105 BOOL fFlip;
106 int bmpsize, os2bmphdrsize;
107 DIBSECTION dibinfo;
108
109 BITMAPINFO2 *pOS2bmp;
110 // Linked list management
111 DIBSection* next; // Next DIB section
112 static DIBSection* section; // List of DIB sections
113};
114
115#endif
116
117
Note: See TracBrowser for help on using the repository browser.