1.1 diff -r 5edfbd3e7a46 -r 1204ebf9340d PTdecode/CImg-1.3.0/examples/gmic.h 1.2 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.3 +++ b/PTdecode/CImg-1.3.0/examples/gmic.h Mon Aug 03 14:09:20 2009 +0100 1.4 @@ -0,0 +1,145 @@ 1.5 +/* 1.6 + # 1.7 + # File : gmic.h 1.8 + # ( C++ header file ) 1.9 + # 1.10 + # Description : GREYC's Magic Image Converter 1.11 + # ( http://gmic.sourceforge.net ) 1.12 + # This file is a part of the CImg Library project. 1.13 + # ( http://cimg.sourceforge.net ) 1.14 + # 1.15 + # Note : This file cannot be compiled on VC++ 6. 1.16 + # 1.17 + # Copyright : David Tschumperle 1.18 + # ( http://www.greyc.ensicaen.fr/~dtschump/ ) 1.19 + # 1.20 + # License : CeCILL v2.0 1.21 + # ( http://www.cecill.info/licences/Licence_CeCILL_V2-en.html ) 1.22 + # 1.23 + # This software is governed by the CeCILL license under French law and 1.24 + # abiding by the rules of distribution of free software. You can use, 1.25 + # modify and/ or redistribute the software under the terms of the CeCILL 1.26 + # license as circulated by CEA, CNRS and INRIA at the following URL 1.27 + # "http://www.cecill.info". 1.28 + # 1.29 + # As a counterpart to the access to the source code and rights to copy, 1.30 + # modify and redistribute granted by the license, users are provided only 1.31 + # with a limited warranty and the software's author, the holder of the 1.32 + # economic rights, and the successive licensors have only limited 1.33 + # liability. 1.34 + # 1.35 + # In this respect, the user's attention is drawn to the risks associated 1.36 + # with loading, using, modifying and/or developing or reproducing the 1.37 + # software by the user in light of its specific status of free software, 1.38 + # that may mean that it is complicated to manipulate, and that also 1.39 + # therefore means that it is reserved for developers and experienced 1.40 + # professionals having in-depth computer knowledge. Users are therefore 1.41 + # encouraged to load and test the software's suitability as regards their 1.42 + # requirements in conditions enabling the security of their systems and/or 1.43 + # data to be ensured and, more generally, to use and operate it in the 1.44 + # same conditions as regards security. 1.45 + # 1.46 + # The fact that you are presently reading this means that you have had 1.47 + # knowledge of the CeCILL license and that you accept its terms. 1.48 + # 1.49 +*/ 1.50 + 1.51 +#ifndef gmic_version 1.52 +#include "CImg.h" 1.53 +#define gmic_version 1304 1.54 + 1.55 +// The lines below are necessary when using a non-standard compiler such as visualcpp6. 1.56 +#ifdef cimg_use_visualcpp6 1.57 +#define std 1.58 +#endif 1.59 +#ifdef min 1.60 +#undef min 1.61 +#undef max 1.62 +#endif 1.63 + 1.64 +// Define G'MIC Exception class. 1.65 +//------------------------------ 1.66 +struct gmic_exception { 1.67 + char message[4096]; 1.68 + gmic_exception(); 1.69 + gmic_exception(const char *format, ...); 1.70 + gmic_exception(const char *format, std::va_list ap); 1.71 +}; 1.72 + 1.73 +// Define G'MIC interpreter class. 1.74 +//-------------------------------- 1.75 +struct gmic { 1.76 + 1.77 + // Internal variables. 1.78 + cimg_library::CImgList<char> command_line, filenames, macros, commands; 1.79 + cimg_library::CImgList<int> dowhile, repeatdone; 1.80 + bool is_released, is_debug, is_fullpath, is_begin, is_oriented3d; 1.81 + int verbosity_level, render3d, renderd3d; 1.82 + float focale3d, light3d_x, light3d_y, light3d_z, specular_light3d, specular_shine3d; 1.83 + unsigned char background3d[3]; 1.84 + unsigned int position; 1.85 + 1.86 + // Constructors - Destructors. 1.87 + gmic(); 1.88 + template<typename T> gmic(const int argc, const char *const *const argv, cimg_library::CImgList<T>& images, 1.89 + const char *const custom_macros=0, const bool add_macros_at_start=true); 1.90 + template<typename T> gmic(const char *const command, cimg_library::CImgList<T>& images, 1.91 + const char *const custom_macros=0, const bool add_macros_at_start=true); 1.92 + gmic& assign(const unsigned int size, const char *const custom_macros=0, 1.93 + const bool add_macros_at_start=true); 1.94 + 1.95 + // Messages procedures. 1.96 + const gmic& error(const char *format, ...) const; 1.97 + const gmic& warning(const char *format, ...) const; 1.98 + const gmic& debug(const char *format, ...) const; 1.99 + const gmic& print(const char *format, ...) const; 1.100 + 1.101 + // Add macros. 1.102 + gmic& add_macros(const char *const data_macros, const unsigned int data_size, const bool add_macros_at_start=true); 1.103 + gmic& add_macros(std::FILE *const file, const bool add_macros_at_start=true); 1.104 + 1.105 + // Return indices of the images from a string. 1.106 + cimg_library::CImg<unsigned int> indices2cimg(const char *const string, const unsigned int indice_max, 1.107 + const char *const command) const; 1.108 + 1.109 + // Return stringified version of indices or filenames. 1.110 + char* indices2string(const cimg_library::CImg<unsigned int>& indices, const bool display_indices) const; 1.111 + 1.112 + // Display image data. 1.113 + template<typename T> 1.114 + bool display_images(const cimg_library::CImgList<T>& images, const cimg_library::CImg<unsigned int>& indices, 1.115 + const bool verbose) const; 1.116 + template<typename T> 1.117 + bool display_objects3d(const cimg_library::CImgList<T>& images, const cimg_library::CImg<unsigned int>& indices, 1.118 + const bool verbose) const; 1.119 + template<typename T> 1.120 + bool display_plots(const cimg_library::CImgList<T>& images, const cimg_library::CImg<unsigned int>& indices, 1.121 + const unsigned int plot_type, const unsigned int vertex_type, 1.122 + const double xmin, const double xmax, 1.123 + const double ymin, const double ymax, 1.124 + const bool verbose) const; 1.125 + 1.126 + // Substitute '@' expressions. 1.127 + template<typename T> 1.128 + cimg_library::CImg<char> substitute_arobace(const char *const argument, const cimg_library::CImgList<T>& images) const; 1.129 + 1.130 + // Main parsing procedure. 1.131 + template<typename T> 1.132 + gmic& parse(cimg_library::CImgList<T> &images); 1.133 + gmic& parse_bool(cimg_library::CImgList<bool>& images); 1.134 + gmic& parse_uchar(cimg_library::CImgList<unsigned char>& images); 1.135 + gmic& parse_char(cimg_library::CImgList<char>& images); 1.136 + gmic& parse_ushort(cimg_library::CImgList<unsigned short>& images); 1.137 + gmic& parse_short(cimg_library::CImgList<short>& images); 1.138 + gmic& parse_uint(cimg_library::CImgList<unsigned int>& images); 1.139 + gmic& parse_int(cimg_library::CImgList<int>& images); 1.140 + gmic& parse_float(cimg_library::CImgList<float>& images); 1.141 + gmic& parse_double(cimg_library::CImgList<double>& images); 1.142 + 1.143 +}; // End of the 'gmic' class. 1.144 + 1.145 +#endif 1.146 + 1.147 +// Local Variables: 1.148 +// mode: c++ 1.149 +// End: