summaryrefslogtreecommitdiff
path: root/common/image.h
diff options
context:
space:
mode:
authorleo2001-03-26 17:19:57 +0000
committerleo2001-03-26 17:19:57 +0000
commitf1b22e07982337233ee4c1ad4cfbee0334ad93df (patch)
tree4a1c6acb65fd7cf4916f10cbd18e221a0386c126 /common/image.h
parente8c9abea837366ee7dd5f4668ee459a26be32e9c (diff)
Reorganized the Image I/O functions, created a new Image class.
git-svn-id: http://svn.leocad.org/trunk@263 c7d43263-9d01-0410-8a33-9dba5d9f93d6
Diffstat (limited to 'common/image.h')
-rw-r--r--common/image.h49
1 files changed, 44 insertions, 5 deletions
diff --git a/common/image.h b/common/image.h
index 32a76de..ae7fb9e 100644
--- a/common/image.h
+++ b/common/image.h
@@ -5,10 +5,49 @@ class File;
#include "typedefs.h"
-LC_IMAGE* OpenImage(char* filename);
-LC_IMAGE* OpenImage(File* file, unsigned char format);
-bool SaveImage(File* file, LC_IMAGE* image, LC_IMAGE_OPTS* opts);
-bool SaveImage(char* filename, LC_IMAGE* image, LC_IMAGE_OPTS* opts);
-void SaveVideo(char* filename, LC_IMAGE** images, int count, float fps);
+class Image
+{
+public:
+ Image ();
+ virtual ~Image ();
+
+ bool FileSave (File& file, LC_IMAGE_OPTS* opts) const;
+ bool FileSave (const char* filename, LC_IMAGE_OPTS* opts) const;
+ bool FileLoad (File& file);
+ bool FileLoad (const char* filename);
+
+ void Resize (int width, int height);
+ void ResizePow2 ();
+ void FromOpenGL (int width, int height);
+
+ int Width () const
+ { return m_nWidth; }
+ int Height () const
+ { return m_nHeight; }
+ int Alpha () const
+ { return m_bAlpha; }
+ unsigned char* GetData () const
+ { return m_pData; }
+
+protected:
+ void FreeData ();
+
+ bool LoadJPG (File& file);
+ bool LoadBMP (File& file);
+ bool LoadPNG (File& file);
+ bool LoadGIF (File& file);
+
+ bool SaveJPG (File& file, int quality, bool progressive) const;
+ bool SaveBMP (File& file, bool quantize) const;
+ bool SavePNG (File& file, bool transparent, bool interlaced, unsigned char* background) const;
+ bool SaveGIF (File& file, bool transparent, bool interlaced, unsigned char* background) const;
+
+ int m_nWidth;
+ int m_nHeight;
+ bool m_bAlpha;
+ unsigned char* m_pData;
+};
+
+void SaveVideo(char* filename, Image *images, int count, float fps);
#endif // _IMAGE_H_ \ No newline at end of file