1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/PTdecode/CImg-1.3.0/html/reference/group__cimg__overview.html Mon Aug 03 14:09:20 2009 +0100 1.3 @@ -0,0 +1,205 @@ 1.4 + xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> 1.5 +<head> 1.6 +<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></meta> 1.7 +<title>The CImg Library - C++ Template Image Processing Toolkit</title> 1.8 +<meta content="David Tschumperle" name="author"></meta> 1.9 +<link rel="shortcut icon" type="image/x-icon" href="http://cimg.sourceforge.net/favicon.ico"></link> 1.10 +<link rel="icon" type="image/png" href="favicon.png"></link> 1.11 +<link href="doxygen.css" rel="stylesheet" type="text/css"> 1.12 +<link href="tabs.css" rel="stylesheet" type="text/css"> 1.13 +<style type="text/css"> 1.14 +<!-- 1.15 +body {background-color:white; font-family:sans-serif; } 1.16 +a:active{text-decoration:none; color:#303090} 1.17 +a:link{text-decoration:none; color:#303090} 1.18 +a:visited{text-decoration:none; color:#303090} 1.19 +a:hover{text-decoration:underline; color:#4E9F71} 1.20 +--> 1.21 +</style> 1.22 +<script language="JavaScript" type="text/javascript"> 1.23 + <!-- Original: Eric King (eric_andrew_king@hotmail.com) is used to display images in popup windows --> 1.24 + <!-- Web Site: http://redrival.com/eak/ --> 1.25 + <!-- This script and many more are available free online at --> 1.26 + <!-- The JavaScript Source!! http://javascript.internet.com --> 1.27 + <!-- Begin 1.28 + function NewWindow(mypage, myname, w, h, scroll) { 1.29 + var winl = (screen.width - w) / 2; 1.30 + var wint = (screen.height - h) / 2; 1.31 + winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable' 1.32 + win = window.open(mypage, myname, winprops) 1.33 + if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); } 1.34 + } 1.35 + // End --> 1.36 +</script> 1.37 +</head> 1.38 +<body> 1.39 + <table align="center" border="0" cellpadding="0" cellspacing="0" width="100%"> 1.40 + <tbody><tr><td> 1.41 + <hr noshade="noshade" size="1" width="90%"></hr> 1.42 + <center> 1.43 + <br/> 1.44 + <a href="http://cimg.sourceforge.net"><img src="http://cimg.sourceforge.net/img/CImgLogo.jpg" alt="" border="0"></img></a><br/> 1.45 + <br/> 1.46 + </center> 1.47 + <hr noshade="noshade" size="1" width="90%"></hr> 1.48 + <center> 1.49 + <table bgcolor="#EEEEFF" style="width: 90%; text-align: left; margin-left: auto; margin-right: auto;" border="0" cellpadding="3" cellspacing="0"> 1.50 + <tbody><tr><td style="text-align: center; vertical-align: top;"> 1.51 + <font color="#FFFFFF" face="Arial,Helvetica" size="-1"> 1.52 + <b>[</b> <a target="_parent" href="http://cimg.sourceforge.net/index.shtml">Main</a> <b>]</b> 1.53 + <b>[</b> <a target="_parent" href="http://cimg.sourceforge.net/news.shtml">News</a><b>] </b> 1.54 + <b>[</b> <a target="_parent" href="http://cimg.sourceforge.net/download.shtml">Download</a> <b>]</b> 1.55 + <b>[</b> <a target="_parent" href="http://cimg.sourceforge.net/screenshots.shtml">Screenshots</a> <b>]</b> 1.56 + <b>[</b> <a target="_parent" href="http://cimg.sourceforge.net/reference/group__cimg__faq.html">FAQ</a> <b>]</b> 1.57 + <b>[</b> <a target="_parent" href="http://cimg.sourceforge.net/reference/group__cimg__tutorial.html">Tutorial</a> <b>]</b> 1.58 + <b>[</b> <a target="_parent" href="http://cimg.sourceforge.net/reference/index.html">Documentation</a> <b>]</b> 1.59 + <b>[</b> <a target="_parent" href="http://sourceforge.net/forum/forum.php?forum_id=334630">Forum</a> <b>]</b> 1.60 + <b>[</b> <a target="_parent" href="http://cimg.sourceforge.net/chat.shtml">Chat</a> <b>]</b> 1.61 + <b>[</b> <a target="_parent" href="http://cimg.sourceforge.net/links.shtml">Links</a> <b>]</b> 1.62 + </font> 1.63 + </td></tr></tbody> 1.64 + </table> 1.65 + </center> 1.66 + <hr noshade="noshade" size="1" width="90%"></hr> 1.67 + </td></tr></tbody> 1.68 +</table> 1.69 +<!-- Generated by Doxygen 1.5.7.1 --> 1.70 +<script type="text/javascript"> 1.71 +<!-- 1.72 +function changeDisplayState (e){ 1.73 + var num=this.id.replace(/[^[0-9]/g,''); 1.74 + var button=this.firstChild; 1.75 + var sectionDiv=document.getElementById('dynsection'+num); 1.76 + if (sectionDiv.style.display=='none'||sectionDiv.style.display==''){ 1.77 + sectionDiv.style.display='block'; 1.78 + button.src='open.gif'; 1.79 + }else{ 1.80 + sectionDiv.style.display='none'; 1.81 + button.src='closed.gif'; 1.82 + } 1.83 +} 1.84 +function initDynSections(){ 1.85 + var divs=document.getElementsByTagName('div'); 1.86 + var sectionCounter=1; 1.87 + for(var i=0;i<divs.length-1;i++){ 1.88 + if(divs[i].className=='dynheader'&&divs[i+1].className=='dynsection'){ 1.89 + var header=divs[i]; 1.90 + var section=divs[i+1]; 1.91 + var button=header.firstChild; 1.92 + if (button!='IMG'){ 1.93 + divs[i].insertBefore(document.createTextNode(' '),divs[i].firstChild); 1.94 + button=document.createElement('img'); 1.95 + divs[i].insertBefore(button,divs[i].firstChild); 1.96 + } 1.97 + header.style.cursor='pointer'; 1.98 + header.onclick=changeDisplayState; 1.99 + header.id='dynheader'+sectionCounter; 1.100 + button.src='closed.gif'; 1.101 + section.id='dynsection'+sectionCounter; 1.102 + section.style.display='none'; 1.103 + section.style.marginLeft='14px'; 1.104 + sectionCounter++; 1.105 + } 1.106 + } 1.107 +} 1.108 +window.onload = initDynSections; 1.109 +--> 1.110 +</script> 1.111 +<div class="navigation" id="top"> 1.112 + <div class="tabs"> 1.113 + <ul> 1.114 + <li><a href="index.html"><span>Main Page</span></a></li> 1.115 + <li><a href="modules.html"><span>Modules</span></a></li> 1.116 + <li><a href="namespaces.html"><span>Namespaces</span></a></li> 1.117 + <li><a href="annotated.html"><span>Classes</span></a></li> 1.118 + </ul> 1.119 + </div> 1.120 +</div> 1.121 +<div class="contents"> 1.122 +<h1>CImg Library Overview</h1><table border="0" cellpadding="0" cellspacing="0"> 1.123 +<tr><td></td></tr> 1.124 +</table> 1.125 +The <b>CImg Library</b> is an image processing library, designed for C++ programmers. It provides useful classes and functions to load/save, display and process various types of images.<h2><a class="anchor" name="s1"> 1.126 +Library structure</a></h2> 1.127 +The CImg Library consists in a <b>single header file</b> CImg.h providing a set of C++ template classes that can be used in your own sources, to load/save, process and display images or list of images. Very portable (Unix/X11,Windows, MacOS X, FreeBSD,..), efficient, simple to use, it's a pleasant toolkit for coding image processing stuffs in C++.<p> 1.128 +The header file CImg.h contains all the classes and functions that compose the library itself. This is one originality of the CImg Library. This particularly means that :<ul> 1.129 +<li>No pre-compilation of the library is needed, since the compilation of the CImg functions is done at the same time as the compilation of your own C++ code.</li><li>No complex dependencies have to be handled : Just include the CImg.h file, and you get a working C++ image processing toolkit.</li><li>The compilation is done on the fly : only CImg functionalities really used by your program are compiled and appear in the compiled executable program. This leads to very compact code, without any unused stuffs.</li><li>Class members and functions are inlined, leading to better performance during the program execution.</li></ul> 1.130 +<p> 1.131 +The CImg Library is structured as follows :<p> 1.132 +<ul> 1.133 +<li>All library classes and functions are defined in the namespace <a class="el" href="namespacecimg__library.html">cimg_library</a>. This namespace encapsulates the library functionalities and avoid any class name collision that could happen with other includes. Generally, one uses this namespace as a default namespace : <div class="fragment"><pre class="fragment"><span class="preprocessor"> #include "CImg.h"</span> 1.134 + <span class="keyword">using namespace </span>cimg_library; 1.135 + ... 1.136 +</pre></div></li></ul> 1.137 +<p> 1.138 +<ul> 1.139 +<li>The namespace <a class="el" href="namespacecimg__library_1_1cimg.html">cimg_library::cimg</a> defines a set of <em>low-level</em> functions and variables used by the library. Documented functions in this namespace can be safely used in your own program. But, <b>never</b> use the <a class="el" href="namespacecimg__library_1_1cimg.html">cimg_library::cimg</a> namespace as a default namespace, since it contains functions whose names are already defined in the standard C/C++ library.</li></ul> 1.140 +<p> 1.141 +<ul> 1.142 +<li>The class <a class="el" href="structcimg__library_1_1CImg.html">cimg_library::CImg</a><T> represents images up to 4-dimensions wide, containing pixels of type <code>T</code> (template parameter). This is actually the main class of the library.</li></ul> 1.143 +<p> 1.144 +<ul> 1.145 +<li>The class <a class="el" href="structcimg__library_1_1CImgList.html">cimg_library::CImgList</a><T> represents lists of cimg_library::CImg<T> images. It can be used for instance to store different frames of an image sequence.</li></ul> 1.146 +<p> 1.147 +<ul> 1.148 +<li>The class <a class="el" href="structcimg__library_1_1CImgDisplay.html">cimg_library::CImgDisplay</a> is able to display images or image lists into graphical display windows. As you may guess, the code of this class is highly system-dependent but this is transparent for the programmer, as environment variables are automatically set by the CImg library (see also <a class="el" href="group__cimg__environment.html">Setting Environment Variables</a>).</li></ul> 1.149 +<p> 1.150 +<ul> 1.151 +<li>The class <a class="el" href="structcimg__library_1_1CImgException.html">cimg_library::CImgException</a> (and its subclasses) are used by the library to throw exceptions when errors occur. Those exceptions can be catched with a bloc <code>try { ..} catch (CImgException) { .. }</code>. Subclasses define precisely the type of encountered errors.</li></ul> 1.152 +<p> 1.153 +Knowing these four classes is <b>enough</b> to get benefit of the CImg Library functionalities.<h2><a class="anchor" name="s2"> 1.154 +CImg version of "Hello world".</a></h2> 1.155 +Below is a very simple code that creates a "Hello World" image. This shows you basically how a CImg program looks like.<p> 1.156 +<div class="fragment"><pre class="fragment"><span class="preprocessor"> #include "CImg.h"</span> 1.157 + <span class="keyword">using namespace </span>cimg_library; 1.158 + 1.159 + <span class="keywordtype">int</span> main() { 1.160 + CImg<unsigned char> img(640,400,1,3); <span class="comment">// Define a 640x400 color image with 8 bits per color component.</span> 1.161 + img.fill(0); <span class="comment">// Set pixel values to 0 (color : black)</span> 1.162 + <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> purple[] = { 255,0,255 }; <span class="comment">// Define a purple color</span> 1.163 + img.draw_text(<span class="stringliteral">"Hello World"</span>,100,100,purple); <span class="comment">// Draw a purple "Hello world" at coordinates (100,100).</span> 1.164 + img.display(<span class="stringliteral">"My first CImg code"</span>); <span class="comment">// Display the image in a display window.</span> 1.165 + <span class="keywordflow">return</span> 0; 1.166 + } 1.167 +</pre></div><p> 1.168 +Which can be also written in a more compact way as :<p> 1.169 +<div class="fragment"><pre class="fragment"><span class="preprocessor"> #include "CImg.h"</span> 1.170 + <span class="keyword">using namespace </span>cimg_library; 1.171 + 1.172 + <span class="keywordtype">int</span> main() { 1.173 + <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> purple[] = { 255,0,255 }; 1.174 + CImg<unsigned char>(640,400,1,3,0).draw_text(<span class="stringliteral">"Hello World"</span>,100,100,purple).display(<span class="stringliteral">"My first CImg code"</span>); 1.175 + <span class="keywordflow">return</span> 0; 1.176 + } 1.177 +</pre></div><p> 1.178 +Generally, you can write very small code that performs complex image processing tasks. The CImg Library is very simple to use and provide a lot of interesting algorithms for image manipulation.<h2><a class="anchor" name="s3"> 1.179 +How to compile ?</a></h2> 1.180 +The CImg library is a very light and user-friendly library : only standard system libraries are used. It avoid to handle complex dependancies and problems with library compatibility. The only thing you need is a (quite modern) C++ compiler :<p> 1.181 +<ul> 1.182 +<li><b>Microsoft Visual C++ 6.0, Visual Studio.NET and Visual Express Edition</b> : Use project files and solution files provided in the CImg Library package (directory 'compilation/') to see how it works.</li><li><b>Intel ICL compiler</b> : Use the following command to compile a CImg-based program with ICL : <div class="fragment"><pre class="fragment"> icl /Ox hello_world.cpp user32.lib gdi32.lib 1.183 +</pre></div></li><li><b>g++ (MingW windows version)</b> : Use the following command to compile a CImg-based program with g++, on Windows : <div class="fragment"><pre class="fragment"> g++ -o hello_word.exe hello_word.cpp -O2 -lgdi32 1.184 +</pre></div></li><li><b>g++ (Linux version)</b> : Use the following command to compile a CImg-based program with g++, on Linux : <div class="fragment"><pre class="fragment"> g++ -o hello_word.exe hello_world.cpp -O2 -L/usr/X11R6/lib -lm -lpthread -lX11 1.185 +</pre></div></li><li><b>g++ (Solaris version)</b> : Use the following command to compile a CImg-based program with g++, on Solaris : <div class="fragment"><pre class="fragment"> g++ -o hello_word.exe hello_world.cpp -O2 -lm -lpthread -R/usr/X11R6/lib -lrt -lnsl -lsocket 1.186 +</pre></div></li><li><b>g++ (Mac OS X version)</b> : Use the following command to compile a CImg-based program with g++, on Mac OS X : <div class="fragment"><pre class="fragment"> g++ -o hello_word.exe hello_world.cpp -O2 -lm -lpthread -L/usr/X11R6/lib -lm -lpthread -lX11 1.187 +</pre></div></li><li><b>Dev-Cpp</b> : Use the project file provided in the CImg library package to see how it works.</li></ul> 1.188 +<p> 1.189 +If you are using another compilers and encounter problems, please <a href="http://www.greyc.ensicaen.fr/~dtschump">write me</a> since maintaining compatibility is one of the priority of the CImg Library. Nevertheless, old compilers that does not respect the C++ norm will not support the CImg Library.<h2><a class="anchor" name="s4"> 1.190 +What's next ?</a></h2> 1.191 +If you are ready to get more, and to start writing more serious programs with CImg, you are invited to go to the <a class="el" href="group__cimg__tutorial.html">Tutorial : Getting Started.</a> section. </div> 1.192 +<hr noshade="noshade" size="1" width="100%"> 1.193 +<a href="http://sourceforge.net"> 1.194 +<img src="http://sourceforge.net/sflogo.php?group_id=96492&type=3" border="0" height="37" width="125"></img> 1.195 +</a> 1.196 +<!-- Start of StatCounter Code --> 1.197 +<script type="text/javascript" language="javascript"> 1.198 +<!-- 1.199 +var sc_project=895001; 1.200 +var sc_invisible=1; 1.201 +var sc_partition=7; 1.202 +var sc_security="5ea85181"; 1.203 +//--> 1.204 +</script> 1.205 +<script type="text/javascript" language="javascript" src="http://www.statcounter.com/counter/counter.js"></script><noscript><a href="http://www.statcounter.com/" target="_blank"><img src="http://c8.statcounter.com/counter.php?sc_project=895001&java=0&security=5ea85181&invisible=1" alt="counter stats" border="0"></a> </noscript> 1.206 +<!-- End of StatCounter Code --> 1.207 +</body> 1.208 +</html>