csgfx/csimage.h
00001 /* 00002 Copyright (C) 1998-2000 by Jorrit Tyberghein 00003 Contributions made by Ivan Avramovic <ivan@avramovic.com> 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 00020 #ifndef __CS_IMAGE_H__ 00021 #define __CS_IMAGE_H__ 00022 00023 #include <stdio.h> 00024 #include "csgfx/rgbpixel.h" 00025 #include "cstypes.h" 00026 #include "igraphic/image.h" 00027 00034 class csImageFile : public iImage 00035 { 00036 protected: 00038 int Width; 00040 int Height; 00042 void* Image; 00044 csRGBpixel *Palette; 00046 uint8 *Alpha; 00048 char *fName; 00050 int Format; 00052 uint8 has_keycolour, keycolour_r, keycolour_g, keycolour_b; 00053 00059 csImageFile (int iFormat); 00060 00069 void set_dimensions (int w, int h); 00070 00082 void convert_rgba (csRGBpixel *iImage); 00083 00092 void convert_pal8 (uint8 *iImage, csRGBpixel *iPalette, int nPalColors = 256); 00093 00099 void convert_pal8 (uint8 *iImage, const csRGBcolor *iPalette, 00100 int nPalColors = 256); 00101 00105 virtual void FreeImage (); 00106 00108 int closest_index (csRGBpixel *iColor); 00109 00110 public: 00111 SCF_DECLARE_IBASE; 00112 00114 virtual ~csImageFile (); 00115 00116 /**************************** iImage interface *****************************/ 00124 virtual void *GetImageData (); 00126 virtual int GetWidth (); 00128 virtual int GetHeight (); 00130 virtual int GetSize (); 00131 00133 virtual void Rescale (int newwidth, int newheight); 00134 00145 virtual csPtr<iImage> MipMap (int step, csRGBpixel *transp); 00146 00148 virtual void SetName (const char *iName); 00150 virtual const char *GetName (); 00152 virtual int GetFormat (); 00154 virtual csRGBpixel *GetPalette (); 00156 virtual uint8 *GetAlpha (); 00158 virtual void SetFormat (int iFormat); 00160 virtual csPtr<iImage> Clone (); 00162 virtual csPtr<iImage> Crop (int x, int y, int width, int height); 00164 virtual void CheckAlpha (); 00166 virtual bool HasKeycolor (); 00168 virtual void GetKeycolor (int &r, int &g, int &b); 00170 virtual csPtr<iImage> Sharpen (csRGBpixel *transp, int strength); 00171 virtual int HasMipmaps (); 00172 }; 00173 00174 #endif // __CS_IMAGE_H__
Generated for Crystal Space by doxygen 1.2.18