dibdrv: Implement SelectBitmap
[wine/dibdrv.git] / dlls / winedib.drv / dibdrv.h
blob58b67dba0f6f4b0f02f33f260a9089875db77d2a
1 /*
2 * DIB driver private definitions
4 * Copyright 2007 Jesse Allen
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #ifndef __WINE_DIBDRV_H
22 #define __WINE_DIBDRV_H
24 #include "wingdi.h"
26 typedef enum _DIBFORMAT
28 DIBFMT_UNKNOWN = 0,
29 DIBFMT_DIB1 = 1,
30 DIBFMT_DIB4 = 2,
31 /*DIBFMT_DIB4RLE = 3,*/
32 DIBFMT_DIB8 = 4,
33 /*DIBFMT_DIB8RLE = 5,*/
34 DIBFMT_DIB16 = 6,
35 DIBFMT_DIB24 = 7,
36 DIBFMT_DIB32 = 8,
37 DIBFMT_X1B5G5R5 = 9,
38 DIBFMT_X8B8G8R8 = 10
39 } DIBFORMAT;
41 /* DIB driver's generic bitmap structure */
42 typedef struct _DIBDRVBITMAP
44 DIBFORMAT format;
45 void *bits;
46 INT width;
47 INT height;
48 INT widthbytes;
49 RGBQUAD *color_table;
50 UINT nb_colors;
51 DWORD bitfields[3];
53 /* calculated numbers for bitfields */
54 INT bf_pos[3]; /* starting position of the field */
55 INT bf_size[3]; /* size of the field */
56 INT bf_shift[3]; /* shifting required within a COLORREF's BYTE */
58 /* current drawing address */
59 void *addr;
60 INT shift;
62 /* ready encoded colors for drawing */
63 BYTE color8;
64 WORD color16;
65 RGBTRIPLE color24;
66 DWORD color32;
67 } DIBDRVBITMAP;
69 /* DIB conversions functions */
70 typedef struct _DIBCONVERT
72 void (*ConvertToDIB1)(DIBDRVBITMAP*,DIBDRVBITMAP*,int);
73 void (*ConvertToDIB4)(DIBDRVBITMAP*,DIBDRVBITMAP*,int);
74 void (*ConvertToDIB8)(DIBDRVBITMAP*,DIBDRVBITMAP*,int);
75 void (*ConvertToDIB16)(DIBDRVBITMAP*,DIBDRVBITMAP*,int);
76 void (*ConvertToDIB24)(DIBDRVBITMAP*,DIBDRVBITMAP*,int);
77 void (*ConvertToDIB32)(DIBDRVBITMAP*,DIBDRVBITMAP*,int);
78 } DIBCONVERT;
80 /* DIB manipulation functions */
81 typedef struct _DIBFUNCS
83 void (*AdvancePosition)(DIBDRVBITMAP*,int);
84 void (*Copy)(DIBDRVBITMAP*,DIBDRVBITMAP*,int,const DIBCONVERT*);
85 void (*MoveXY)(DIBDRVBITMAP*,INT,INT);
86 void (*ReadColor)(DIBDRVBITMAP*,BYTE*,BYTE*,BYTE*);
87 void (*SelectColor)(DIBDRVBITMAP*,COLORREF);
88 void (*SetPixel)(DIBDRVBITMAP*,COLORREF);
89 void (*WriteColor)(DIBDRVBITMAP*,int);
90 } DIBFUNCS;
92 /* DIB driver physical device */
93 typedef struct _DIBDRVPHYSDEV
95 HDC hdc;
96 HBITMAP hbitmap;
97 DIBDRVBITMAP *bmp;
98 const DIBFUNCS *funcs;
99 const DIBCONVERT *convs;
100 } DIBDRVPHYSDEV;
102 /* bitmap handling functions */
103 extern DIBFORMAT BITMAP_GetFormat( WORD depth, DWORD compression );
104 extern const DIBFUNCS *BITMAP_GetDIBFuncs( DIBFORMAT format );
105 extern const DIBCONVERT *BITMAP_GetDIBConversions( DIBFORMAT format );
106 extern DIBDRVBITMAP *BITMAP_CreateFromBmi( const BITMAPINFO *bmi, void *bits );
107 extern DIBDRVBITMAP *BITMAP_CreateFromHBitmap( HBITMAP hbitmap, RGBQUAD *ct, UINT nb_colors );
109 #endif /* __WINE_DIBDRV_H */