Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages
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 #include "csutil/util.h" 00033 #include "igraphic/image.h" 00034 00040 class csImageBase : public iImage 00041 { 00042 protected: 00043 char* fName; 00044 csImageBase() : fName(0) { } 00045 public: 00046 virtual ~csImageBase() { delete[] fName; } 00047 00048 /* Commented out: should be implemented by all descendants. 00049 virtual const void *GetImageData () { return 0; } 00050 virtual int GetWidth () const { return 0; } 00051 virtual int GetHeight () const { return 0; } 00052 */ 00053 // Most images are 2D, so provide a sensible default 00054 virtual int GetDepth () const { return 1; } 00055 00056 virtual void SetName (const char *iName) 00057 { 00058 delete[] fName; fName = csStrNew (iName); 00059 } 00060 virtual const char *GetName () const { return fName; } 00061 00062 /* Commented out: should be implemented by all descendants. 00063 virtual int GetFormat () const { return 0; } 00064 */ 00065 virtual const csRGBpixel* GetPalette () { return 0; } 00066 virtual const uint8* GetAlpha () { return 0; } 00067 00068 virtual bool HasKeyColor () const { return false; } 00069 CS_DEPRECATED_METHOD virtual bool HasKeycolor () const 00070 { return HasKeyColor(); } 00071 00072 virtual void GetKeyColor (int &r, int &g, int &b) const { } 00073 CS_DEPRECATED_METHOD virtual void GetKeycolor (int &r, int &g, int &b) const 00074 { GetKeyColor (r, g, b); } 00075 00076 virtual uint HasMipmaps () const { return 0; } 00077 virtual csRef<iImage> GetMipmap (uint num) 00078 { return (num == 0) ? this : 0; } 00079 00080 virtual const char* GetRawFormat() const { return 0; } 00081 virtual csRef<iDataBuffer> GetRawData() const { return 0; } 00082 virtual csImageType GetImageType() const { return csimg2D; } 00083 virtual uint HasSubImages() const { return 0; } 00084 virtual csRef<iImage> GetSubImage (uint num) 00085 { return (num == 0) ? this : 0; } 00086 }; 00087 00090 #endif // __CS_CSGFX_IMAGEBASE_H__
Generated for Crystal Space by doxygen 1.3.9.1