From f1b22e07982337233ee4c1ad4cfbee0334ad93df Mon Sep 17 00:00:00 2001 From: leo Date: Mon, 26 Mar 2001 17:19:57 +0000 Subject: 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 --- common/image.h | 49 ++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 44 insertions(+), 5 deletions(-) (limited to 'common/image.h') 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 -- cgit v1.2.3