]> www.fi.muni.cz Git - evince.git/blob - pdf/xpdf/Thumb.h
a3735fe54374a5e173a48317e7ebde4426dc0e83
[evince.git] / pdf / xpdf / Thumb.h
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-indent-level: 8; c-basic-offset: 8 -*- */
2 /* 
3  *  Copyright (C) 2003 Remi Cohen-Scali
4  *
5  *  Author:
6  *    Remi Cohen-Scali <Remi@Cohen-Scali.com>
7  *
8  * GPdf is free software; you can redistribute it and/or modify it
9  * under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * GPdf is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
16  * License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
21  */
22
23 #ifndef THUMB_H
24 #define THUMB_H
25
26 #include <aconf.h>
27
28 class XRef;
29 class GfxColorSpace;
30 class GfxRGB;
31 class GfxCMYK;
32 class GfxColor;
33
34 /*
35  * ThumbColorMap
36  */
37 class ThumbColorMap {
38
39       public:
40         ThumbColorMap(int bitsA, Object *obj, GfxColorSpace *csA);
41         ~ThumbColorMap();
42         
43         GBool isOk() {return ok; };
44         
45         GfxColorSpace *getColorSpace() { return cs; }; 
46         
47         int getNumPixelComps() { return nComps; }; 
48         int getBits() { return bits; }; 
49         
50         void getGray(Guchar *x, double *gray);
51         void getRGB(Guchar *x, GfxRGB *rgb);
52         void getCMYK(Guchar *x, GfxCMYK *cmyk);
53         //void getColor(Guchar *x, GfxColor *color);
54
55         static ThumbColorMap *lookupColorMap(XRef *xref, int bitsA, Object *obj, GfxColorSpace *csA); 
56
57       private:
58         GBool ok; 
59         int bits;
60         Stream *str;
61         GfxColorSpace *cs;
62         int nComps;
63         int length;
64         union {
65                 double *gray;
66                 GfxRGB *rgb;
67                 GfxCMYK *cmyk;
68                 GfxColor *colors; 
69         };
70 };
71
72 /*
73  * ThumbColorMaps
74  */
75
76 /* FIXME: Should have a class to avoid reading same colormap for every thumb */
77
78 /*
79  * Thumb
80  */
81
82 class Thumb {
83
84       public:
85         Thumb(XRef *xrefA, Object *obj);
86         ~Thumb();
87
88         int getWidth(void) {return width; };
89         int getHeight(void) {return height; };
90         GfxColorSpace *getColorSpace(void) {return gfxCS; };
91         int getBitsPerComponent(void) {return bits; };
92         int getLength(void) {return length; };
93
94         Stream *getStream() {return str; };
95
96         unsigned char *getPixbufData();
97
98       private:
99         XRef *xref;
100         Stream *str;
101         GfxColorSpace *gfxCS;
102         ThumbColorMap *thumbCM; 
103         int width, height, bits;
104         int length;
105 };
106
107 #endif
108