?? structcimg__library_1_1_c_img_exception.html
字號:
<!DOCTYPE html PUBLIC "-//w3c//dtd html 4.0 transitional//en"><html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>The CImg Library - C++ Template Image Processing Library</title> <meta content="David Tschumperle" name="author"> <link rel="shortcut icon" type="image/x-icon" href="http://cimg.sourceforge.net/favicon.ico" /> <link rel="icon" type="image/png" href="favicon.png" /> <style type="text/css" media=screen> <!-- a:active{text-decoration:none; color:#303090} a:link{text-decoration:none; color:#303090} a:visited{text-decoration:none; color:#303090} a:hover{text-decoration:none; color:#4E9F71} --> </style> </head> <body bgcolor="#ffffff" fgcolor="#000000" alink="#ff0000" link="#0000ee" vlink="#551a8b"> <table align="center" border="0" cellpadding="0" cellspacing="0" width="1024"> <tbody> <tr> <td> <hr noshade="noshade" size="1" width="100%"> <center> <a href="http://cimg.sourceforge.net"><img src="../img/CImgLogo2.jpg" border="0"><img src="../img/CImgLogo.jpg" border="0"></a><br> <table style="width: 100%; text-align: left;" border="0" cellpadding="2" cellspacing="2"> <tbody> <tr> <td style="vertical-align: top; text-align: right;"><font face="Arial,Helvetica"><big> <b>C++ Template Image Processing Library.</b></big></font></td> <td style="vertical-align: top; text-align: right;"> <a href="http://www.cnrs.fr/"><img src="../img/logoCNRS.gif" border="0"></a> <a href="http://www.greyc.ensicaen.fr/EquipeImage/"><img src="../img/logoGREYC.gif" border="0"></a> <a href="http://www-sop.inria.fr"><img src="../img/logoINRIA.gif" border="0"></a> </td> </tr> </tbody> </table> </center> <hr noshade="noshade" size="1" width="100%"> <center> <table style="width: 100%; text-align: left; margin-left: auto; margin-right: auto; background-color: rgb(238, 238, 255);" border="0" cellpadding="3" cellspacing="0"> <tbody> <tr> <td style="text-align: center; vertical-align: top;"> <font face="Arial,Helvetica" color="#FFFFFF" size="-1"> <b>[</b> <a target="_parent" href="../index.shtml">Introduction</a> <b>]</b>-<b>[</b> <a target="_parent" href="../news.shtml">News</a> <b>]</b>-<b>[</b> <a target="_parent" href="../download.shtml">Download</a> <b>]</b>-<b>[</b> <a target="_parent" href="../screenshots.shtml">Screenshots</a> <b>]</b>-<b>[</b> <a target="_parent" href="../reference/group__cimg__faq.html">FAQ</a> <b>]</b>-<b>[</b> <a target="_parent" href="../reference/group__cimg__tutorial.html">Tutorial</a> <b>]</b>-<b>[</b> <a target="_parent" href="../links.shtml">Links</a> <b>]</b>-<b>[</b> <a target="_parent" href="http://sourceforge.net/forum/forum.php?forum_id=334630">Forums-Eng</a> <b>]</b>-<b>[</b> <a target="_parent" href="http://sourceforge.net/forum/forum.php?forum_id=421080">Forums-Fr</a> <b>]</b>-<b>[</b> <a target="_parent" href="../reference/index.html">Reference</a> <b>]</b>-<b>[</b> <a target="_parent" href="http://sourceforge.net/projects/cimg/">SourceForge Repository</a> <b>]</b> </font></td> </tr> </tbody> </table> </center> <hr noshade="noshade" size="1" width="100%"> <noscript> </noscript> </td> </tr> </tbody> </table> </body></html><!-- Generated by Doxygen 1.5.1 --><div class="tabs"> <ul> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="modules.html"><span>Modules</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li id="current"><a href="annotated.html"><span>Classes</span></a></li> </ul></div><div class="tabs"> <ul> <li><a href="annotated.html"><span>Class List</span></a></li> <li><a href="hierarchy.html"><span>Class Hierarchy</span></a></li> <li><a href="functions.html"><span>Class Members</span></a></li> </ul></div><div class="nav"><a class="el" href="namespacecimg__library.html">cimg_library</a>::<a class="el" href="structcimg__library_1_1_c_img_exception.html">CImgException</a></div><h1>CImgException Struct Reference</h1><!-- doxytag: class="cimg_library::CImgException" -->Class which is thrown when an error occured during a CImg library function call. <a href="#_details">More...</a><p><a href="structcimg__library_1_1_c_img_exception-members.html">List of all members.</a><table border="0" cellpadding="0" cellspacing="0"><tr><td></td></tr><tr><td colspan="2"><br><h2>Public Attributes</h2></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="4698f05956e353cfe926fc59e4b50a2e"></a><!-- doxytag: member="cimg_library::CImgException::message" ref="4698f05956e353cfe926fc59e4b50a2e" args="[1024]" -->char </td><td class="memItemRight" valign="bottom"><a class="el" href="structcimg__library_1_1_c_img_exception.html#4698f05956e353cfe926fc59e4b50a2e">message</a> [1024]</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Message associated with the error that thrown the exception. <br></td></tr></table><hr><a name="_details"></a><h2>Detailed Description</h2>Class which is thrown when an error occured during a CImg library function call. <p><h2><a class="anchor" name="ex1">Overview</a></h2><a class="el" href="structcimg__library_1_1_c_img_exception.html">CImgException</a> is the base class of CImg exceptions. Exceptions are thrown by the CImg Library when an error occured in a CImg library function call. <a class="el" href="structcimg__library_1_1_c_img_exception.html">CImgException</a> is seldom thrown itself. Children classes that specify the kind of error encountered are generally used instead. These sub-classes are :<p><ul><li><b>CImgInstanceException</b> : Thrown when the instance associated to the called CImg function is not correctly defined. Generally, this exception is thrown when one tries to process <em>empty</em> images. The example below will throw a <em>CImgInstanceException</em>. <div class="fragment"><pre class="fragment"> CImg<float> img; <span class="comment">// Construct an empty image.</span> img.blur(10); <span class="comment">// Try to blur the image.</span></pre></div></li></ul><p><ul><li><b>CImgArgumentException</b> : Thrown when one of the arguments given to the called CImg function is not correct. Generally, this exception is thrown when arguments passed to the function are outside an admissible range of values. The example below will throw a <em>CImgArgumentException</em>. <div class="fragment"><pre class="fragment"> CImg<float> img(100,100,1,3); <span class="comment">// Define a 100x100 color image with float pixels.</span> img = 0; <span class="comment">// Try to fill pixels from the 0 pointer (invalid argument to operator=() ).</span></pre></div></li></ul><p><ul><li><b>CImgIOException</b> : Thrown when an error occured when trying to load or save image files. The example below will throw a <em>CImgIOException</em>. <div class="fragment"><pre class="fragment"> CImg<float> img(<span class="stringliteral">"file_doesnt_exist.jpg"</span>); <span class="comment">// Try to load a file that doesn't exist.</span></pre></div></li></ul><p><ul><li><b>CImgDisplayException</b> : Thrown when an error occured when trying to display an image in a window. This exception is thrown when image display request cannot be satisfied.</li></ul><p>The parent class <a class="el" href="structcimg__library_1_1_c_img_exception.html">CImgException</a> may be thrown itself when errors that cannot be classified in one of the above type occur. It is recommended not to throw CImgExceptions yourself, since there are normally reserved to CImg Library functions. <b>CImgInstanceException</b>, <b>CImgArgumentException</b>, <b>CImgIOException</b> and <b>CImgDisplayException</b> are simple subclasses of <a class="el" href="structcimg__library_1_1_c_img_exception.html">CImgException</a> and are thus not detailled more in this reference documentation.<h2><a class="anchor" name="ex2">Exception handling</a></h2>When an error occurs, the CImg Library first displays the error in a modal window. Then, it throws an instance of the corresponding exception class, generally leading the program to stop (this is the default behavior). You can bypass this default behavior by handling the exceptions yourself, using a code block <code>try { ... } catch() { ... }</code>. In this case, you can avoid the apparition of the modal window, by defining the environment variable <code>cimg_debug</code> to 0 before including the CImg header file. The example below shows how to cleanly handle CImg Library exceptions : <div class="fragment"><pre class="fragment"><span class="preprocessor"> #define cimg_debug 0 // Disable modal window in CImg exceptions.</span><span class="preprocessor"></span><span class="preprocessor"> #define "CImg.h"</span><span class="preprocessor"></span> <span class="keywordtype">int</span> main() { <span class="keywordflow">try</span> { ...; <span class="comment">// Here, do what you want.</span> } <span class="keywordflow">catch</span> (CImgInstanceException &e) { std::fprintf(stderr,<span class="stringliteral">"CImg Library Error : %s"</span>,e.message); <span class="comment">// Display your own error message</span> ... <span class="comment">// Do what you want now.</span> } }</pre></div> <p><!DOCTYPE html PUBLIC "-//w3c//dtd html 4.0 transitional//en"><html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>The CImg Library - C++ Template Image Processing Library</title> <meta content="David Tschumperle" name="author"> <link rel="shortcut icon" type="image/x-icon" href="http://cimg.sourceforge.net/favicon.ico" /> <link rel="icon" type="image/png" href="favicon.png" /> <link href="doxygen.css" rel="stylesheet" type="text/css"> </head> <body bgcolor="#ffffff" fgcolor="#000000" alink="#ff0000" link="#0000ee" vlink="#551a8b"> <hr noshade="noshade" size="1" width="100%"> <a href="http://sourceforge.net"> <img src="http://sourceforge.net/sflogo.php?group_id=96492&type=3" border="0" height="37" width="125"></a><!-- Start of StatCounter Code --><script type="text/javascript" language="javascript"><!-- var sc_project=895001; var sc_invisible=1; var sc_partition=7; var sc_security="5ea85181"; //--></script><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><!-- End of StatCounter Code --> </body></html>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -