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

Last change on this file since 3721 was 3711, checked in by sandervl, 25 years ago

dib blit fixes

File size: 3.1 KB
Line 
1/* $Id: dibsect.h,v 1.19 2000-06-14 18:30:18 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 int GetBitCount();
74 int GetHeight();
75 void UnSelectDIBObject() { this->hdc = 0; };
76
77 DWORD GetBitmapHandle() { return handle; };
78 DWORD GetRGBUsage() { return iUsage; };
79
80 BOOL BitBlt(HDC hdcDest, int nXdest, int nYDest,
81 int nDestWidth, int nDestHeight,
82 int nXsrc, int nYSrc,
83 int nSrcWidth, int nSrcHeight,
84 DWORD Rop);
85 void sync(HDC hdc, DWORD nYdest, DWORD nDestHeight);
86 int SetDIBColorTable(int startIdx, int cEntries, RGBQUAD *rgb);
87
88 int SetDIBits(HDC hdc, HBITMAP hbitmap, UINT startscan, UINT
89 lines, const VOID *bits, BITMAPINFOHEADER_W *pbmi,
90 UINT coloruse);
91
92 int GetDIBSection(int iSize , void *lpBuffer);
93
94 static DIBSection *getSection() { return section; } ;
95 static DIBSection *find(DWORD handle);
96 static DIBSection *findHDC(HDC hdc);
97 static void deleteSection(DWORD handle);
98protected:
99
100private:
101 DWORD handle, iUsage;
102 DWORD hSection;
103 HWND hwndParent;
104 HDC hdc;
105 char *bmpBits, *bmpBitsDblBuffer;
106 BOOL fFlip;
107 int bmpsize, os2bmphdrsize;
108 DIBSECTION dibinfo;
109
110 BITMAPINFO2 *pOS2bmp;
111 // Linked list management
112 DIBSection* next; // Next DIB section
113 static DIBSection* section; // List of DIB sections
114};
115
116#endif
117
118
Note: See TracBrowser for help on using the repository browser.