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

Last change on this file since 2593 was 2592, checked in by sandervl, 26 years ago

cleaned up + dibsection fixes

File size: 2.9 KB
Line 
1/* $Id: dibsect.h,v 1.10 2000-02-01 12:53:29 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} WINBITMAPINFOHEADER;
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} WINBITMAP, *LPWINBITMAP;
50
51#ifdef OS2_ONLY
52typedef struct
53{
54 WINBITMAP dsBm;
55 WINBITMAPINFOHEADER dsBmih;
56 DWORD dsBitfields[3];
57 HANDLE dshSection;
58 DWORD dsOffset;
59} DIBSECTION,*LPDIBSECTION;
60#endif
61
62class DIBSection
63{
64public:
65 DIBSection(WINBITMAPINFOHEADER *pbmi, DWORD iUsage, 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 DWORD GetBitmapHandle() { return handle; };
74 DWORD GetRGBUsage() { return iUsage; };
75
76 BOOL BitBlt(HDC hdcDest, int nXdest, int nYDest,
77 int nDestWidth, int nDestHeight,
78 int nXsrc, int nYSrc,
79 int nSrcWidth, int nSrcHeight,
80 DWORD Rop);
81
82 int SetDIBColorTable(int startIdx, int cEntries, RGBQUAD *rgb);
83
84 int SetDIBits(HDC hdc, HBITMAP hbitmap, UINT startscan, UINT
85 lines, const VOID *bits, WINBITMAPINFOHEADER *pbmi,
86 UINT coloruse);
87
88 int GetDIBSection(int iSize , void *lpBuffer);
89
90 static DIBSection *getSection() { return section; } ;
91 static DIBSection *find(DWORD handle);
92 static DIBSection *findHDC(HDC hdc);
93 static void deleteSection(DWORD handle);
94protected:
95
96private:
97 DWORD handle, iUsage;
98 HWND hwndParent;
99 HDC hdc;
100 char *bmpBits;
101 BOOL fFlip;
102 int bmpsize;
103 BITMAPINFO2 *pOS2bmp;
104 // Linked list management
105 DIBSection* next; // Next DIB section
106 static DIBSection* section; // List of DIB sections
107};
108
109#endif
110
111
Note: See TracBrowser for help on using the repository browser.