1.1 diff -r 5edfbd3e7a46 -r 1204ebf9340d PTdecode/CImg-1.3.0/plugins/add_fileformat.h 1.2 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.3 +++ b/PTdecode/CImg-1.3.0/plugins/add_fileformat.h Mon Aug 03 14:09:20 2009 +0100 1.4 @@ -0,0 +1,79 @@ 1.5 +/* 1.6 + # 1.7 + # File : add_fileformat.h 1.8 + # ( C++ header file - CImg plug-in ) 1.9 + # 1.10 + # Description : CImg plug-in that adds loading/saving support for a personalized 1.11 + # file format (determined by its extension, here ".foo"). 1.12 + # This file is a part of the CImg Library project. 1.13 + # ( http://cimg.sourceforge.net ) 1.14 + # 1.15 + # Copyright : David Tschumperle 1.16 + # ( http://www.greyc.ensicaen.fr/~dtschump/ ) 1.17 + # 1.18 + # License : CeCILL v2.0 1.19 + # ( http://www.cecill.info/licences/Licence_CeCILL_V2-en.html ) 1.20 + # 1.21 + # This software is governed by the CeCILL license under French law and 1.22 + # abiding by the rules of distribution of free software. You can use, 1.23 + # modify and/ or redistribute the software under the terms of the CeCILL 1.24 + # license as circulated by CEA, CNRS and INRIA at the following URL 1.25 + # "http://www.cecill.info". 1.26 + # 1.27 + # As a counterpart to the access to the source code and rights to copy, 1.28 + # modify and redistribute granted by the license, users are provided only 1.29 + # with a limited warranty and the software's author, the holder of the 1.30 + # economic rights, and the successive licensors have only limited 1.31 + # liability. 1.32 + # 1.33 + # In this respect, the user's attention is drawn to the risks associated 1.34 + # with loading, using, modifying and/or developing or reproducing the 1.35 + # software by the user in light of its specific status of free software, 1.36 + # that may mean that it is complicated to manipulate, and that also 1.37 + # therefore means that it is reserved for developers and experienced 1.38 + # professionals having in-depth computer knowledge. Users are therefore 1.39 + # encouraged to load and test the software's suitability as regards their 1.40 + # requirements in conditions enabling the security of their systems and/or 1.41 + # data to be ensured and, more generally, to use and operate it in the 1.42 + # same conditions as regards security. 1.43 + # 1.44 + # The fact that you are presently reading this means that you have had 1.45 + # knowledge of the CeCILL license and that you accept its terms. 1.46 + # 1.47 +*/ 1.48 + 1.49 +#ifndef cimg_plugin_addfileformat 1.50 +#define cimg_plugin_addfileformat 1.51 + 1.52 +// These functions load ".foo" filenames 1.53 +//--------------------------------------- 1.54 +static CImg<T> get_load_foo(const char *filename) { 1.55 + std::fprintf(stderr,"Load '%s' here..\n",filename); 1.56 + return CImg<T>(512,512,1,3,0).noise(30); 1.57 +} 1.58 + 1.59 +CImg& load_foo(const char *filename) { 1.60 + return get_load_foo(filename).swap(*this); 1.61 +} 1.62 + 1.63 +// This function saves the instance image into a ".foo" file. 1.64 +//----------------------------------------------------------- 1.65 +const CImg& save_foo(const char *filename) const { 1.66 + std::fprintf(stderr,"Save '%s' here..\n",filename); 1.67 + return *this; 1.68 +} 1.69 + 1.70 +// The code below allows to add the support for the specified extension. 1.71 +//--------------------------------------------------------------------- 1.72 +#ifndef cimg_load_plugin 1.73 +#define cimg_load_plugin(filename) \ 1.74 + if (!cimg::strncasecmp(cimg::split_filename(filename),"foo",3)) return load_foo(filename); 1.75 +#endif 1.76 +#ifndef cimg_save_plugin 1.77 +#define cimg_save_plugin(filename) \ 1.78 + if (!cimg::strncasecmp(cimg::split_filename(filename),"foo",3)) return save_foo(filename); 1.79 +#endif 1.80 + 1.81 +// End of the plugin. 1.82 +//------------------- 1.83 +#endif