dibdrv: Store image size
[wine/dibdrv.git] / dlls / winedib.drv / dibdrv.h
blobf3a567a59da9873ef4309dfe1056d727af71c325
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 INT size;
50 RGBQUAD *color_table;
51 UINT nb_colors;
52 DWORD bitfields[3];
54 /* calculated numbers for bitfields */
55 INT bf_pos[3]; /* starting position of the field */
56 INT bf_size[3]; /* size of the field */
57 INT bf_shift[3]; /* shifting required within a COLORREF's BYTE */
59 /* current drawing address */
60 void *addr;
61 INT shift;
63 /* ready encoded colors for drawing */
64 BYTE color8;
65 WORD color16;
66 RGBTRIPLE color24;
67 DWORD color32;
68 } DIBDRVBITMAP;
70 /* DIB conversions functions */
71 typedef struct _DIBCONVERT
73 void (*ConvertToDIB1)(DIBDRVBITMAP*,DIBDRVBITMAP*,int);
74 void (*ConvertToDIB4)(DIBDRVBITMAP*,DIBDRVBITMAP*,int);
75 void (*ConvertToDIB8)(DIBDRVBITMAP*,DIBDRVBITMAP*,int);
76 void (*ConvertToDIB16)(DIBDRVBITMAP*,DIBDRVBITMAP*,int);
77 void (*ConvertToDIB24)(DIBDRVBITMAP*,DIBDRVBITMAP*,int);
78 void (*ConvertToDIB32)(DIBDRVBITMAP*,DIBDRVBITMAP*,int);
79 } DIBCONVERT;
81 /* DIB manipulation functions */
82 typedef struct _DIBFUNCS
84 void (*AdvancePosition)(DIBDRVBITMAP*,int);
85 void (*Copy)(DIBDRVBITMAP*,DIBDRVBITMAP*,int,const DIBCONVERT*);
86 void (*MoveXY)(DIBDRVBITMAP*,INT,INT);
87 void (*ReadColor)(DIBDRVBITMAP*,BYTE*,BYTE*,BYTE*);
88 void (*SelectColor)(DIBDRVBITMAP*,COLORREF);
89 void (*SetPixel)(DIBDRVBITMAP*,COLORREF);
90 void (*WriteColor)(DIBDRVBITMAP*,int);
91 } DIBFUNCS;
93 /* DIB driver physical device */
94 typedef struct _DIBDRVPHYSDEV
96 HDC hdc;
97 HBITMAP hbitmap;
98 DIBDRVBITMAP *bmp;
99 const DIBFUNCS *funcs;
100 const DIBCONVERT *convs;
101 } DIBDRVPHYSDEV;
103 /* bitmap handling functions */
104 extern DIBFORMAT BITMAP_GetFormat( WORD depth, DWORD compression );
105 extern const DIBFUNCS *BITMAP_GetDIBFuncs( DIBFORMAT format );
106 extern const DIBCONVERT *BITMAP_GetDIBConversions( DIBFORMAT format );
107 extern DIBDRVBITMAP *BITMAP_CreateFromBmi( const BITMAPINFO *bmi, void *bits );
108 extern DIBDRVBITMAP *BITMAP_CreateFromHBitmap( HBITMAP hbitmap, RGBQUAD *ct, UINT nb_colors );
110 /* DIB function tables for each format */
111 extern const DIBFUNCS DIB1_funcs, DIB4_funcs, DIB8_funcs, DIB16_funcs, DIB24_funcs, DIB32_funcs;
112 extern const DIBCONVERT DIB1_convs, DIB4_convs, DIB8_convs, DIB16_convs, DIB24_convs, DIB32_convs;
114 #endif /* __WINE_DIBDRV_H */