Google

Main Page   Class Hierarchy   Compound List   File List   Compound Members  

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, csRGBcolor *iPalette, int nPalColors = 256);
00100 
00104   void FreeImage ();
00105 
00107   int closest_index (csRGBpixel *iColor);
00108 
00109 public:
00110   SCF_DECLARE_IBASE;
00111 
00113   virtual ~csImageFile ();
00114 
00115   /**************************** iImage interface *****************************/
00123   virtual void *GetImageData ();
00125   virtual int GetWidth ();
00127   virtual int GetHeight ();
00129   virtual int GetSize ();
00130 
00132   virtual void Rescale (int newwidth, int newheight);
00133 
00143   virtual iImage *MipMap (int step, csRGBpixel *transp);
00144 
00146   virtual void SetName (const char *iName);
00148   virtual const char *GetName ();
00150   virtual int GetFormat ();
00152   virtual csRGBpixel *GetPalette ();
00154   virtual uint8 *GetAlpha ();
00156   virtual void SetFormat (int iFormat);
00158   virtual iImage *Clone ();
00160   virtual iImage *Crop (int x, int y, int width, int height);
00162   virtual void CheckAlpha ();
00164   virtual bool HasKeycolor ();
00166   virtual void GetKeycolor (int &r, int &g, int &b);
00167 };
00168 
00169 #endif // __CS_IMAGE_H__

Generated for Crystal Space by doxygen 1.2.5 written by Dimitri van Heesch, ©1997-2000