diff options
Diffstat (limited to 'src/image.cpp')
-rw-r--r-- | src/image.cpp | 48 |
1 files changed, 25 insertions, 23 deletions
diff --git a/src/image.cpp b/src/image.cpp index 76f9661..ac7c8d1 100644 --- a/src/image.cpp +++ b/src/image.cpp @@ -166,28 +166,6 @@ static Color palette[] = { 0xc0, 0xc0, 0xc0, 0xff } }; -#if 0 -static Color palette2[] = -{ - { 0xff, 0xff, 0xff }, - { 0xe0, 0xe0, 0xe0 }, - { 0xd0, 0xd0, 0xd0 }, - { 0xc0, 0xc0, 0xc0 }, - { 0xb0, 0xb0, 0xb0 }, - { 0xa0, 0xa0, 0xa0 }, - { 0x90, 0x90, 0x90 }, - { 0x80, 0x80, 0x80 }, - { 0x70, 0x70, 0x70 }, - { 0x60, 0x60, 0x60 }, - { 0x50, 0x50, 0x50 }, - { 0x40, 0x40, 0x40 }, - { 0x30, 0x30, 0x30 }, - { 0x20, 0x20, 0x20 }, - { 0x10, 0x10, 0x10 }, - { 0x00, 0x00, 0x00 } -}; -#endif - // for alpha we use x^(1/1.3) static Color palette2[] = { @@ -209,6 +187,27 @@ static Color palette2[] = { 0x00, 0x00, 0x00, 0xff } }; +static Color palette3[] = +{ + { 0xff, 0xff, 0xff, 0xff }, + { 0xe0, 0xe0, 0xe0, 0xff }, + { 0xd0, 0xd0, 0xd0, 0xff }, + { 0xc0, 0xc0, 0xc0, 0xff }, + { 0xb0, 0xb0, 0xb0, 0xff }, + { 0xa0, 0xa0, 0xa0, 0xff }, + { 0x90, 0x90, 0x90, 0xff }, + { 0x80, 0x80, 0x80, 0xff }, + { 0x70, 0x70, 0x70, 0xff }, + { 0x60, 0x60, 0x60, 0xff }, + { 0x50, 0x50, 0x50, 0xff }, + { 0x40, 0x40, 0x40, 0xff }, + { 0x30, 0x30, 0x30, 0xff }, + { 0x20, 0x20, 0x20, 0xff }, + { 0x10, 0x10, 0x10, 0xff }, + { 0x00, 0x00, 0x00, 0xff } +}; + + Image::Image(int w,int h) { static int hue = Config_getInt("HTML_COLORSTYLE_HUE"); @@ -401,12 +400,15 @@ bool Image::save(const char *fileName,int mode) return FALSE; } #endif + static bool useTransparency = Config_getBool("FORMULA_TRANSPARENT"); uchar* buffer; size_t bufferSize; LodePNG_Encoder encoder; LodePNG_Encoder_init(&encoder); int numCols = mode==0 ? 8 : 16; - Color *pPal = mode==0 ? palette : palette2; + Color *pPal = mode==0 ? palette : + useTransparency ? palette2 : + palette3 ; int i; for (i=0;i<numCols;i++,pPal++) { |