Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

provider_jpeg.h

Go to the documentation of this file.
00001 /*
00002         ------------------------------------------------------------------------
00003         JPEG-SurfaceProvider Class
00004         written by Ingo Ruhnke
00005 
00006         in order to work with
00007         ClanLib, the platform independent game SDK.
00008 
00009         This file is distributed under the GNU LIBRARY GENERAL PUBLIC LICENSE
00010         version 2. See COPYING for details.
00011 
00012         For a total list of contributers see CREDITS.
00013 
00014         ------------------------------------------------------------------------
00015 */
00016 
00018 
00019 #ifndef header_provider_jpeg
00020 #define header_provider_jpeg
00021 
00022 #include "../Display/Display/surfaceprovider.h"
00023 
00024 class CL_Surface;
00025 class CL_String;
00026 class CL_InputSourceProvider;
00027 
00028 class CL_JPEGProvider : public CL_SurfaceProvider
00029 //: Surface provider that can load JPEG (.jpg) files.
00030 {
00031 public:
00032         static CL_Surface *create(
00033                 const CL_String &handle, 
00034                 CL_InputSourceProvider *provider=NULL, 
00035                 bool transparent=true,
00036                 bool ignore_alphachannel=false);
00037 
00038         //: Loads the JPEG file 'handle' from the inputsource provider 'provider. 
00039         //: Creates a CL_Surface using the JPEG image and returns it.
00040 
00041         CL_JPEGProvider(
00042                 CL_String name, 
00043                 CL_InputSourceProvider *provider = NULL,
00044                 bool transparent=true,
00045                 bool ignore_alphachannel=false);
00046         //: Constructs a surface provider that can read PNG files.
00054 
00055         virtual ~CL_JPEGProvider();
00056 
00057         virtual unsigned int get_pitch() const;
00058         //: Returns the pitch of the image (bytes per line).
00059 
00060         virtual unsigned int get_width() const;
00061         //: Returns the width of the image.
00062 
00063         virtual unsigned int get_height() const;
00064         //: Returns the height of the image.
00065         
00066         virtual unsigned int get_num_frames() const;
00067         //: Returns the number of subsprites in the image.
00068 
00069         virtual EPixelFormat get_pixel_format() const;
00070         //: Returns the pixelformat used by the image.
00071 
00072         virtual CL_Palette *get_palette() const;
00073         //: Returns the palette used by the image. NULL if system palette.
00074 
00075         virtual unsigned int get_src_colorkey() const;
00076         //: Returns the transparency color used.
00077 
00078         virtual bool uses_src_colorkey() const;
00079         //: Returns whether a source colorkey is used.
00080 
00081         virtual bool is_indexed() const;
00082         //: Returns whether the target uses an indexed color mode or not.
00083         
00084         virtual unsigned int get_red_mask() const;
00085         //: Returns the red color mask used by the target.
00086 
00087         virtual unsigned int get_green_mask() const;
00088         //: Returns the green color mask by the target.
00089 
00090         virtual unsigned int get_blue_mask() const;
00091         //: Returns the blue color mask by the target.
00092 
00093         virtual unsigned int get_alpha_mask() const;
00094         //: Returns the alpha mask by the target.
00095 
00096         virtual void *get_data() const;
00097         //: Returns the image data. Provider must be locked before pointer is valid.
00098 
00099         virtual void lock();
00100         //: Locks the surface provider.
00101 
00102         virtual void unlock();
00103         //: Unlocks the surface provider.
00104 
00105 private:
00106         class CL_JPEGProvider_Generic *impl;
00107 };
00108 
00109 class CL_SetupJPEG
00110 {
00111 public:
00112         static void init();
00113         static void deinit();
00114 };
00115 
00116 #endif

Generated at Wed Apr 4 19:54:02 2001 for ClanLib by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001