1 //========================================================================
5 //========================================================================
13 //------------------------------------------------------------------------
15 SFontEngine::SFontEngine(Display *display, Visual *visual, int depth,
17 this->display = display;
18 this->visual = visual;
20 this->colormap = colormap;
23 SFontEngine::~SFontEngine() {
26 void SFontEngine::useTrueColor(int rMax, int rShift, int gMax, int gShift,
27 int bMax, int bShift) {
30 this->rShift = rShift;
32 this->gShift = gShift;
34 this->bShift = bShift;
37 void SFontEngine::useColorCube(Gulong *colors, int nRGB) {
39 this->colors = colors;
41 rMax = gMax = bMax = nRGB - 1;
44 Gulong SFontEngine::findColor(int r, int g, int b) {
48 r1 = ((r & 0xffff) * rMax) / 0xffff;
49 g1 = ((g & 0xffff) * gMax) / 0xffff;
50 b1 = ((b & 0xffff) * bMax) / 0xffff;
52 pix = (r1 << rShift) + (g1 << gShift) + (b1 << bShift);
54 pix = colors[(r1 * nRGB + g1) * nRGB + b1];
59 //------------------------------------------------------------------------
61 SFontFile::SFontFile() {
64 SFontFile::~SFontFile() {
67 //------------------------------------------------------------------------