PTdecode/CImg-1.3.0/examples/gmic.h

Mon, 03 Aug 2009 14:09:20 +0100

author
Philip Pemberton <philpem@philpem.me.uk>
date
Mon, 03 Aug 2009 14:09:20 +0100
changeset 5
1204ebf9340d
permissions
-rwxr-xr-x

added P-touch decoder source

philpem@5 1 /*
philpem@5 2 #
philpem@5 3 # File : gmic.h
philpem@5 4 # ( C++ header file )
philpem@5 5 #
philpem@5 6 # Description : GREYC's Magic Image Converter
philpem@5 7 # ( http://gmic.sourceforge.net )
philpem@5 8 # This file is a part of the CImg Library project.
philpem@5 9 # ( http://cimg.sourceforge.net )
philpem@5 10 #
philpem@5 11 # Note : This file cannot be compiled on VC++ 6.
philpem@5 12 #
philpem@5 13 # Copyright : David Tschumperle
philpem@5 14 # ( http://www.greyc.ensicaen.fr/~dtschump/ )
philpem@5 15 #
philpem@5 16 # License : CeCILL v2.0
philpem@5 17 # ( http://www.cecill.info/licences/Licence_CeCILL_V2-en.html )
philpem@5 18 #
philpem@5 19 # This software is governed by the CeCILL license under French law and
philpem@5 20 # abiding by the rules of distribution of free software. You can use,
philpem@5 21 # modify and/ or redistribute the software under the terms of the CeCILL
philpem@5 22 # license as circulated by CEA, CNRS and INRIA at the following URL
philpem@5 23 # "http://www.cecill.info".
philpem@5 24 #
philpem@5 25 # As a counterpart to the access to the source code and rights to copy,
philpem@5 26 # modify and redistribute granted by the license, users are provided only
philpem@5 27 # with a limited warranty and the software's author, the holder of the
philpem@5 28 # economic rights, and the successive licensors have only limited
philpem@5 29 # liability.
philpem@5 30 #
philpem@5 31 # In this respect, the user's attention is drawn to the risks associated
philpem@5 32 # with loading, using, modifying and/or developing or reproducing the
philpem@5 33 # software by the user in light of its specific status of free software,
philpem@5 34 # that may mean that it is complicated to manipulate, and that also
philpem@5 35 # therefore means that it is reserved for developers and experienced
philpem@5 36 # professionals having in-depth computer knowledge. Users are therefore
philpem@5 37 # encouraged to load and test the software's suitability as regards their
philpem@5 38 # requirements in conditions enabling the security of their systems and/or
philpem@5 39 # data to be ensured and, more generally, to use and operate it in the
philpem@5 40 # same conditions as regards security.
philpem@5 41 #
philpem@5 42 # The fact that you are presently reading this means that you have had
philpem@5 43 # knowledge of the CeCILL license and that you accept its terms.
philpem@5 44 #
philpem@5 45 */
philpem@5 46
philpem@5 47 #ifndef gmic_version
philpem@5 48 #include "CImg.h"
philpem@5 49 #define gmic_version 1304
philpem@5 50
philpem@5 51 // The lines below are necessary when using a non-standard compiler such as visualcpp6.
philpem@5 52 #ifdef cimg_use_visualcpp6
philpem@5 53 #define std
philpem@5 54 #endif
philpem@5 55 #ifdef min
philpem@5 56 #undef min
philpem@5 57 #undef max
philpem@5 58 #endif
philpem@5 59
philpem@5 60 // Define G'MIC Exception class.
philpem@5 61 //------------------------------
philpem@5 62 struct gmic_exception {
philpem@5 63 char message[4096];
philpem@5 64 gmic_exception();
philpem@5 65 gmic_exception(const char *format, ...);
philpem@5 66 gmic_exception(const char *format, std::va_list ap);
philpem@5 67 };
philpem@5 68
philpem@5 69 // Define G'MIC interpreter class.
philpem@5 70 //--------------------------------
philpem@5 71 struct gmic {
philpem@5 72
philpem@5 73 // Internal variables.
philpem@5 74 cimg_library::CImgList<char> command_line, filenames, macros, commands;
philpem@5 75 cimg_library::CImgList<int> dowhile, repeatdone;
philpem@5 76 bool is_released, is_debug, is_fullpath, is_begin, is_oriented3d;
philpem@5 77 int verbosity_level, render3d, renderd3d;
philpem@5 78 float focale3d, light3d_x, light3d_y, light3d_z, specular_light3d, specular_shine3d;
philpem@5 79 unsigned char background3d[3];
philpem@5 80 unsigned int position;
philpem@5 81
philpem@5 82 // Constructors - Destructors.
philpem@5 83 gmic();
philpem@5 84 template<typename T> gmic(const int argc, const char *const *const argv, cimg_library::CImgList<T>& images,
philpem@5 85 const char *const custom_macros=0, const bool add_macros_at_start=true);
philpem@5 86 template<typename T> gmic(const char *const command, cimg_library::CImgList<T>& images,
philpem@5 87 const char *const custom_macros=0, const bool add_macros_at_start=true);
philpem@5 88 gmic& assign(const unsigned int size, const char *const custom_macros=0,
philpem@5 89 const bool add_macros_at_start=true);
philpem@5 90
philpem@5 91 // Messages procedures.
philpem@5 92 const gmic& error(const char *format, ...) const;
philpem@5 93 const gmic& warning(const char *format, ...) const;
philpem@5 94 const gmic& debug(const char *format, ...) const;
philpem@5 95 const gmic& print(const char *format, ...) const;
philpem@5 96
philpem@5 97 // Add macros.
philpem@5 98 gmic& add_macros(const char *const data_macros, const unsigned int data_size, const bool add_macros_at_start=true);
philpem@5 99 gmic& add_macros(std::FILE *const file, const bool add_macros_at_start=true);
philpem@5 100
philpem@5 101 // Return indices of the images from a string.
philpem@5 102 cimg_library::CImg<unsigned int> indices2cimg(const char *const string, const unsigned int indice_max,
philpem@5 103 const char *const command) const;
philpem@5 104
philpem@5 105 // Return stringified version of indices or filenames.
philpem@5 106 char* indices2string(const cimg_library::CImg<unsigned int>& indices, const bool display_indices) const;
philpem@5 107
philpem@5 108 // Display image data.
philpem@5 109 template<typename T>
philpem@5 110 bool display_images(const cimg_library::CImgList<T>& images, const cimg_library::CImg<unsigned int>& indices,
philpem@5 111 const bool verbose) const;
philpem@5 112 template<typename T>
philpem@5 113 bool display_objects3d(const cimg_library::CImgList<T>& images, const cimg_library::CImg<unsigned int>& indices,
philpem@5 114 const bool verbose) const;
philpem@5 115 template<typename T>
philpem@5 116 bool display_plots(const cimg_library::CImgList<T>& images, const cimg_library::CImg<unsigned int>& indices,
philpem@5 117 const unsigned int plot_type, const unsigned int vertex_type,
philpem@5 118 const double xmin, const double xmax,
philpem@5 119 const double ymin, const double ymax,
philpem@5 120 const bool verbose) const;
philpem@5 121
philpem@5 122 // Substitute '@' expressions.
philpem@5 123 template<typename T>
philpem@5 124 cimg_library::CImg<char> substitute_arobace(const char *const argument, const cimg_library::CImgList<T>& images) const;
philpem@5 125
philpem@5 126 // Main parsing procedure.
philpem@5 127 template<typename T>
philpem@5 128 gmic& parse(cimg_library::CImgList<T> &images);
philpem@5 129 gmic& parse_bool(cimg_library::CImgList<bool>& images);
philpem@5 130 gmic& parse_uchar(cimg_library::CImgList<unsigned char>& images);
philpem@5 131 gmic& parse_char(cimg_library::CImgList<char>& images);
philpem@5 132 gmic& parse_ushort(cimg_library::CImgList<unsigned short>& images);
philpem@5 133 gmic& parse_short(cimg_library::CImgList<short>& images);
philpem@5 134 gmic& parse_uint(cimg_library::CImgList<unsigned int>& images);
philpem@5 135 gmic& parse_int(cimg_library::CImgList<int>& images);
philpem@5 136 gmic& parse_float(cimg_library::CImgList<float>& images);
philpem@5 137 gmic& parse_double(cimg_library::CImgList<double>& images);
philpem@5 138
philpem@5 139 }; // End of the 'gmic' class.
philpem@5 140
philpem@5 141 #endif
philpem@5 142
philpem@5 143 // Local Variables:
philpem@5 144 // mode: c++
philpem@5 145 // End: