| ## Public API Reference

- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

- File List
- File Members

# csgfx/imagebase.h

Go to the documentation of this file.

    00001 /*
    00002     Copyright (C) 2005 by Jorrit Tyberghein
    00003               (C) 2005 by Frank Richter
    00004
    00005     This library is free software; you can redistribute it and/or
    00006     modify it under the terms of the GNU Library General Public
    00007     License as published by the Free Software Foundation; either
    00008     version 2 of the License, or (at your option) any later version.
    00009
    00010     This library 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 GNU
    00013     Library General Public License for more details.
    00014
    00015     You should have received a copy of the GNU Library General Public
    00016     License along with this library; if not, write to the Free
    00017     Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
    00018 */
    00019
    00028 #ifndef __CS_CSGFX_IMAGEBASE_H__
    00029 #define __CS_CSGFX_IMAGEBASE_H__
    00030
    00031 #include "csextern.h"
    00032
    00033 #include "csutil/util.h"
    00034 #include "csutil/databuf.h"
    00035 #include "csutil/scf_implementation.h"
    00036
    00037 #include "igraphic/image.h"
    00038
    00039 #include "csutil/win32/msvc_deprecated_warn_off.h"
    00040
    00044 class csImageBase :
    00045   public scfImplementation1<csImageBase, iImage>
    00046 {
    00047 protected:
    00049   char* fName;
    00051   csImageBase() :
    00052     scfImplementationType(this, 0), fName(0)
    00053   { }
    00054 public:
    00055   virtual ~csImageBase() { delete[] fName; }
    00056
    00057   /* Commented out: should be implemented by all descendants.
    00058   virtual const void *GetImageData () { return 0; }
    00059   virtual int GetWidth () const { return 0; }
    00060   virtual int GetHeight () const { return 0; }
    00061   */
    00062   // Most images are 2D, so provide a sensible default
    00063   virtual int GetDepth () const { return 1; }
    00064
    00065   virtual void SetName (const char *iName)
    00066   {
    00067     delete[] fName; fName = csStrNew (iName);
    00068   }
    00069   virtual const char *GetName () const { return fName; }
    00070
    00071   /* Commented out: should be implemented by all descendants.
    00072   virtual int GetFormat () const { return 0; }
    00073   */
    00074   virtual const csRGBpixel* GetPalette () { return 0; }
    00075   virtual const uint8* GetAlpha () { return 0; }
    00076
    00077   virtual bool HasKeyColor () const { return false; }
    00078   CS_DEPRECATED_METHOD virtual bool HasKeycolor () const
    00079   { return HasKeyColor(); }
    00080
    00081   virtual void GetKeyColor (int & /*r*/, int & /*g*/, int & /*b*/) const { }
    00082   CS_DEPRECATED_METHOD virtual void GetKeycolor (int &r, int &g, int &b) const
    00083   { GetKeyColor (r, g, b); }
    00084
    00085   virtual uint HasMipmaps () const { return 0; }
    00086   virtual csRef<iImage> GetMipmap (uint num)
    00087   { return (num == 0) ? this : 0; }
    00088
    00089   virtual const char* GetRawFormat() const { return 0; }
    00090   virtual csRef<iDataBuffer> GetRawData() const { return 0; }
    00091   virtual csImageType GetImageType() const { return csimg2D; }
    00092   virtual uint HasSubImages() const { return 0; }
    00093   virtual csRef<iImage> GetSubImage (uint num)
    00094   { return (num == 0) ? this : 0; }
    00095 };
    00096
    00097 #include "csutil/win32/msvc_deprecated_warn_on.h"
    00098
    00101 #endif // __CS_CSGFX_IMAGEBASE_H__