From 79e08a88a832597996acc2b39dda462a4016513f Mon Sep 17 00:00:00 2001
From: yazoo <yazoo>
Date: Sat, 14 Apr 2007 00:26:41 +0000
Subject: Adding methods to Image class to enable caller to know which formats
 are supported.

---
 include/Image.h |  1 +
 lib/Image.cc    | 14 ++++++++++++++
 2 files changed, 15 insertions(+)

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;
 
-- 
cgit v1.2.3