diff options
-rw-r--r-- | Makefile | 12 | ||||
-rw-r--r-- | bitmap.c | 22 | ||||
-rw-r--r-- | bitmap.h | 11 |
3 files changed, 19 insertions, 26 deletions
@@ -1,14 +1,14 @@ -# exchange the comments on the following to lines if you would like to use -# Imlib2 for loading images. BEWARE that you can not use GraphTFT together with -# Text2Skin if you use Imlib2! (That's why I actually implemented ImageMagick) - #DEBUG=1 #BENCH=1 STRIP=strip +# BEWARE that you can not use GraphTFT together with +# Text2Skin if you use Imlib2! (That's why I actually implemented ImageMagick) +# TBD: is this still true? + +# Define only one of these. HAVE_IMAGEMAGICK=1 -#HAVE_IMLIB2=1 -# not recommended +#HAVE_IMLIB2=1 # not recommended # DO NOT EDIT BELOW THIS LINE UNLESS YOU KNOW WHAT YOU'RE DOING @@ -62,16 +62,7 @@ cText2SkinBitmap *cText2SkinBitmap::Load(const std::string &Filename, int Alpha, if (fname.substr(len - 4, 4) == ".xpm") result = res->LoadXpm(fname.c_str()); else { -#ifdef HAVE_IMLIB2 - result = res->LoadImlib(fname.c_str(),height,width,colors, Quiet); -#else -# ifdef HAVE_IMAGEMAGICK - result = res->LoadMagick(fname.c_str(),height,width,colors, Quiet); -# else - if (!Quiet) - esyslog("ERROR: text2skin: unknown file format for %s", fname); -# endif -#endif + result = res->LoadNonXpm(fname.c_str(), height, width, colors, Quiet); } } else if (!Quiet) esyslog("ERROR: text2skin: filename %s too short to identify format", fname.c_str()); @@ -159,8 +150,15 @@ bool cText2SkinBitmap::LoadXpm(const char *Filename) { return false; } +#if !(defined(HAVE_IMLIB2) || defined(HAVE_IMAGEMAGICK)) +bool cText2SkinBitmap::LoadNonXpm(const char *Filename, int height, int width, int colors, bool Quiet) { + if (!Quiet) + esyslog("ERROR: text2skin: unknown file format for %s", Filename); +} +#endif + #ifdef HAVE_IMLIB2 -bool cText2SkinBitmap::LoadImlib(const char *Filename, int height, int width, int colors, bool Quiet) { +bool cText2SkinBitmap::LoadNonXpm(const char *Filename, int height, int width, int colors, bool Quiet) { Imlib_Image image; unsigned char * outputImage = NULL; unsigned int * outputPalette = NULL; @@ -205,7 +203,7 @@ bool cText2SkinBitmap::LoadImlib(const char *Filename, int height, int width, in #endif #ifdef HAVE_IMAGEMAGICK -bool cText2SkinBitmap::LoadMagick(const char *Filename, int height, int width, int colors, bool Quiet) { +bool cText2SkinBitmap::LoadNonXpm(const char *Filename, int height, int width, int colors, bool Quiet) { std::vector<Image> images; cBitmap *bmp = NULL; try { @@ -72,6 +72,9 @@ private: // disallow direct construction cText2SkinBitmap(void); + bool LoadXpm(const char *Filename); + bool LoadNonXpm(const char *Filename, int height, int width, int colors, bool Quiet); + public: static cText2SkinBitmap *Load(const std::string &Filename, int Alpha = 0, int height = 0, int width = 0, int colors = 0, bool Quiet = false); @@ -86,14 +89,6 @@ public: cBitmap &Get(uint &UpdateIn, uint Now); void SetColor(int Index, tColor Color); void SetAlpha(int Alpha); - - bool LoadXpm(const char *Filename); -#ifdef HAVE_IMLIB2 - bool LoadImlib(const char *Filename,int height, int width, int colors, bool Quiet); -#endif -#ifdef HAVE_IMAGEMAGICK - bool LoadMagick(const char *Filename,int height, int width, int colors, bool Quiet); -#endif }; inline void cText2SkinBitmap::SetColor(int Index, tColor Color) { |