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 "csextern.h" 00024 00025 #include <stdio.h> 00026 #include "csgfx/rgbpixel.h" 00027 #include "cstypes.h" 00028 #include "igraphic/image.h" 00029 00036 class CS_CSGFX_EXPORT csImageFile : public iImage 00037 { 00038 protected: 00040 int Width; 00042 int Height; 00044 void* Image; 00046 csRGBpixel *Palette; 00048 uint8 *Alpha; 00050 char *fName; 00052 int Format; 00054 uint8 has_keycolour, keycolour_r, keycolour_g, keycolour_b; 00055 00061 csImageFile (int iFormat); 00062 00071 void set_dimensions (int w, int h); 00072 00084 void convert_rgba (csRGBpixel *iImage); 00085 00094 void convert_pal8 (uint8 *iImage, csRGBpixel *iPalette, int nPalColors = 256); 00095 00101 void convert_pal8 (uint8 *iImage, const csRGBcolor *iPalette, 00102 int nPalColors = 256); 00103 00107 virtual void FreeImage (); 00108 00110 int closest_index (csRGBpixel *iColor); 00111 00112 public: 00113 SCF_DECLARE_IBASE; 00114 00116 virtual ~csImageFile (); 00117 00118 /**************************** iImage interface *****************************/ 00126 virtual void *GetImageData (); 00128 virtual int GetWidth (); 00130 virtual int GetHeight (); 00132 virtual int GetSize (); 00133 00135 virtual void Rescale (int newwidth, int newheight); 00136 00147 virtual csPtr<iImage> MipMap (int step, csRGBpixel *transp); 00148 00150 virtual void SetName (const char *iName); 00152 virtual const char *GetName (); 00154 virtual int GetFormat (); 00156 virtual csRGBpixel *GetPalette (); 00158 virtual uint8 *GetAlpha (); 00160 virtual void SetFormat (int iFormat); 00162 virtual csPtr<iImage> Clone (); 00164 virtual csPtr<iImage> Crop (int x, int y, int width, int height); 00166 virtual void CheckAlpha (); 00168 virtual bool HasKeycolor (); 00170 virtual void GetKeycolor (int &r, int &g, int &b); 00172 virtual csPtr<iImage> Sharpen (csRGBpixel *transp, int strength); 00173 virtual int HasMipmaps (); 00174 }; 00175 00176 #endif // __CS_IMAGE_H__
Generated for Crystal Space by doxygen 1.2.18