1 /* Copyright (C)2017-2018 D. R. Commander
2  *
3  * This library is free software and may be redistributed and/or modified under
4  * the terms of the wxWindows Library License, Version 3.1 or (at your option)
5  * any later version.  The full license is in the LICENSE.txt file included
6  * with this distribution.
7  *
8  * This library is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11  * wxWindows Library License for more details.
12  */
13 
14 #ifndef __PF_H__
15 #define __PF_H__
16 
17 /* Pixel formats */
18 #define PIXELFORMATS  11
19 enum
20 {
21 	PF_RGB, PF_RGBX, PF_RGB10_X2, PF_BGR, PF_BGRX, PF_BGR10_X2, PF_XBGR,
22 	PF_X2_BGR10, PF_XRGB, PF_X2_RGB10, PF_COMP
23 };
24 
25 
26 typedef const struct _PF
27 {
28 	unsigned char id;
29 	const char *name;
30 	unsigned char size, bpc;
31 	unsigned int rmask, gmask, bmask;
32 	unsigned char rshift, gshift, bshift, rindex, gindex, bindex;
33 	/* These are useful mainly for initializing and comparing test patterns in
34 	   unit tests.  They are not particularly fast. */
35 	void (*getRGB)(unsigned char *, int *, int *, int *);
36 	void (*setRGB)(unsigned char *, int, int, int);
37 	/* Optimized pixel conversion */
38 	void (*convert)(unsigned char *srcBuf, int width, int srcStride, int height,
39 		unsigned char *dstBuf, int dstStride, const struct _PF *dstpf);
40 } PF;
41 
42 
43 #ifdef __cplusplus
44 extern "C" {
45 #endif
46 
47 PF *pf_get(int id);
48 
49 #ifdef __cplusplus
50 }
51 #endif
52 
53 #endif  /* __PF_H__ */
54