• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

spl/Image.h

00001 /*
00002  *   This file is part of the Standard Portable Library (SPL).
00003  *
00004  *   SPL is free software: you can redistribute it and/or modify
00005  *   it under the terms of the GNU General Public License as published by
00006  *   the Free Software Foundation, either version 3 of the License, or
00007  *   (at your option) any later version.
00008  *
00009  *   SPL is distributed in the hope that it will be useful,
00010  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  *   GNU General Public License for more details.
00013  *
00014  *   You should have received a copy of the GNU General Public License
00015  *   along with SPL.  If not, see <http://www.gnu.org/licenses/>.
00016  */
00017 #ifndef _image_h
00018 #define _image_h
00019 
00020 #include <spl/types.h>
00021 #include <spl/Debug.h>
00022 #include <spl/Memory.h>
00023 
00033 class Image : public IMemoryValidate
00034 {
00035 private:
00036         // forbid copy constructor
00037         inline Image(const Image& i) {}
00038         inline void operator =(const Image& i) {}
00039 
00040 protected:
00041         byte *m_pixels;
00042         int m_w, m_h;
00043     int m_depth, m_bpp;
00044         unsigned int m_rmask, m_gmask, m_bmask, m_amask;
00045     unsigned int m_red[256], m_green[256], m_blue[256], m_alpha[256];
00046 
00047 public:
00048         Image();
00049         virtual ~Image();
00050 
00051         byte *Pixels() { return m_pixels; }
00052         int Depth() { return m_depth; }
00053         int Bbp() { return m_bpp; }
00054         int Width() { return m_w; }
00055         int Height() { return m_h; }
00056         unsigned int RMask() { return m_rmask; }
00057         unsigned int GMask() { return m_gmask; }
00058         unsigned int BMask() { return m_bmask; }
00059         unsigned int AMask() { return m_amask; }
00060         unsigned int *PRed() { return m_red; }
00061         unsigned int *PGreen() { return m_green; }
00062         unsigned int *PBlue() { return m_blue; }
00063         unsigned int *PAlpha() { return m_alpha; }
00064 
00066         static Image *GetImage( const char *filename );
00067 
00068 #ifdef DEBUG
00069         virtual void ValidateMem () const;
00070         virtual void CheckMem () const;
00071 #endif
00072 };
00073 
00076 #endif