]> www.fi.muni.cz Git - evince.git/blob - pdf/splash/SplashTypes.h
Initial revision
[evince.git] / pdf / splash / SplashTypes.h
1 //========================================================================
2 //
3 // SplashTypes.h
4 //
5 //========================================================================
6
7 #ifndef SPLASHTYPES_H
8 #define SPLASHTYPES_H
9
10 #include <aconf.h>
11 #include "gtypes.h"
12
13 //------------------------------------------------------------------------
14 // coordinates
15 //------------------------------------------------------------------------
16
17 typedef double SplashCoord;
18
19 //------------------------------------------------------------------------
20 // colors
21 //------------------------------------------------------------------------
22
23 enum SplashColorMode {
24   splashModeMono1,
25   splashModeMono8,
26   splashModeRGB8,
27   splashModeBGR8Packed
28 };
29
30 // max number of components in any SplashColor
31 #define splashMaxColorComps 3
32
33 // 1-bit gray or alpha
34 typedef Guchar SplashMono1;
35 typedef Guchar SplashMono1P; // packed
36
37 // 8-bit gray or alpha
38 typedef Guchar SplashMono8;
39
40 // 3x8-bit RGB: (MSB) 00RRGGBB (LSB)
41 typedef Guint SplashRGB8;
42 #define splashRGB8R(rgb8) (((rgb8) >> 16) & 0xff)
43 #define splashRGB8G(rgb8) (((rgb8) >> 8) & 0xff)
44 #define splashRGB8B(rgb8) ((rgb8) & 0xff)
45 #define splashMakeRGB8(r, g, b) \
46   ((((r) & 0xff) << 16) | (((g) & 0xff) << 8) | ((b) & 0xff))
47
48 // 3x8-bit RGB: (MSB) 00BBGGRR (LSB)
49 typedef Guint SplashBGR8;
50 typedef Guchar SplashBGR8P; // packed
51 #define splashBGR8R(bgr8) ((bgr8) & 0xff)
52 #define splashBGR8G(bgr8) (((bgr8) >> 8) & 0xff)
53 #define splashBGR8B(bgr8) (((bgr8) >> 16) & 0xff)
54 #define splashMakeBGR8(r, g, b) \
55   ((((b) & 0xff) << 16) | (((g) & 0xff) << 8) | ((r) & 0xff))
56
57 union SplashColor {
58   SplashMono1 mono1;
59   SplashMono8 mono8;
60   SplashRGB8 rgb8;
61   SplashBGR8 bgr8;
62 };
63
64 union SplashColorPtr {
65   SplashMono1P *mono1;
66   SplashMono8 *mono8;
67   SplashRGB8 *rgb8;
68   SplashBGR8P *bgr8;
69 };
70
71 //------------------------------------------------------------------------
72 // error results
73 //------------------------------------------------------------------------
74
75 typedef int SplashError;
76
77 #endif