00001 /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- 00002 00003 this file is part of rcssserver3D 00004 Fri May 9 2003 00005 Copyright (C) 2002,2003 Koblenz University 00006 Copyright (C) 2003 RoboCup Soccer Server 3D Maintenance Group 00007 $Id: image.h,v 1.7 2003/11/14 14:05:51 fruit Exp $ 00008 00009 This program is free software; you can redistribute it and/or modify 00010 it under the terms of the GNU General Public License as published by 00011 the Free Software Foundation; version 2 of the License. 00012 00013 This program is distributed in the hope that it will be useful, 00014 but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 GNU General Public License for more details. 00017 00018 You should have received a copy of the GNU General Public License 00019 along with this program; if not, write to the Free Software 00020 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00021 */ 00022 #ifndef KEROSIN_IMAGE_H 00023 #define KEROSIN_IMAGE_H 00024 00025 /* Image - A Wrapper for the DevIL Library 00026 00027 NOTE: 00028 00029 HISTORY: 00030 11.07.01 - MK 00031 - Initial version 00032 28.08.01 - MK 00033 - Added support for a palette 00034 29.08.01 - MK 00035 - Rewrite for DevIL 00036 03.09.01 - MK 00037 - OpenGL texture support 00038 00039 TODO: 00040 - add RGB access 00041 - image creation 00042 00043 00044 TOFIX: 00045 */ 00046 00047 #include <IL/il.h> 00048 00049 namespace kerosin 00050 { 00051 00052 class Image 00053 { 00054 public: 00055 // constructor/destructor 00056 Image(); 00057 virtual ~Image(); 00058 00059 // this makes the image active 00060 void Bind(); 00061 00062 // image information 00063 ILuint Width(); // width 00064 ILuint Height(); // height 00065 ILuint Depth(); // depth (==1 for 2d images, >1 for 3d images) 00066 00067 ILuint BitsPP(); // bits per pixel 00068 ILuint BytesPP(); // bytes per pixel 00069 00070 ILuint Type(); // format of pixels 00071 ILuint Format(); // byte format of image 00072 00073 ILubyte*Data(); 00074 00075 bool HasAlpha(); // does the format have an alpha channel 00076 bool Create(int w, int h, int b, void *data = NULL); 00077 00078 // the interface functions ... these *have* to be implemented by derived classes 00079 //virtual bool Create() = 0; 00080 //virtual void SetPixel(int x, int y, long color) const = 0; 00081 //virtual long GetPixel(int x, int y) const = 0; 00082 00083 /* 00084 virtual long MakeCol(int a, int r, int g, int b) const = 0; 00085 virtual void GetCol(long col, int& a, int& r, int& g, int& b) const = 0; 00086 virtual int GetA(long col) const = 0; 00087 virtual int GetR(long col) const = 0; 00088 virtual int GetG(long col) const = 0; 00089 virtual int GetB(long col) const = 0; 00090 00091 // accessors 00092 f_inline void SetWidth (int inWidth) { mWidth = inWidth; } 00093 f_inline void SetHeight(int inHeight) { mHeight = inHeight; } 00094 */ 00095 protected: 00096 ILuint mId; // the DevIL ID which this image is bound to 00097 }; 00098 00099 } // namespace kerosin 00100 00101 #endif //KEROSIN_IMAGE_H