[ Main ] [ News] [ Download ] [ Screenshots ] [ FAQ ] [ Tutorial ] [ Documentation ] [ Forum ] [ Chat ] [ Links ]

Functions | Variables # cimg_library::cimg Namespace Reference Namespace that encompasses low-level functions and variables of the CImg Library. More...
## Functions
std::FILE * | output (std::FILE *file)
| Set/get output stream for CImg library messages.
void | info ()
| Print informations about CImg environement variables.
double | eval (const char *const expression, const double x=0, const double y=0, const double z=0, const double v=0)
| Evaluate math expression.
void | warn (const char *const format,...)
| Display a warning message.
int | system (const char *const command, const char *const module_name=0)
template<typename T >
T & | temporary (const T &)
| Return a reference to a temporary variable of type T.
template<typename T >
void | swap (T &a, T &b)
| Exchange values of variables `a` and `b`.
template<typename T1 , typename T2 >
void | swap (T1 &a1, T1 &b1, T2 &a2, T2 &b2)
| Exchange values of variables (`a1`,`a2`) and (`b1`,`b2`).
template<typename T1 , typename T2 , typename T3 >
void | swap (T1 &a1, T1 &b1, T2 &a2, T2 &b2, T3 &a3, T3 &b3)
| Exchange values of variables (`a1`,`a2`,`a3`) and (`b1`,`b2`,`b3`).
template<typename T1 , typename T2 , typename T3 , typename T4 >
void | swap (T1 &a1, T1 &b1, T2 &a2, T2 &b2, T3 &a3, T3 &b3, T4 &a4, T4 &b4)
| Exchange values of variables (`a1`,`a2`,...,`a4`) and (`b1`,`b2`,...,`b4`).
template<typename T1 , typename T2 , typename T3 , typename T4 , typename T5 >
void | swap (T1 &a1, T1 &b1, T2 &a2, T2 &b2, T3 &a3, T3 &b3, T4 &a4, T4 &b4, T5 &a5, T5 &b5)
| Exchange values of variables (`a1`,`a2`,...,`a5`) and (`b1`,`b2`,...,`b5`).
template<typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 >
void | swap (T1 &a1, T1 &b1, T2 &a2, T2 &b2, T3 &a3, T3 &b3, T4 &a4, T4 &b4, T5 &a5, T5 &b5, T6 &a6, T6 &b6)
| Exchange values of variables (`a1`,`a2`,...,`a6`) and (`b1`,`b2`,...,`b6`).
template<typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 >
void | swap (T1 &a1, T1 &b1, T2 &a2, T2 &b2, T3 &a3, T3 &b3, T4 &a4, T4 &b4, T5 &a5, T5 &b5, T6 &a6, T6 &b6, T7 &a7, T7 &b7)
| Exchange values of variables (`a1`,`a2`,...,`a7`) and (`b1`,`b2`,...,`b7`).
template<typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 >
void | swap (T1 &a1, T1 &b1, T2 &a2, T2 &b2, T3 &a3, T3 &b3, T4 &a4, T4 &b4, T5 &a5, T5 &b5, T6 &a6, T6 &b6, T7 &a7, T7 &b7, T8 &a8, T8 &b8)
| Exchange values of variables (`a1`,`a2`,...,`a8`) and (`b1`,`b2`,...,`b8`).
bool | endianness ()
| Return the current endianness of the CPU.
template<typename T >
void | invert_endianness (T *const buffer, const unsigned int size)
| Invert endianness of a memory buffer.
template<typename T >
T & | invert_endianness (T &a)
| Invert endianness of a single variable.
unsigned long | time ()
| Get the value of a system timer with a millisecond precision.
void | sleep (const unsigned int milliseconds)
| Sleep for a certain numbers of milliseconds.
unsigned int | wait (const unsigned int milliseconds)
| Wait for a certain number of milliseconds since the last call.
template<typename T >
T | rol (const T a, const unsigned int n=1)
| Return a left bitwise-rotated number.
template<typename T >
T | ror (const T a, const unsigned int n=1)
| Return a right bitwise-rotated number.
template<typename T >
T | abs (const T a)
| Return the absolute value of a number.
template<typename T >
T | sqr (const T val)
| Return the square of a number.
int | xln (const int x)
| Return 1 + log_10(x).
template<typename t1 , typename t2 >
cimg::superset< t1, t2 >::type | min (const t1 &a, const t2 &b)
| Return the minimum value between two numbers.
template<typename t1 , typename t2 , typename t3 >
cimg::superset2< t1, t2, t3 >::type | min (const t1 &a, const t2 &b, const t3 &c)
| Return the minimum value between three numbers.
template<typename t1 , typename t2 , typename t3 , typename t4 >
cimg::superset3< t1, t2, t3, t4 >::type | min (const t1 &a, const t2 &b, const t3 &c, const t4 &d)
| Return the minimum value between four numbers.
template<typename t1 , typename t2 >
cimg::superset< t1, t2 >::type | max (const t1 &a, const t2 &b)
| Return the maximum value between two numbers.
template<typename t1 , typename t2 , typename t3 >
cimg::superset2< t1, t2, t3 >::type | max (const t1 &a, const t2 &b, const t3 &c)
| Return the maximum value between three numbers.
template<typename t1 , typename t2 , typename t3 , typename t4 >
cimg::superset3< t1, t2, t3, t4 >::type | max (const t1 &a, const t2 &b, const t3 &c, const t4 &d)
| Return the maximum value between four numbers.
template<typename T >
T | sign (const T x)
| Return the sign of a number.
template<typename T >
unsigned int | nearest_pow2 (const T x)
| Return the nearest power of 2 higher than a given number.
double | sinc (const double x)
| Return the sinc() of a given number.
template<typename T >
T | mod (const T &x, const T &m)
| Return the modulo of a number.
template<typename T >
T | minmod (const T a, const T b)
| Return the minmod of two numbers.
double | rand ()
| Return a random variable between [0,1] with respect to an uniform distribution.
double | crand ()
| Return a random variable between [-1,1] with respect to an uniform distribution.
double | grand ()
| Return a random variable following a gaussian distribution and a standard deviation of 1.
unsigned int | prand (const double z)
| Return a random variable following a Poisson distribution of parameter z.
template<typename T >
T | round (const T x, const double y=1, const int rounding_type=0)
| Return a rounded number.
char | uncase (const char x)
| Remove the 'case' of an ASCII character.
void | uncase (char *const string)
| Remove the 'case' of a C string.
double | atof (const char *const str)
| Read a double number from a C-string.
int | strncasecmp (const char *const s1, const char *const s2, const int l)
| Compare the first `n` characters of two C-strings, ignoring the case.
int | strcasecmp (const char *const s1, const char *const s2)
| Compare two C-strings, ignoring the case.
bool | strpare (char *const s, const char delimiter=' ', const bool symmetric=false, const bool is_iterative=false)
| Remove useless delimiters on the borders of a C-string.
void | strescape (char *const s)
| Replace explicit escape sequences '' in C-strings.
const char * | basename (const char *const s)
| Compute the basename of a filename.
const char * | temporary_path (const char *const user_path=0, const bool reinit_path=false)
| Return or set path to store temporary files.
const char * | imagemagick_path (const char *const user_path=0, const bool reinit_path=false)
| Return or set path to the ImageMagick's `convert` tool.
const char * | graphicsmagick_path (const char *const user_path=0, const bool reinit_path=false)
| Return path of the GraphicsMagick's `gm` tool.
const char * | medcon_path (const char *const user_path=0, const bool reinit_path=false)
| Return or set path of the `XMedcon` tool.
const char * | ffmpeg_path (const char *const user_path=0, const bool reinit_path=false)
| Return or set path to the 'ffmpeg' command.
const char * | gzip_path (const char *const user_path=0, const bool reinit_path=false)
| Return or set path to the 'gzip' command.
const char * | gunzip_path (const char *const user_path=0, const bool reinit_path=false)
| Return or set path to the 'gunzip' command.
const char * | dcraw_path (const char *const user_path=0, const bool reinit_path=false)
| Return or set path to the 'dcraw' command.
const char * | split_filename (const char *const filename, char *const body=0)
| Split a filename into two strings 'body' and 'extension'.
char * | number_filename (const char *const filename, const int number, const unsigned int n, char *const string)
| Create a numbered version of a filename.
std::FILE * | fopen (const char *const path, const char *const mode)
| Open a file, and check for possible errors.
int | fclose (std::FILE *file)
| Close a file, and check for possible errors.
const char * | file_type (std::FILE *const file, const char *const filename)
| Try to guess the image format of a filename, using the magic numbers in its header.
template<typename T >
int | fread (T *const ptr, const unsigned int nmemb, std::FILE *stream)
| Read file data, and check for possible errors.
template<typename T >
int | fwrite (const T *ptr, const unsigned int nmemb, std::FILE *stream)
| Write data to a file, and check for possible errors.
template<typename t >
int | dialog (const char *const title, const char *const msg, const char *const button1_label, const char *const button2_label, const char *const button3_label, const char *const button4_label, const char *const button5_label, const char *const button6_label, const CImg< t > &logo, const bool centering=false)
| Display a dialog box, where a user can click standard buttons.
## Variables
const double | PI = 3.14159265358979323846
| Definition of the mathematical constant PI.
## Detailed Description Namespace that encompasses low-level functions and variables of the CImg Library. Most of the functions and variables within this namespace are used by the library for low-level processing. Nevertheless, documented variables and functions of this namespace may be used safely in your own source code. Warning: Never write `using namespace cimg_library::cimg;` in your source code, since a lot of functions of the `cimg::` namespace have prototypes similar to standard C functions that could defined in the global namespace `::`. ## Function Documentation
void info | ( |  | ) |
Print informations about CImg environement variables. Printing is done on the standard error output.
void cimg_library::cimg::warn | ( | const char *const | format,
|  |  | ... |
| ) |  |  |
  Display a warning message. Parameters:
  | format | is a C-string describing the format of the message, as in `std::printf()`.
