iImage.h
Go to the documentation of this file.
00001 /*
00002 imagen - Simple object-oriented imaging library
00003 Copyright (C) 2011-2012 Mark D. Procarione
00004 
00005 imagen is free software: you can redistribute it and/or
00006 modify it under the terms of the GNU Lesser General Public
00007 License as published by the Free Software Foundation, either
00008 version 3 of the License, or (at your option) any later version.
00009 
00010 imagen is distributed in the hope that it will be useful,
00011 but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00013 GNU General Public License for more details.
00014 */
00015 
00016 #ifndef __IIMAGE_H__
00017 #define __IIMAGE_H__
00018 
00019 #include "imagen.h"
00020 
00021 #include "iAbstractImage.h"
00022 
00023 namespace imagen
00024 {
00026 
00035     class iImage : public iAbstractImage
00036     {
00037         public:
00039             iImage();
00040 
00042 
00043             iImage( const iImage &img );
00044 
00046             iImage( const iAbstractImage &img );
00047 
00049 
00053             iImage( int w, int h, iImageFormat f );
00054 
00056 
00058             iImage( Iubyte *d, int w, int h, iImageFormat f, int b );
00059 
00061 
00062             iImage( const char *filename );
00063 
00065 
00066             iImage( const char *filename, iImageType tp );
00067 
00069 
00070             iImage( Iubyte *buf, int len );
00071 
00073 
00074             iImage( Iubyte *buf, int len, iImageType tp );
00075 
00077 
00078             iImage( iDataStream *s );
00079 
00081 
00082             iImage( iDataStream *s, iImageType tp );
00083 
00085             ~iImage();
00086 
00088 
00094             bool load( const char *filename );
00095 
00097 
00104             bool load( const char *filename, iImageType tp );
00105 
00107 
00113             bool load( Iubyte *buf, int len );
00114 
00116 
00122             bool load( Iubyte *buf, int len, iImageType tp );
00123 
00125 
00128             bool load( iDataStream *s );
00129 
00131 
00134             bool load( iDataStream *s, iImageType tp  );
00135 
00137 
00142             bool save( const char *filename );
00143 
00145 
00148             bool save( const char *filename, iImageType tp );
00149 
00151 
00157            bool save( Iubyte *buf, int len );
00158 
00160 
00164             bool save( Iubyte *buf, int len, iImageType tp );
00165 
00167 
00170             bool save( iDataStream *s );
00171 
00173 
00176             bool save( iDataStream *s, iImageType tp );
00177 
00178             void clear();
00179 
00180             bool isFormatSupported( iImageFormat fmt ) const { return false; }
00181 
00182             iImage &operator=( const iAbstractImage &img );
00183 
00184         protected:
00185             void init();
00186             bool loadImage();
00187             bool saveImage();
00188 
00189         private:
00190             iImageType determineType( const char *ext );
00191     };
00192 }
00193 
00194 #endif // __IIMAGE_H__