diff options
-rw-r--r-- | include/Image.h | 1 | ||||
-rw-r--r-- | lib/Image.cc | 14 |
2 files changed, 15 insertions, 0 deletions
diff --git a/include/Image.h b/include/Image.h index 55e96a5..7aac45d 100644 --- a/include/Image.h +++ b/include/Image.h @@ -21,6 +21,7 @@ class Image : public Buffer { void Fill(Color = Color(0, 0, 0)); virtual String GetName() const; virtual bool CanWrite() const; + bool SupportsFormat(unsigned int); private: unsigned int x, y; diff --git a/lib/Image.cc b/lib/Image.cc index f4d2ee0..8a87a0e 100644 --- a/lib/Image.cc +++ b/lib/Image.cc @@ -167,6 +167,20 @@ unsigned char * Image::GetBuffer() { #define WORDS_BIGENDIAN 1 #endif +bool Image::SupportsFormat(unsigned int f) { + switch(f) { + case FORMAT_TGA_BASIC: + return true; + case FORMAT_JPEG: +#ifndef HAVE_LIBJPEG + return false; +#else + return true; +#endif + } + return false; +} + bool Image::Prepare(unsigned int f) throw (GeneralException) { int ix, iy; |