int cimg_library::cimg::system | ( | const char *const | command,
|  | const char *const | module_name = `0` |
| ) |  |  |
Note: This function is similar to `std::system()` and is here because using the `std::` version on Windows may open undesired consoles.
bool cimg_library::cimg::endianness | ( |  | ) |
Return the current endianness of the CPU. Returns: `false` for "Little Endian", `true` for "Big Endian".
void cimg_library::cimg::sleep | ( | const unsigned int | milliseconds | ) |
Sleep for a certain numbers of milliseconds. This function frees the CPU ressources during the sleeping time. It may be used to temporize your program properly, without wasting CPU time.
unsigned int cimg_library::cimg::wait | ( | const unsigned int | milliseconds | ) |
Wait for a certain number of milliseconds since the last call. This function is equivalent to sleep() but the waiting time is computed with regard to the last call of wait(). It may be used to temporize your program properly.
T cimg_library::cimg::abs | ( | const T | a | ) |
Return the absolute value of a number. Note: This function is different from `std::abs()` or `std::fabs()` because it is able to consider a variable of any type, without cast needed.
T cimg_library::cimg::mod | ( | const T & | x,
|  | const T & | m |
| ) |  |  |
Return the modulo of a number. Note: This modulo function accepts negative and floating-points modulo numbers, as well as variable of any type.
T cimg_library::cimg::minmod | ( | const T | a,
|  | const T | b |
| ) |  |  |
Return the minmod of two numbers. minmod(`a`,`b`) is defined to be : minmod(`a`,`b`) = min(`a`,`b`), if `a` and `b` have the same sign. minmod(`a`,`b`) = 0, if `a` and `b` have different signs.
T cimg_library::cimg::round | ( | const T | x,
|  | const double | y = `1`,
|  | const int | rounding_type = `0` |
| ) |  |  |
  Return a rounded number. Parameters:
  | x | is the number to be rounded.
  | y | is the rounding precision.
  | rounding_type | defines the type of rounding (0=nearest, -1=backward, 1=forward).
