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

provider_jpeg.cpp

Go to the documentation of this file.
00001 /*
00002         ------------------------------------------------------------------------
00003         ClanLib, the platform independent game SDK.
00004 
00005         This library is distributed under the GNU LIBRARY GENERAL PUBLIC LICENSE
00006         version 2. See COPYING for details.
00007 
00008         For a total list of contributers see CREDITS.
00009 
00010         ------------------------------------------------------------------------
00011 */
00012 
00013 #include "API/JPEG/provider_jpeg.h"
00014 #include "provider_jpeg_generic.h"
00015 #include "API/Display/Display/surface.h"
00016 #include "API/Display/Display/res_surface.h"
00017 
00018 CL_Surface *CL_JPEGProvider::create(
00019         const CL_String &file,
00020         CL_InputSourceProvider *provider, 
00021         bool transparent,
00022         bool ignore_alphachannel)
00023 {
00024         return CL_Surface::create(
00025                 new CL_JPEGProvider(
00026                         file,
00027                         provider, 
00028                         transparent,
00029                         ignore_alphachannel),
00030                 true);
00031 }
00032 
00033 CL_JPEGProvider::CL_JPEGProvider(
00034         CL_String name, 
00035         CL_InputSourceProvider *provider,
00036         bool transparent,
00037         bool ignore_alphachannel)
00038 : impl(NULL)
00039 {
00040         impl = new CL_JPEGProvider_Generic(name, provider, transparent, ignore_alphachannel);
00041 }
00042 
00043 CL_JPEGProvider::~CL_JPEGProvider()
00044 {
00045         delete impl;
00046 }
00047 
00048 unsigned int CL_JPEGProvider::get_pitch() const
00049 {
00050         return impl->get_pitch();
00051 }
00052 
00053 unsigned int CL_JPEGProvider::get_width() const
00054 {
00055         return impl->get_width();
00056 }
00057 
00058 unsigned int CL_JPEGProvider::get_height() const
00059 {
00060         return impl->get_height();
00061 }
00062 
00063 unsigned int CL_JPEGProvider::get_num_frames() const
00064 {
00065         return impl->get_num_frames();
00066 }
00067 
00068 EPixelFormat CL_JPEGProvider::get_pixel_format() const
00069 {
00070         return impl->get_pixel_format();
00071 }
00072 
00073 CL_Palette *CL_JPEGProvider::get_palette() const
00074 {
00075         return impl->get_palette();
00076 }
00077 
00078 unsigned int CL_JPEGProvider::get_src_colorkey() const
00079 {
00080         return impl->get_src_colorkey();
00081 }
00082 
00083 bool CL_JPEGProvider::uses_src_colorkey() const
00084 {
00085         return impl->uses_src_colorkey();
00086 }
00087 
00088 bool CL_JPEGProvider::is_indexed() const
00089 {
00090         return impl->is_indexed();
00091 }
00092 
00093 unsigned int CL_JPEGProvider::get_red_mask() const
00094 {
00095         return impl->get_red_mask();
00096 }
00097 
00098 unsigned int CL_JPEGProvider::get_green_mask() const
00099 {
00100         return impl->get_green_mask();
00101 }
00102 
00103 unsigned int CL_JPEGProvider::get_blue_mask() const
00104 {
00105         return impl->get_blue_mask();
00106 }
00107 
00108 unsigned int CL_JPEGProvider::get_alpha_mask() const
00109 {
00110         return impl->get_alpha_mask();
00111 }
00112 
00113 void *CL_JPEGProvider::get_data() const
00114 {
00115         return impl->get_data();
00116 }
00117 
00118 void CL_JPEGProvider::lock()
00119 {
00120         impl->perform_lock();
00121 }
00122 
00123 void CL_JPEGProvider::unlock()
00124 {
00125         impl->perform_unlock();
00126 }
00127 
00129 // Resource support:
00130 
00131 class CL_JPEG_ResourceSource : public CL_ResourceSource_Surface
00132 {
00133 public:
00134         virtual const char *get_name() { return "jpg"; }
00135 
00136         virtual bool can_create(
00137                 std::string ext,
00138                 CL_ResourceOptions *options)
00139                 {
00140                         if (ext == ".jpg") return true;
00141                         if (options->exists("jpg")) return true;
00142 
00143                         return false;
00144                 }
00145 
00146         virtual CL_SurfaceProvider *create(
00147                 std::string filename,
00148                 CL_ResourceOptions *options,
00149                 CL_ResourceManager *parent)
00150                 {
00151                         return new CL_JPEGProvider(filename.c_str(), NULL);
00152                 }
00153 };
00154 
00155 static CL_JPEG_ResourceSource *res_source_jpeg = NULL;
00156 
00157 void CL_SetupJPEG::init()
00158 {
00159         res_source_jpeg = new CL_JPEG_ResourceSource;
00160 }
00161 
00162 void CL_SetupJPEG::deinit()
00163 {
00164         delete res_source_jpeg;
00165         res_source_jpeg = NULL;
00166 }

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