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