Returns: the rounded value, with the same type as parameter x.
void cimg_library::cimg::uncase | ( | char *const | string | ) |
Remove the 'case' of a C string. Acts in-place.
double cimg_library::cimg::atof | ( | const char *const | str | ) |
Read a double number from a C-string. Note: This function is quite similar to `std::atof()`, but that it allows the retrieval of fractions as in "1/2".
int cimg_library::cimg::strncasecmp | ( | const char *const | s1,
|  | const char *const | s2,
|  | const int | l |
| ) |  |  |
Compare the first `n` characters of two C-strings, ignoring the case. Note: This function is defined since it is not provided by all compilers (not an ANSI function).
int cimg_library::cimg::strcasecmp | ( | const char *const | s1,
|  | const char *const | s2 |
| ) |  |  |
Compare two C-strings, ignoring the case. Note: This function is defined since it is not provided by all compilers (not an ANSI function).
int cimg_library::cimg::dialog | ( | const char *const | title,
|  | const char *const | msg,
|  | const char *const | button1_label,
|  | const char *const | button2_label,
|  | const char *const | button3_label,
|  | const char *const | button4_label,
|  | const char *const | button5_label,
|  | const char *const | button6_label,
|  | const CImg< t > & | logo,
|  | const bool | centering = `false` |
| ) |  |  |
  Display a dialog box, where a user can click standard buttons. Up to 6 buttons can be defined in the dialog window. This function returns when a user clicked one of the button or closed the dialog window. Parameters:
  | title | = Title of the dialog window.
  | msg | = Main message displayed inside the dialog window.
  | button1_label | = Label of the 1st button.
  | button2_label | = Label of the 2nd button.
  | button3_label | = Label of the 3rd button.
  | button4_label | = Label of the 4th button.
  | button5_label | = Label of the 5th button.
  | button6_label | = Label of the 6th button.
  | logo | = Logo image displayed at the left of the main message. This parameter is optional.
  | centering | = Tell to center the dialog window on the screen.
Returns: The button number (from 0 to 5), or -1 if the dialog window has been closed by the user. Note: If a button text is set to 0, then the corresponding button (and the followings) won't appear in the dialog box. At least one button is necessary.