summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryazoo <yazoo>2007-04-14 00:26:41 +0000
committeryazoo <yazoo>2007-04-14 00:26:41 +0000
commit79e08a88a832597996acc2b39dda462a4016513f (patch)
tree7e483f1907907277e0b7ba521c2a8f2df8502fed
parent9cfe7c26d1819a7cdbeb177079753de50fee8064 (diff)
Adding methods to Image class to enable caller to know which formats are supported.
-rw-r--r--include/Image.h1
-rw-r--r--lib/Image.cc14
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;