]> www.fi.muni.cz Git - evince.git/blob - pdf/xpdf/SFont.cc
Synched with Xpdf 0.92
[evince.git] / pdf / xpdf / SFont.cc
1 //========================================================================
2 //
3 // SFont.cc
4 //
5 //========================================================================
6
7 #ifdef __GNUC__
8 #pragma implementation
9 #endif
10
11 #include "SFont.h"
12
13 //------------------------------------------------------------------------
14
15 SFontEngine::SFontEngine(Display *display, Visual *visual, int depth,
16                          Colormap colormap) {
17   this->display = display;
18   this->visual = visual;
19   this->depth = depth;
20   this->colormap = colormap;
21 };
22
23 SFontEngine::~SFontEngine() {
24 }
25
26 void SFontEngine::useTrueColor(int rMax, int rShift, int gMax, int gShift,
27                                int bMax, int bShift) {
28   trueColor = gTrue;
29   this->rMax = rMax;
30   this->rShift = rShift;
31   this->gMax = gMax;
32   this->gShift = gShift;
33   this->bMax = bMax;
34   this->bShift = bShift;
35 }
36
37 void SFontEngine::useColorCube(Gulong *colors, int nRGB) {
38   trueColor = gFalse;
39   this->colors = colors;
40   this->nRGB = nRGB;
41   rMax = gMax = bMax = nRGB - 1;
42 }
43
44 Gulong SFontEngine::findColor(int r, int g, int b) {
45   int r1, g1, b1;
46   Gulong pix;
47
48   r1 = ((r & 0xffff) * rMax) / 0xffff;
49   g1 = ((g & 0xffff) * gMax) / 0xffff;
50   b1 = ((b & 0xffff) * bMax) / 0xffff;
51   if (trueColor) {
52     pix = (r1 << rShift) + (g1 << gShift) + (b1 << bShift);
53   } else {
54     pix = colors[(r1 * nRGB + g1) * nRGB + b1];
55   }
56   return pix;
57 }
58
59 //------------------------------------------------------------------------
60
61 SFontFile::SFontFile() {
62 }
63
64 SFontFile::~SFontFile() {
65 }
66
67 //------------------------------------------------------------------------
68
69 SFont::SFont() {
70 }
71
72 SFont::~SFont() {
73 }