CrystalSpace

Public API Reference

Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

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, int nPalColors = 256);
00100 
00104   virtual 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 
00144   virtual csPtr<iImage> MipMap (int step, csRGBpixel *transp);
00145 
00147   virtual void SetName (const char *iName);
00149   virtual const char *GetName ();
00151   virtual int GetFormat ();
00153   virtual csRGBpixel *GetPalette ();
00155   virtual uint8 *GetAlpha ();
00157   virtual void SetFormat (int iFormat);
00159   virtual csPtr<iImage> Clone ();
00161   virtual csPtr<iImage> Crop (int x, int y, int width, int height);
00163   virtual void CheckAlpha ();
00165   virtual bool HasKeycolor ();
00167   virtual void GetKeycolor (int &r, int &g, int &b);
00169   virtual csPtr<iImage> Sharpen (csRGBpixel *transp, int strength);
00170   virtual int HasMipmaps ();
00171 };
00172 
00173 #endif // __CS_IMAGE_H__

Generated for Crystal Space by doxygen 1.2.14