STL.html 84 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909
  1. <?xml version="1.0" encoding="utf-8" ?>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  4. <head>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  6. <title>Magick++ API: STL Templates</title>
  7. <link rel="stylesheet" href="magick.css" type="text/css" />
  8. </head>
  9. <body>
  10. <div class="doc-section">
  11. <h1> Magick++ STL Support</h1>
  12. Magick++ provides a set of <a href="http://www.sgi.com/tech/stl/">Standard
  13. Template Libary</a> (<a href="http://www.sgi.com/tech/stl/">STL</a> )
  14. algorithms for operating across ranges of image frames in a container.
  15. It also provides a set of STL unary function objects to apply an
  16. operation on image frames in a container via an algorithm which uses
  17. unary function objects. A good example of a standard algorithm which is
  18. useful for processing containers of image frames is the STL <i><a
  19. href="http://www.sgi.com/tech/stl/for_each.html"> for_each</a> </i>
  20. algorithm which invokes a unary function object on a range of container
  21. elements.
  22. <p>Magick++ uses a limited set of template argument types. The current
  23. template argument types are: </p>
  24. <a href="http://www.sgi.com/tech/stl/Container.html">Container</a>
  25. <blockquote>A container having the properties of a <a
  26. href="http://www.sgi.com/tech/stl/BackInsertionSequence.html"> Back
  27. Insertion Sequence</a> . Sequences support forward iterators and Back
  28. Insertion Sequences support the additional abilty to append an element
  29. via push_back(). Common compatable container types are the STL &lt;<a
  30. href="http://www.sgi.com/tech/stl/Vector.html"> vector</a> &gt; and &lt;<a
  31. href="http://www.sgi.com/tech/stl/List.html">list</a> &gt; template
  32. containers. This template argument is usually used to represent an
  33. output container in which one or more image frames may be appended.
  34. Containers like STL &lt;<a href="http://www.sgi.com/tech/stl/Vector.html">vector</a>
  35. &gt; which have a given default <i>capacity</i> may need to have their <i>
  36. capacity</i> adjusted via r<i>eserve() </i>to a larger <i>capacity</i>
  37. in order to support the expected final <i>size</i> . Since Magick++
  38. images are very small, it is likely that the default capacity of STL &lt;<a
  39. href="http://www.sgi.com/tech/stl/Vector.html"> vector</a> &gt; is
  40. sufficient for most situations.</blockquote>
  41. <a href="http://www.sgi.com/tech/stl/InputIterator.html">InputIterator</a>
  42. <blockquote>An input iterator used to express a position in a
  43. container. These template arguments are typically used to represent a
  44. range of elements with f<i>irst_</i> representing the first element to
  45. be processed and <i> last_</i> representing the element to stop at. When
  46. processing the entire contents of a container, it is handy to know that
  47. STL containers usually provide the begin() and end() methods to return
  48. input interators which correspond with the first and last elements,
  49. respectively.</blockquote>
  50. <p>The following is an example of how frames from a GIF animation <font
  51. color="#000000"> "test_image_anim.gif" may be appended horizontally
  52. with the resulting image written to the file <kbd>appended_image.miff</kbd>:</font></p>
  53. <pre class="code">
  54. #include &lt;list>
  55. #include &lt;Magick++.h>
  56. using namespace std;
  57. using namespace Magick;
  58. int main(int argc,char **argv)
  59. {
  60. InitializeMagick(*argv);
  61. list&lt;Image> imageList;
  62. readImages( &amp;imageList, "test_image_anim.gif" );
  63. Image appended;
  64. appendImages( &amp;appended, imageList.begin(), imageList.end() );
  65. appended.write( "appended_image.miff" );
  66. return 0;
  67. }
  68. </pre>
  69. <p>The available Magick++ specific STL algorithms for operating on
  70. sequences of image frames are shown in the following table: <br />
  71. &#160;
  72. <ul><table border="1" width="100%">
  73. <caption><b>Magick++ STL Algorithms For Image Sequences</b></caption> <tbody>
  74. <tr>
  75. <td>
  76. <center><b>Algorithm</b></center>
  77. </td>
  78. <td>
  79. <center><b>Signature</b></center>
  80. </td>
  81. <td>
  82. <center><b>Description</b></center>
  83. </td>
  84. </tr>
  85. <tr>
  86. <td>
  87. <center><a name="animateImages"></a> <font size="-1">animateImages</font></center>
  88. </td>
  89. <td><font size="-1"><a
  90. href="http://www.sgi.com/tech/stl/InputIterator.html"> InputIterator</a>
  91. first_, <a href="http://www.sgi.com/tech/stl/InputIterator.html">InputIterator</a>
  92. last_</font></td>
  93. <td><font size="-1">Animate a sequence of image frames. Image
  94. frames are displayed in succession, creating an animated effect. The
  95. animation options are taken from the first image frame. This feature is
  96. only supported under X11 at the moment.</font></td>
  97. </tr>
  98. <tr>
  99. <td>
  100. <center><a name="appendImages"></a> <font size="-1">appendImages</font></center>
  101. </td>
  102. <td><font size="-1"><a href="Image++.html">Image</a>
  103. *appendedImage_, <a
  104. href="http://www.sgi.com/tech/stl/InputIterator.html"> InputIterator</a>
  105. first_, <a href="http://www.sgi.com/tech/stl/InputIterator.html">InputIterator</a>
  106. last_, bool stack_ = false</font></td>
  107. <td><font size="-1">Append a sequence of image frames, writing
  108. the result to <i>appendedImage_.</i> All the input image frames must
  109. have the same width or height. Image frames of the same width are
  110. stacked top-to-bottom. Image frames of the same height are stacked
  111. left-to-right. If the <i>stack_</i> parameter is false, rectangular
  112. image frames are stacked left-to-right otherwise top-to-bottom.</font></td>
  113. </tr>
  114. <tr>
  115. <td>
  116. <center><a name="averageImages"></a> <font size="-1">averageImages</font></center>
  117. </td>
  118. <td><font size="-1"><a href="Image++.html">Image</a>
  119. *averagedImage_, <a
  120. href="http://www.sgi.com/tech/stl/InputIterator.html"> InputIterator</a>
  121. first_, <a href="http://www.sgi.com/tech/stl/InputIterator.html">InputIterator</a>
  122. last_</font></td>
  123. <td><font size="-1">Average a sequence of image frames, writing
  124. the result to <i>averagedImage_</i>. All the input image frames must
  125. be the same size in pixels.</font></td>
  126. </tr>
  127. <tr>
  128. <td>
  129. <center><a name="coalesceImages"></a> <font size="-1">coalesceImages</font></center>
  130. </td>
  131. <td><font size="-1"><a
  132. href="http://www.sgi.com/tech/stl/Container.html"> Container</a>
  133. *coalescedImages_, <a
  134. href="http://www.sgi.com/tech/stl/InputIterator.html"> InputIterator</a>
  135. first_, <a href="http://www.sgi.com/tech/stl/InputIterator.html">InputIterator</a>
  136. last_</font><br />
  137. </td>
  138. <td><font size="-1">Create a coalesced image sequence obtained by
  139. "playing" the image sequence (observing page offsets and disposal
  140. methods) to create a new image sequence in which all frames are full
  141. size and completely rendered. Note that if the original image sequence
  142. relied on page offsets and disposal methods that the resulting sequence
  143. will be larger (perhaps much larger) then the original. This is useful
  144. for GIF animation sequences that have page offsets and disposal methods.
  145. The resuting image sequence is returned via <i>coalescedImages_.</i></font></td>
  146. </tr>
  147. <tr>
  148. <td>
  149. <center><a name="deconstructImages"></a> <font size="-1">deconstructImages</font></center>
  150. </td>
  151. <td><font size="-1"><a
  152. href="http://www.sgi.com/tech/stl/Container.html"> Container</a>
  153. *deconstructedImages_, <a
  154. href="http://www.sgi.com/tech/stl/InputIterator.html"> InputIterator</a>
  155. first_, <a href="http://www.sgi.com/tech/stl/InputIterator.html">InputIterator</a>
  156. last_</font></td>
  157. <td><font size="-1">Break down an image sequence into constituent
  158. parts.&#160; This is useful for creating GIF or MNG animation sequences.
  159. The input sequence is specified by <i>first_</i> and <i>last_</i>, and
  160. the deconstructed images are returned via <i>deconstructedImages_</i>.</font></td>
  161. </tr>
  162. <tr>
  163. <td>
  164. <center><a name="displayImages"></a> <font size="-1">displayImages</font></center>
  165. </td>
  166. <td><font size="-1"><a
  167. href="http://www.sgi.com/tech/stl/InputIterator.html"> InputIterator</a>
  168. first_, <a href="http://www.sgi.com/tech/stl/InputIterator.html">InputIterator</a>
  169. last_</font></td>
  170. <td><font size="-1">Display a sequence of image frames. Through
  171. use of a pop-up menu, image frames may be selected in succession. This
  172. feature is fully supported under X11 but may have only limited support
  173. in other environments.</font> <br />
  174. <font size="-1"><b><font color="#ff0000">Caution: </font></b> if
  175. an image format is not compatable with the display visual (e.g. JPEG
  176. on a colormapped display) then the original image will be altered. Use a
  177. copy of the original if this is a problem.</font></td>
  178. </tr>
  179. <tr>
  180. <td>
  181. <center><a name="flattenImages"></a> <font size="-1">flattenImages</font></center>
  182. </td>
  183. <td><font size="-1"><a href="Image++.html">Image</a>
  184. *flattendImage_, <a
  185. href="http://www.sgi.com/tech/stl/InputIterator.html"> InputIterator</a>
  186. first_, <a href="http://www.sgi.com/tech/stl/InputIterator.html">InputIterator</a>
  187. last_</font></td>
  188. <td><font size="-1">Merge a sequence of image frames which
  189. represent image layers into a single composited representation. The <i>flattendImage_</i>
  190. parameter points to an existing Image to update with the flattened
  191. image. This function is useful for combining Photoshop layers into a
  192. single image.</font></td>
  193. </tr>
  194. <tr>
  195. <td>
  196. <center><a name="forwardFourierTransformImage"></a> <font size="-1">forwardFourierTransformImage</font></center>
  197. </td>
  198. <td><font size="-1"><a
  199. href="http://www.sgi.com/tech/stl/Container.html"> Container</a>
  200. *fourierImages_, const Image &amp;image_ </font></td>
  201. <td><font size="-1"> Implements the discrete Fourier transform (DFT) of the image as a magnitude / phase image pair via <i>fourierImages_</i>.</font></td>
  202. </tr>
  203. <tr>
  204. <td>
  205. <center><a name="forwardFourierTransformImage"></a> <font size="-1">forwardFourierTransformImage</font></center>
  206. </td>
  207. <td><font size="-1"><a
  208. href="http://www.sgi.com/tech/stl/Container.html"> Container</a>
  209. *fourierImages_, const Image &amp;image_, const bool magnitude_ </font></td>
  210. <td><font size="-1"> Implements the discrete Fourier transform (DFT) of the image either as a magnitude / phase or real / imaginary image pair via <i>fourierImages_</i>.</font></td>
  211. </tr>
  212. <tr>
  213. <td>
  214. <center><a name="mapImages"></a> <font size="-1">mapImages</font></center>
  215. </td>
  216. <td><font size="-1"><a
  217. href="http://www.sgi.com/tech/stl/InputIterator.html"> InputIterator</a>
  218. first_, <a href="http://www.sgi.com/tech/stl/InputIterator.html">InputIterator</a>
  219. last_, const <a href="Image++.html">Image</a> &amp; mapImage_, bool
  220. dither_,&#160; bool measureError_ = false</font></td>
  221. <td><font size="-1">Replace the colors of a sequence of images
  222. with the closest color from a reference image. Set <i>dither_</i> to <i>true</i>
  223. to enable dithering.&#160; Set <i>measureError_</i> to <i>true</i> in
  224. order to evaluate quantization error.</font></td>
  225. </tr>
  226. <tr>
  227. <td>
  228. <center><a name="montageImages"></a> <font size="-1">montageImages</font></center>
  229. </td>
  230. <td><font size="-1"><a
  231. href="http://www.sgi.com/tech/stl/Container.html"> Container</a>
  232. *montageImages_, <a
  233. href="http://www.sgi.com/tech/stl/InputIterator.html"> InputIterator</a>
  234. first_, <a href="http://www.sgi.com/tech/stl/InputIterator.html">InputIterator</a>
  235. last_, const <a href="Montage.html">Montage</a> &amp;montageOpts_</font></td>
  236. <td><font size="-1">Create a composite image by combining several
  237. separate image frames. Multiple frames may be generated in the output
  238. container <i> montageImages_ </i>depending on the tile setting and the
  239. number of image frames montaged. Montage options are provided via the
  240. parameter <i>montageOpts_</i> . Options set in the first image frame (<a
  241. href="Image++.html#backgroundColor"> backgroundColor,</a> <a
  242. href="Image++.html#borderColor">borderColor</a> , <a
  243. href="Image++.html#matteColor">matteColor</a> , <a
  244. href="Image++.html#penColor">penColor,</a> <a href="Image++.html#font">font,</a>
  245. and <a href="Image++.html#fontPointsize">fontPointsize</a> ) are also used
  246. as options by <i>montageImages().</i></font></td>
  247. </tr>
  248. <tr>
  249. <td>
  250. <center><a name="morphImages"></a> <font size="-1">morphImages</font></center>
  251. </td>
  252. <td><font size="-1"><a
  253. href="http://www.sgi.com/tech/stl/Container.html"> Container</a>
  254. *morphedImages_, <a
  255. href="http://www.sgi.com/tech/stl/InputIterator.html"> InputIterator</a>
  256. first_, <a href="http://www.sgi.com/tech/stl/InputIterator.html">InputIterator</a>
  257. last_, size_t frames_</font></td>
  258. <td><font size="-1">Morph a seqence of image frames. This
  259. algorithm&#160; expands the number of image frames (output to the
  260. container <i>morphedImages_)</i> by adding the number of intervening
  261. frames specified by <i>frames_</i> such that the original frames morph
  262. (blend) into each other when played as an animation.</font></td>
  263. </tr>
  264. <tr>
  265. <td>
  266. <center><a name="mosaicImages"></a> <font size="-1">mosaicImages</font></center>
  267. </td>
  268. <td><font size="-1"><a href="Image++.html">Image</a> *mosaicImage_, <a
  269. href="http://www.sgi.com/tech/stl/InputIterator.html"> InputIterator</a>
  270. first_, <a href="http://www.sgi.com/tech/stl/InputIterator.html">InputIterator</a>
  271. last_</font></td>
  272. <td><font size="-1">Inlay a number of images to form a single
  273. coherent picture. The <i>mosicImage_</i> argument is updated with a
  274. mosaic constructed from the image sequence represented by <i>first_</i>
  275. through <i>last_</i> .</font></td>
  276. </tr>
  277. <tr>
  278. <td><center><a name="quantizeImages"></a> <font size="-1">quantizeImages</font></center></td>
  279. <td><font size="-1"><a
  280. href="http://www.sgi.com/tech/stl/InputIterator.html"> InputIterator</a>
  281. first_, <a href="http://www.sgi.com/tech/stl/InputIterator.html">InputIterator</a>
  282. last_, bool measureError_ = false</font></td>
  283. <td><font size="-1">Quantize colors in images using current
  284. quantization settings. Set <i>measureError_</i> to <i>true</i> in order
  285. to measure quantization error.</font></td>
  286. </tr>
  287. <tr>
  288. <td rowspan="2">
  289. <center><a name="readImages"></a> <font size="-1">readImages</font></center>
  290. </td>
  291. <td><font size="-1"><a
  292. href="http://www.sgi.com/tech/stl/Container.html"> Container</a>
  293. *sequence_, const std::string &amp;imageSpec_</font></td>
  294. <td><font size="-1">Read a sequence of image frames into existing
  295. container (appending to container <i>sequence_</i>) with image names
  296. specified in the UTF-8 string <i>imageSpec_</i>.</font></td>
  297. </tr>
  298. <tr>
  299. <td><font size="-1"><a
  300. href="http://www.sgi.com/tech/stl/Container.html"> Container</a>
  301. *sequence_, const <a href="Blob.html">Blob</a> &amp;blob_</font></td>
  302. <td><font size="-1">Read a sequence of image frames into existing
  303. container (appending to container sequence_) from <a href="Blob.html">Blob</a>
  304. blob_.</font></td>
  305. </tr>
  306. <tr>
  307. <td rowspan="2">
  308. <center><a name="writeImages"></a> <font size="-1">writeImages</font></center>
  309. </td>
  310. <td><font size="-1"><a
  311. href="http://www.sgi.com/tech/stl/InputIterator.html"> InputIterator</a>
  312. first_, <a href="http://www.sgi.com/tech/stl/InputIterator.html">InputIterator</a>
  313. last_, const std::string &amp;imageSpec_, bool adjoin_ = true</font></td>
  314. <td><font size="-1">Write images in container to file specified
  315. by string <i>imageSpec_</i>. Set <i>adjoin_ </i>to false to write a
  316. set of image frames via a wildcard <i>imageSpec_ </i>(e.g.
  317. image%02d.miff).</font> <br />
  318. The wildcard must be one of <tt>%0Nd, %0No, or %0Nx</tt>. <br />
  319. <font size="-1"><b><font color="#ff0000">Caution: </font></b> if
  320. an image format is selected which is capable of supporting fewer colors
  321. than the original image or quantization has been requested, the original
  322. image will be quantized to fewer colors. Use a copy of the original if
  323. this is a problem.</font></td>
  324. </tr>
  325. <tr>
  326. <td><font size="-1"><a
  327. href="http://www.sgi.com/tech/stl/InputIterator.html"> InputIterator</a>
  328. first_, <a href="http://www.sgi.com/tech/stl/InputIterator.html">InputIterator</a>
  329. last_, <a href="Blob.html">Blob</a> *blob_, bool adjoin_ = true</font></td>
  330. <td><font size="-1">Write images in container to in-memory BLOB
  331. specified by <a href="Blob.html">Blob</a> blob_. Set adjoin_ to false to
  332. write a set of image frames via a wildcard imageSpec_ (e.g.
  333. image%02d.miff).</font> <br />
  334. <font size="-1"><b><font color="#ff0000">Caution:</font></b> if an
  335. image format is selected which is capable of supporting fewer colors
  336. than the original image or quantization has been requested, the original
  337. image will be quantized to fewer colors. Use a copy of the original if
  338. this is a problem.</font></td>
  339. </tr>
  340. </tbody>
  341. </table></ul>
  342. <p>In addition, we support these yet to be documented methods: <code>combineImages()</code>, <code>evaluateImages()</code>, <code>mergeImageLayers()</code>, <code>optimizeImageLayers()</code>, <code>optimizePlusImageLayers()</code>, and <code>separateImages()</code>.</p>
  343. <br />
  344. &#160; </p>
  345. <center>
  346. <h3> Magick++ Unary Function Objects</h3>
  347. </center>
  348. Magick++ unary function objects inherit from the STL unary_function
  349. template class . The STL unary_function template class is of the form
  350. <pre class="text"><tt><font color="#000099">unary_function&lt;Arg, Result&gt;</font></tt></pre>
  351. and expects that derived classes implement a method of the form:
  352. <pre class="text"><tt><font color="#000099">Result operator()( Arg argument_);</font></tt></pre>
  353. which is invoked by algorithms using the function object. In the case
  354. of unary function objects defined by Magick++, the invoked function
  355. looks like:
  356. <pre class="text"><tt><font color="#000099">void operator()( Image &amp;image_);</font></tt></pre>
  357. with a typical implementation looking similar to:
  358. <pre class="text"><tt><font color="#000099">void operator()( Image &amp;image_ )</font></tt> <br />
  359. <tt><font color="#000099">&#160; {</font></tt> <br />
  360. <tt><font color="#000099">&#160;&#160;&#160; image_.contrast(
  361. _sharpen );</font></tt> <br />
  362. <tt><font color="#000099">&#160; }</font></tt></pre>
  363. where <i>contrast</i> is an Image method and <i>_sharpen </i>is an
  364. argument stored within the function object by its contructor. Since
  365. constructors may be polymorphic, a given function object may have
  366. several constructors and selects the appropriate Image method based on
  367. the arguments supplied.
  368. <p>In essence, unary function objects (as provided by Magick++) simply
  369. provide the means to construct an object which caches arguments for
  370. later use by an algorithm designed for use with unary function objects.
  371. There is a unary function object corresponding each algorithm provided
  372. by the <a href="Image++.html"> Image</a> class and there is a contructor
  373. available compatable with each synonymous method in the Image class. </p>
  374. <p>The unary function objects that Magick++ provides to support
  375. manipulating images are shown in the following table: <br />
  376. &#160;
  377. <ul><table border="1">
  378. <caption><b>Magick++ Unary Function Objects For Image Manipulation</b></caption> <tbody>
  379. <tr align="center">
  380. <td><b>Function Object</b></td>
  381. <td><b>Constructor Signatures(s)</b></td>
  382. <td><b>Description</b></td>
  383. </tr>
  384. <tr>
  385. <td valign="middle">
  386. <div align="center"><a name="adaptiveThresholdImage"></a> <font
  387. size="-1">adaptiveThresholdImage</font><br />
  388. </div>
  389. </td>
  390. <td valign="middle"><font size="-1">size_t width, size_t
  391. height, unsigned offset = 0</font><br />
  392. </td>
  393. <td valign="top"><font size="-1">Apply adaptive thresholding to
  394. the image. Adaptive thresholding is useful if the ideal threshold level
  395. is not known in advance, or if the illumination gradient is not constant
  396. across the image. Adaptive thresholding works by evaulating the mean
  397. (average) of a pixel region (size specified by <i>width</i> and <i>height</i>)
  398. and using the mean as the thresholding value. In order to remove
  399. residual noise from the background, the threshold may be adjusted by
  400. subtracting a constant <i>offset</i> (default zero) from the mean to
  401. compute the threshold.</font><br />
  402. </td>
  403. </tr>
  404. <tr>
  405. <td>
  406. <center><a name="addNoiseImage"></a> <font size="-1">addNoiseImage</font></center>
  407. </td>
  408. <td><font size="-1"><a href="https://imagemagick.org/Magick++/Enumerations.html#NoiseType">NoiseType</a>
  409. noiseType_</font></td>
  410. <td><font size="-1">Add noise to image with specified noise type.</font></td>
  411. </tr>
  412. <tr>
  413. <td style="vertical-align: middle;"><small><a
  414. name="affineTransformImage"></a>affineTransformImage<br />
  415. </small></td>
  416. <td style="vertical-align: middle;"><small>const DrawableAffine
  417. &amp;affine_<br />
  418. </small></td>
  419. <td style="vertical-align: middle;"><small>Transform image by
  420. specified affine (or free transform) matrix.<br />
  421. </small></td>
  422. </tr>
  423. <tr>
  424. <td rowspan="4">
  425. <center><a name="annotateImage"></a> <font size="-1">annotateImage</font></center>
  426. </td>
  427. <td><font size="-1">const std::string &amp;text_, const <a
  428. href="Geometry.html"> Geometry</a> &amp;location_</font></td>
  429. <td><font size="-1">Annotate with text using specified text,
  430. bounding area, placement gravity, and rotation. If <i>boundingArea_</i>
  431. is invalid, then bounding area is entire image.</font></td>
  432. </tr>
  433. <tr>
  434. <td><font size="-1">std::string text_, const <a
  435. href="Geometry.html">Geometry</a> &amp;boundingArea_, <a
  436. href="https://imagemagick.org/Magick++/Enumerations.html#GravityType">GravityType</a> gravity_</font></td>
  437. <td><font size="-1">Annotate using specified text, bounding area,
  438. and placement gravity. If <i>boundingArea_</i> is invalid, then
  439. bounding area is entire image.</font></td>
  440. </tr>
  441. <tr>
  442. <td><font size="-1">const std::string &amp;text_, const <a
  443. href="Geometry.html"> Geometry</a> &amp;boundingArea_, <a
  444. href="https://imagemagick.org/Magick++/Enumerations.html#GravityType">GravityType</a> gravity_, double
  445. degrees_,&#160;</font></td>
  446. <td><font size="-1">Annotate with text using specified text,
  447. bounding area, placement gravity, and rotation. If <i>boundingArea_</i>
  448. is invalid, then bounding area is entire image.</font></td>
  449. </tr>
  450. <tr>
  451. <td><font size="-1">const std::string &amp;text_, <a
  452. href="https://imagemagick.org/Magick++/Enumerations.html#GravityType"> GravityType</a> gravity_</font></td>
  453. <td><font size="-1">Annotate with text (bounding area is entire
  454. image) and placement gravity.</font></td>
  455. </tr>
  456. <tr>
  457. <td>
  458. <center><a name="blurImage"></a> <font size="-1">blurImage</font></center>
  459. </td>
  460. <td><font size="-1">const double radius_ = 1, const double sigma_
  461. = 0.5</font></td>
  462. <td><font size="-1">Blur image. The radius_ parameter specifies
  463. the radius of the Gaussian, in pixels, not counting the center
  464. pixel.&#160; The sigma_ parameter specifies the standard deviation of
  465. the Laplacian, in pixels.</font></td>
  466. </tr>
  467. <tr>
  468. <td>
  469. <center><a name="borderImage"></a> <font size="-1">borderImage</font></center>
  470. </td>
  471. <td><font size="-1">const <a href="Geometry.html">Geometry</a>
  472. &amp;geometry_ = "6x6+0+0"</font></td>
  473. <td><font size="-1">Border image (add border to image).&#160; The
  474. color of the border is specified by the <i>borderColor</i> attribute.</font></td>
  475. </tr>
  476. <tr>
  477. <td>
  478. <center><a name="charcoalImage"></a> <font size="-1">charcoalImage</font></center>
  479. </td>
  480. <td><font size="-1">const double radius_ = 1, const double sigma_
  481. = 0.5</font></td>
  482. <td><font size="-1">Charcoal effect image (looks like charcoal
  483. sketch). The radius_ parameter specifies the radius of the Gaussian, in
  484. pixels, not counting the center pixel.&#160; The sigma_ parameter
  485. specifies the standard deviation of the Laplacian, in pixels.</font></td>
  486. </tr>
  487. <tr>
  488. <td>
  489. <center><a name="chopImage"></a> <font size="-1">chopImage</font></center>
  490. </td>
  491. <td><font size="-1">const <a href="Geometry.html">Geometry</a>
  492. &amp;geometry_</font></td>
  493. <td><font size="-1">Chop image (remove vertical or horizontal
  494. subregion of image)</font></td>
  495. </tr>
  496. <tr>
  497. <td rowspan="2">
  498. <center><a name="colorizeImage"></a> <font size="-1">colorizeImage</font></center>
  499. </td>
  500. <td><font size="-1">const size_t opacityRed_, const
  501. size_t opacityGreen_, const size_t opacityBlue_, const Color
  502. &amp;penColor_</font></td>
  503. <td><font size="-1">Colorize image with pen color, using
  504. specified percent opacity for red, green, and blue quantums.</font></td>
  505. </tr>
  506. <tr>
  507. <td><font size="-1">const size_t opacity_, const <a
  508. href="Color.html"> Color</a> &amp;penColor_</font></td>
  509. <td><font size="-1">Colorize image with pen color, using
  510. specified percent opacity.</font></td>
  511. </tr>
  512. <tr>
  513. <td>
  514. <center><a name="commentImage"></a> <font size="-1">commentImage</font></center>
  515. </td>
  516. <td><font size="-1">const std::string &amp;comment_</font></td>
  517. <td><font size="-1">Comment image (add comment string to
  518. image).&#160; By default, each image is commented with its file name.
  519. Use&#160; this&#160; method to&#160; assign a specific comment to the
  520. image.&#160; Optionally you can include the image filename, type, width,
  521. height, or other&#160; image&#160; attributes by embedding <a
  522. href="https://imagemagick.org/Magick++/FormatCharacters.html">special format characters.</a> </font></td>
  523. </tr>
  524. <tr>
  525. <td rowspan="2">
  526. <center><a name="compositeImage"></a> <font size="-1">compositeImage</font></center>
  527. </td>
  528. <td><font size="-1">const <a href="Image++.html">Image</a>
  529. &amp;compositeImage_, ssize_t xOffset_, ssize_t yOffset_, <a
  530. href="https://imagemagick.org/Magick++/Enumerations.html#CompositeOperator"> CompositeOperator</a>
  531. compose_ = <i>InCompositeOp</i></font></td>
  532. <td rowspan="2"><font size="-1">Compose an image onto another at
  533. specified offset and using specified algorithm</font></td>
  534. </tr>
  535. <tr>
  536. <td><font size="-1">const <a href="Image++.html">Image</a>
  537. &amp;compositeImage_, const Geometry &amp;offset_, <a
  538. href="https://imagemagick.org/Magick++/Enumerations.html#CompositeOperator"> CompositeOperator</a>
  539. compose_ = <i>InCompositeOp</i></font></td>
  540. </tr>
  541. <tr>
  542. <td>
  543. <center><a name="condenseImage"></a> <font size="-1">condenseImage</font></center>
  544. </td>
  545. <td><font size="-1">void</font></td>
  546. <td><font size="-1">Condense image (Re-run-length encode image in
  547. memory).</font></td>
  548. </tr>
  549. <tr>
  550. <td>
  551. <center><a name="contrastImage"></a> <font size="-1">contrastImage</font></center>
  552. </td>
  553. <td><font size="-1">size_t sharpen_</font></td>
  554. <td><font size="-1">Contrast image (enhance intensity differences
  555. in image)</font></td>
  556. </tr>
  557. <tr>
  558. <td>
  559. <center><a name="cropImage"></a> <font size="-1">cropImage</font></center>
  560. </td>
  561. <td><font size="-1">const <a href="Geometry.html">Geometry</a>
  562. &amp;geometry_</font></td>
  563. <td><font size="-1">Crop image (subregion of original image)</font></td>
  564. </tr>
  565. <tr>
  566. <td>
  567. <center><a name="cycleColormapImage"></a> <font size="-1">cycleColormap-</font> <br />
  568. <font size="-1">Image</font></center>
  569. </td>
  570. <td><font size="-1">int amount_</font></td>
  571. <td><font size="-1">Cycle image colormap</font></td>
  572. </tr>
  573. <tr>
  574. <td>
  575. <center><a name="despeckleImage"></a> <font size="-1">despeckleImage</font></center>
  576. </td>
  577. <td><font size="-1">void</font></td>
  578. <td><font size="-1">Despeckle image (reduce speckle noise)</font></td>
  579. </tr>
  580. <tr>
  581. <td rowspan="2">
  582. <center><a name="drawImage"></a> <font size="-1">drawImage</font></center>
  583. </td>
  584. <td><font size="-1">const <a href="Drawable.html">Drawable</a>
  585. &amp;drawable_</font></td>
  586. <td><font size="-1">Draw shape or text on image.</font></td>
  587. </tr>
  588. <tr>
  589. <td><font size="-1">const std::list&lt;<a href="Drawable.html">Drawable</a>
  590. &gt; &amp;drawable_</font></td>
  591. <td><font size="-1">Draw shapes or text on image using a set of
  592. Drawable objects contained in an STL list. Use of this method improves
  593. drawing performance and allows batching draw objects together in a list
  594. for repeated use.</font></td>
  595. </tr>
  596. <tr>
  597. <td>
  598. <center><a name="edgeImage"></a> <font size="-1">edgeImage</font></center>
  599. </td>
  600. <td><font size="-1">size_t radius_ = 0.0</font></td>
  601. <td><font size="-1">Edge image (hilight edges in image).&#160;
  602. The radius is the radius of the pixel neighborhood.. Specify a radius
  603. of zero for automatic radius selection.</font></td>
  604. </tr>
  605. <tr>
  606. <td>
  607. <center><a name="embossImage"></a> <font size="-1">embossImage</font></center>
  608. </td>
  609. <td><font size="-1">const double radius_ = 1, const double sigma_
  610. = 0.5</font></td>
  611. <td><font size="-1">Emboss image (hilight edges with 3D effect).
  612. The radius_ parameter specifies the radius of the Gaussian, in pixels,
  613. not counting the center pixel.&#160; The sigma_ parameter specifies the
  614. standard deviation of the Laplacian, in pixels.</font></td>
  615. </tr>
  616. <tr>
  617. <td>
  618. <center><a name="enhanceImage"></a> <font size="-1">enhanceImage</font></center>
  619. </td>
  620. <td><font size="-1">void</font></td>
  621. <td><font size="-1">Enhance image (minimize noise)</font></td>
  622. </tr>
  623. <tr>
  624. <td>
  625. <center><a name="equalizeImage"></a> <font size="-1">equalizeImage</font></center>
  626. </td>
  627. <td><font size="-1">void</font></td>
  628. <td><font size="-1">Equalize image (histogram equalization)</font></td>
  629. </tr>
  630. <tr>
  631. <td>
  632. <center><a name="flipImage"></a> <font size="-1">flipImage</font></center>
  633. </td>
  634. <td><font size="-1">void</font></td>
  635. <td><font size="-1">Flip image (reflect each scanline in the
  636. vertical direction)</font></td>
  637. </tr>
  638. <tr>
  639. <td rowspan="4">
  640. <center><a name="floodFillColorImage"></a> <font size="-1">floodFill-</font> <br />
  641. <font size="-1">ColorImage</font></center>
  642. </td>
  643. <td><font size="-1">ssize_t x_, ssize_t y_, const <a
  644. href="Color.html"> Color</a> &amp;fillColor_</font></td>
  645. <td rowspan="2"><font size="-1">Flood-fill color across pixels
  646. that match the color of the target pixel and are neighbors of the
  647. target pixel. Uses current fuzz setting when determining color match.</font></td>
  648. </tr>
  649. <tr>
  650. <td><font size="-1">const <a href="Geometry.html">Geometry</a>
  651. &amp;point_, const <a href="Color.html">Color</a> &amp;fillColor_</font></td>
  652. </tr>
  653. <tr>
  654. <td><font size="-1">ssize_t x_, ssize_t y_, const <a
  655. href="Color.html"> Color</a> &amp;fillColor_, const <a href="Color.html">Color</a>
  656. &amp;borderColor_</font></td>
  657. <td rowspan="2"><font size="-1">Flood-fill color across pixels
  658. starting at target-pixel and stopping at pixels matching specified
  659. border color. Uses current fuzz setting when determining color match.</font></td>
  660. </tr>
  661. <tr>
  662. <td><font size="-1">const <a href="Geometry.html">Geometry</a>
  663. &amp;point_, const <a href="Color.html">Color</a> &amp;fillColor_, const <a
  664. href="Color.html">Color</a> &amp;borderColor_</font></td>
  665. </tr>
  666. <tr>
  667. <td rowspan="4">
  668. <center><a name="floodFillTextureImage"></a> <font size="-1">floodFill-</font> <br />
  669. <font size="-1">TextureImage</font></center>
  670. </td>
  671. <td><font size="-1">ssize_t x_, ssize_t y_,&#160; const <a
  672. href="Image++.html"> Image</a> &amp;texture_</font></td>
  673. <td rowspan="2"><font size="-1">Flood-fill texture across pixels
  674. that match the color of the target pixel and are neighbors of the
  675. target pixel. Uses current fuzz setting when determining color match.</font></td>
  676. </tr>
  677. <tr>
  678. <td><font size="-1">const <a href="Geometry.html">Geometry</a>
  679. &amp;point_, const Image &amp;texture_</font></td>
  680. </tr>
  681. <tr>
  682. <td><font size="-1">ssize_t x_, ssize_t y_, const Image
  683. &amp;texture_, const <a href="Color.html">Color</a> &amp;borderColor_</font></td>
  684. <td rowspan="2"><font size="-1">Flood-fill texture across pixels
  685. starting at target-pixel and stopping at pixels matching specified
  686. border color. Uses current fuzz setting when determining color match.</font></td>
  687. </tr>
  688. <tr>
  689. <td><font size="-1">const <a href="Geometry.html">Geometry</a>
  690. &amp;point_, const Image &amp;texture_, const <a href="Color.html">Color</a>
  691. &amp;borderColor_</font></td>
  692. </tr>
  693. <tr>
  694. <td>
  695. <center><a name="flopImage"></a> <font size="-1">flopImage</font></center>
  696. </td>
  697. <td><font size="-1">void&#160;</font></td>
  698. <td><font size="-1">Flop image (reflect each scanline in the
  699. horizontal direction)</font></td>
  700. </tr>
  701. <tr>
  702. <td rowspan="2">
  703. <center><a name="frameImage"></a> <font size="-1">frameImage</font></center>
  704. </td>
  705. <td><font size="-1">const <a href="Geometry.html">Geometry</a>
  706. &amp;geometry_ = "25x25+6+6"</font></td>
  707. <td rowspan="2"><font size="-1">Add decorative frame around image</font></td>
  708. </tr>
  709. <tr>
  710. <td><font size="-1">size_t width_, size_t height_,
  711. ssize_t x_, ssize_t y_, ssize_t innerBevel_ = 0, ssize_t outerBevel_ = 0</font></td>
  712. </tr>
  713. <tr>
  714. <td rowspan="2">
  715. <center><a name="gammaImage"></a> <font size="-1">gammaImage</font></center>
  716. </td>
  717. <td><font size="-1">double gamma_</font></td>
  718. <td><font size="-1">Gamma correct image (uniform red, green, and
  719. blue correction).</font></td>
  720. </tr>
  721. <tr>
  722. <td><font size="-1">double gammaRed_, double gammaGreen_, double
  723. gammaBlue_</font></td>
  724. <td><font size="-1">Gamma correct red, green, and blue channels
  725. of image.</font></td>
  726. </tr>
  727. <tr>
  728. <td>
  729. <center><a name="gaussianBlur"></a> <font size="-1">gaussianBlurImage</font></center>
  730. </td>
  731. <td><font size="-1">double width_, double sigma_</font></td>
  732. <td><font size="-1">Gaussian blur image. The number of neighbor
  733. pixels to be included in the convolution mask is specified by
  734. 'width_'.&#160; For example, a width of one gives a (standard) 3x3
  735. convolution mask. The standard deviation of the gaussian bell curve is
  736. specified by 'sigma_'.</font></td>
  737. </tr>
  738. <tr>
  739. <td>
  740. <center><a name="implodeImage"></a> <font size="-1">implodeImage</font></center>
  741. </td>
  742. <td><font size="-1">double factor_</font></td>
  743. <td><font size="-1">Implode image (special effect)</font></td>
  744. </tr>
  745. <tr>
  746. <td>
  747. <center><a name="inverseFourierTransformImage"></a> <font size="-1">inverseFourierTransformImage</font></center>
  748. </td>
  749. <td><font size="-1">const <a href="Image++.html">Image</a>
  750. &amp;phaseImage_, const bool magnitude_</font></td>
  751. <td><font size="-1">implements the inverse discrete Fourier transform (DFT) of the image either as a magnitude / phase or real / imaginary image pair.</font></td>
  752. </tr>
  753. <tr>
  754. <td>
  755. <center><a name="labelImage"></a> <font size="-1">labelImage</font></center>
  756. </td>
  757. <td><font size="-1">const string &amp;label_</font></td>
  758. <td><font size="-1">Assign a label to an image. Use this option
  759. to&#160; assign&#160; a&#160; specific label to the image. Optionally
  760. you can include the image filename, type, width, height, or scene
  761. number in the label by embedding&#160; <a href="https://imagemagick.org/Magick++/FormatCharacters.html">special
  762. format characters.</a> If the first character of string is @, the image
  763. label is read from a file titled by the remaining characters in the
  764. string. When converting to Postscript, use this&#160; option to specify
  765. a header string to print above the image.</font></td>
  766. </tr>
  767. <tr>
  768. <td style="text-align: center; vertical-align: middle;"><small><a
  769. name="levelImage"></a>levelImage<br />
  770. </small></td>
  771. <td style="vertical-align: top;"><small>const double black_point,
  772. const double white_point, const double mid_point=1.0<br />
  773. </small></td>
  774. <td style="vertical-align: top;"><small>Level image. Adjust the
  775. levels of the image by scaling the colors falling between specified
  776. white and black points to the full available quantum range. The
  777. parameters provided represent the black, mid (gamma), and white
  778. points.&#160; The black point specifies the darkest color in the image.
  779. Colors darker than the black point are set to zero. Mid point (gamma)
  780. specifies a gamma correction to apply to the image. White point
  781. specifies the lightest color in the image.&#160; Colors brighter than
  782. the white point are set to the maximum quantum value. The black and
  783. white point have the valid range 0 to QuantumRange while mid (gamma) has a
  784. useful range of 0 to ten.</small></td>
  785. </tr>
  786. <tr>
  787. <td style="text-align: center; vertical-align: middle;"><small><a
  788. name="levelChannelImage"></a>levelChannelImage<br />
  789. </small></td>
  790. <td style="vertical-align: top;"><small>const Magick::ChannelType
  791. channel, const double black_point, const double white_point, const
  792. double mid_point=1.0<br />
  793. </small></td>
  794. <td style="vertical-align: top;"><small>Level image channel.
  795. Adjust the levels of the image channel by scaling the values falling
  796. between specified white and black points to the full available quantum
  797. range. The parameters provided represent the black, mid (gamma), and
  798. white points. The black point specifies the darkest color in the image.
  799. Colors darker than the black point are set to zero. Mid point (gamma)
  800. specifies a gamma correction to apply to the image. White point
  801. specifies the lightest color in the image. Colors brighter than the
  802. white point are set to the maximum quantum value. The black and white
  803. point have the valid range 0 to QuantumRange while mid (gamma) has a useful
  804. range of 0 to ten.</small></td>
  805. </tr>
  806. <tr>
  807. <td>
  808. <center><a name="layerImage"></a> <font size="-1">layerImage</font></center>
  809. </td>
  810. <td><font size="-1"><a href="https://imagemagick.org/Magick++/Enumerations.html#ChannelType">ChannelType</a>
  811. layer_</font></td>
  812. <td><font size="-1">Extract layer from image. Use this option to
  813. extract a particular layer from&#160; the image.&#160; <i>MatteLayer</i>,&#160;
  814. for&#160; example, is useful for extracting the opacity values from an
  815. image.</font></td>
  816. </tr>
  817. <tr>
  818. <td>
  819. <center><a name="magnifyImage"></a> <font size="-1">magnifyImage</font></center>
  820. </td>
  821. <td><font size="-1">void</font></td>
  822. <td><font size="-1">Magnify image by integral size</font></td>
  823. </tr>
  824. <tr>
  825. <td>
  826. <center><a name="mapImage"></a> <font size="-1">mapImage</font></center>
  827. </td>
  828. <td><font size="-1">const <a href="Image++.html">Image</a>
  829. &amp;mapImage_ , bool dither_ = false</font></td>
  830. <td><font size="-1">Remap image colors with closest color from
  831. reference image. Set dither_ to <i>true</i> in to apply Floyd/Steinberg
  832. error diffusion to the image. By default, color reduction chooses an
  833. optimal&#160; set&#160; of colors that best represent the original
  834. image. Alternatively, you can&#160; choose&#160; a&#160;
  835. particular&#160; set&#160; of colors&#160; from&#160; an image file
  836. with this option.</font></td>
  837. </tr>
  838. <tr>
  839. <td>
  840. <center><a name="matteFloodfillImage"></a> <font size="-1">matteFloodfill-</font> <br />
  841. <font size="-1">Image</font></center>
  842. </td>
  843. <td><font size="-1">const <a href="Color.html">Color</a>
  844. &amp;target_, unsigned int matte_, ssize_t x_, ssize_t y_, <a
  845. href="https://imagemagick.org/Magick++/Enumerations.html#PaintMethod"> PaintMethod</a> method_</font></td>
  846. <td><font size="-1">Floodfill designated area with a matte value</font></td>
  847. </tr>
  848. <tr>
  849. <td><a name="medianFilterImage"></a> <font size="-1">medianFilterImage</font></td>
  850. <td><font size="-1">const double radius_ = 0.0</font></td>
  851. <td><font size="-1">Filter image by replacing each pixel
  852. component with the median color in a circular neighborhood</font></td>
  853. </tr>
  854. <tr>
  855. <td>
  856. <center><a name="minifyImage"></a> <font size="-1">minifyImage</font></center>
  857. </td>
  858. <td><font size="-1">void</font></td>
  859. <td><font size="-1">Reduce image by integral size</font></td>
  860. </tr>
  861. <tr>
  862. <td>
  863. <center><a name="modulateImage"></a> <font size="-1">modulateImage</font></center>
  864. </td>
  865. <td><font size="-1">double brightness_, double saturation_,
  866. double hue_</font></td>
  867. <td><font size="-1">Modulate percent hue, saturation, and
  868. brightness of an image.&#160;</font><font size="-1">Modulation of
  869. saturation and brightness is as a ratio of the current value (1.0 for no
  870. change). Modulation of hue is an absolute rotation of -180 degrees to
  871. +180 degrees from the current position corresponding to an argument
  872. range of 0 to 2.0 (1.0 for no change).</font></td>
  873. </tr>
  874. <tr>
  875. <td>
  876. <center><a name="negateImage"></a> <font size="-1">negateImage</font></center>
  877. </td>
  878. <td><font size="-1">bool grayscale_ = false</font></td>
  879. <td><font size="-1">Negate colors in image.&#160; Replace every
  880. pixel with its complementary color (white becomes black, yellow becomes
  881. blue, etc.).&#160; Set grayscale to only negate grayscale values in
  882. image.</font></td>
  883. </tr>
  884. <tr>
  885. <td>
  886. <center><a name="normalizeImage"></a> <font size="-1">normalizeImage</font></center>
  887. </td>
  888. <td><font size="-1">void</font></td>
  889. <td><font size="-1">Normalize image (increase contrast by
  890. normalizing the pixel values to span the full range of color values).</font></td>
  891. </tr>
  892. <tr>
  893. <td>
  894. <center><a name="oilPaintImage"></a> <font size="-1">oilPaintImage</font></center>
  895. </td>
  896. <td><font size="-1">size_t radius_ = 3</font></td>
  897. <td><font size="-1">Oilpaint image (image looks like oil painting)</font></td>
  898. </tr>
  899. <tr>
  900. <td>
  901. <center><a name="opacityImage"></a> <font size="-1">opacityImage</font></center>
  902. </td>
  903. <td><font size="-1">size_t opacity_</font></td>
  904. <td><font size="-1">Set or attenuate the opacity channel in the
  905. image. If the image pixels are opaque then they are set to the specified
  906. opacity value, otherwise they are blended with the supplied opacity
  907. value.&#160; The value of opacity_ ranges from 0 (completely opaque) to <i>QuantumRange</i>.
  908. The defines <i>OpaqueOpacity</i> and <i>TransparentOpacity</i> are
  909. available to specify completely opaque or completely transparent,
  910. respectively.</font></td>
  911. </tr>
  912. <tr>
  913. <td>
  914. <center><a name="opaqueImage"></a> <font size="-1">opaqueImage</font></center>
  915. </td>
  916. <td><font size="-1">const <a href="Color.html">Color</a>
  917. &amp;opaqueColor_, const <a href="Color.html">Color</a> &amp;penColor_</font></td>
  918. <td><font size="-1">Change color of pixels matching opaqueColor_
  919. to specified penColor_.</font></td>
  920. </tr>
  921. <tr>
  922. <td>
  923. <center><a name="quantizeImage"></a> <font size="-1">quantizeImage</font></center>
  924. </td>
  925. <td><font size="-1">bool measureError_ = false</font></td>
  926. <td><font size="-1">Quantize image (reduce number of colors). Set
  927. measureError_ to true in order to calculate error attributes.</font></td>
  928. </tr>
  929. <tr>
  930. <td>
  931. <center><a name="raiseImage"></a> <font size="-1">raiseImage</font></center>
  932. </td>
  933. <td><font size="-1">const <a href="Geometry.html">Geometry</a>
  934. &amp;geometry_ = "6x6+0+0",&#160; bool raisedFlag_ =&#160; false</font></td>
  935. <td><font size="-1">Raise image (lighten or darken the edges of
  936. an image to give a 3-D raised or lowered effect)</font></td>
  937. </tr>
  938. <tr>
  939. <td rowspan="2">
  940. <center><a name="reduceNoiseImage"></a> <font size="-1">reduceNoise-</font> <br />
  941. <font size="-1">Image</font></center>
  942. </td>
  943. <td><font size="-1">void</font></td>
  944. <td rowspan="2"><font size="-1">Reduce noise in image using a
  945. noise peak elimination filter.</font></td>
  946. </tr>
  947. <tr>
  948. <td><font size="-1">size_t order_</font></td>
  949. </tr>
  950. <tr>
  951. <td>
  952. <center><a name="rollImage"></a> <font size="-1">rollImage</font></center>
  953. </td>
  954. <td><font size="-1">int columns_, ssize_t rows_</font></td>
  955. <td><font size="-1">Roll image (rolls image vertically and
  956. horizontally) by specified number of columnms and rows)</font></td>
  957. </tr>
  958. <tr>
  959. <td>
  960. <center><a name="rotateImage"></a> <font size="-1">rotateImage</font></center>
  961. </td>
  962. <td><font size="-1">double degrees_</font></td>
  963. <td><font size="-1">Rotate image counter-clockwise by specified
  964. number of degrees</font></td>
  965. </tr>
  966. <tr>
  967. <td>
  968. <center><a name="sampleImage"></a> <font size="-1">sampleImage</font></center>
  969. </td>
  970. <td><font size="-1">const <a href="Geometry.html">Geometry</a>
  971. &amp;geometry_&#160;</font></td>
  972. <td><font size="-1">Resize image by using pixel sampling algorithm</font></td>
  973. </tr>
  974. <tr>
  975. <td>
  976. <center><a name="scaleImage"></a> <font size="-1">scaleImage</font></center>
  977. </td>
  978. <td><font size="-1">const <a href="Geometry.html">Geometry</a>
  979. &amp;geometry_</font></td>
  980. <td><font size="-1">Resize image by using simple ratio algorithm</font></td>
  981. </tr>
  982. <tr>
  983. <td>
  984. <center><a name="segmentImage"></a> <font size="-1">segmentImage</font></center>
  985. </td>
  986. <td><font size="-1">double clusterThreshold_ = 1.0,</font> <br />
  987. <font size="-1">double smoothingThreshold_ = 1.5</font></td>
  988. <td><font size="-1">Segment (coalesce similar image components)
  989. by analyzing the histograms of the color components and identifying
  990. units that are homogeneous with the fuzzy c-means technique. Also uses <i>quantizeColorSpace</i>
  991. and <i>verbose</i> image attributes. Specify <i>clusterThreshold_</i> ,
  992. as the number&#160; of&#160; pixels&#160; each cluster&#160; must exceed
  993. the cluster threshold to be considered valid. <i>SmoothingThreshold_</i>
  994. eliminates noise in the&#160; second derivative of the histogram. As the
  995. value is&#160; increased, you can&#160; expect&#160; a&#160; smoother
  996. second derivative.&#160; The default is 1.5.</font></td>
  997. </tr>
  998. <tr>
  999. <td>
  1000. <center><a name="shadeImage"></a> <font size="-1">shadeImage</font></center>
  1001. </td>
  1002. <td><font size="-1">double azimuth_ = 30, double elevation_ = 30,</font> <br />
  1003. <font size="-1">bool colorShading_ = false</font></td>
  1004. <td><font size="-1">Shade image using distant light source.
  1005. Specify <i> azimuth_</i> and <i>elevation_</i> as the&#160;
  1006. position&#160; of&#160; the light source. By default, the shading
  1007. results as a grayscale image.. Set c<i>olorShading_</i> to <i>true</i> to
  1008. shade the red, green, and blue components of the image.</font></td>
  1009. </tr>
  1010. <tr>
  1011. <td>
  1012. <center><a name="sharpenImage"></a> <font size="-1">sharpenImage</font></center>
  1013. </td>
  1014. <td><font size="-1">const double radius_ = 1, const double sigma_
  1015. = 0.5</font></td>
  1016. <td><font size="-1">Sharpen pixels in image. The radius_
  1017. parameter specifies the radius of the Gaussian, in pixels, not counting
  1018. the center pixel.&#160; The sigma_ parameter specifies the standard
  1019. deviation of the Laplacian, in pixels.</font></td>
  1020. </tr>
  1021. <tr>
  1022. <td>
  1023. <center><a name="shaveImage"></a> <font size="-1">shaveImage</font></center>
  1024. </td>
  1025. <td><font size="-1">const <a href="Geometry.html">Geometry</a>
  1026. &amp;geometry_</font></td>
  1027. <td><font size="-1">Shave pixels from image edges.</font></td>
  1028. </tr>
  1029. <tr>
  1030. <td>
  1031. <center><a name="shearImage"></a> <font size="-1">shearImage</font></center>
  1032. </td>
  1033. <td><font size="-1">double xShearAngle_, double yShearAngle_</font></td>
  1034. <td><font size="-1">Shear image (create parallelogram by sliding
  1035. image by X or Y axis).&#160; Shearing slides one edge of an image along
  1036. the X&#160; or&#160; Y axis,&#160; creating&#160; a
  1037. parallelogram.&#160; An X direction shear slides an edge along the X
  1038. axis, while&#160; a&#160; Y&#160; direction shear&#160; slides&#160; an
  1039. edge along the Y axis.&#160; The amount of the shear is controlled by a
  1040. shear angle.&#160; For X direction&#160; shears,&#160; x&#160; degrees
  1041. is measured relative to the Y axis, and similarly, for Y direction
  1042. shears&#160; y&#160; degrees is measured relative to the X axis. Empty
  1043. triangles left over from shearing the&#160; image&#160; are filled&#160;
  1044. with&#160; the&#160; color&#160; defined as <i>borderColor</i>.&#160;</font></td>
  1045. </tr>
  1046. <tr>
  1047. <td>
  1048. <center><a name="solarizeImage"></a> <font size="-1">solarizeImage</font></center>
  1049. </td>
  1050. <td><font size="-1">double factor_</font></td>
  1051. <td><font size="-1">Solarize image (similar to effect seen when
  1052. exposing a photographic film to light during the development process)</font></td>
  1053. </tr>
  1054. <tr>
  1055. <td>
  1056. <center><a name="spreadImage"></a> <font size="-1">spreadImage</font></center>
  1057. </td>
  1058. <td><font size="-1">size_t amount_ = 3</font></td>
  1059. <td><font size="-1">Spread pixels randomly within image by
  1060. specified amount</font></td>
  1061. </tr>
  1062. <tr>
  1063. <td>
  1064. <center><a name="steganoImage"></a> <font size="-1">steganoImage</font></center>
  1065. </td>
  1066. <td><font size="-1">const <a href="Image++.html">Image</a>
  1067. &amp;watermark_</font></td>
  1068. <td><font size="-1">Add a digital watermark to the image (based
  1069. on second image)</font></td>
  1070. </tr>
  1071. <tr>
  1072. <td>
  1073. <center><a name="stereoImage"></a> <font size="-1">stereoImage</font></center>
  1074. </td>
  1075. <td><font size="-1">const <a href="Image++.html">Image</a>
  1076. &amp;rightImage_</font></td>
  1077. <td><font size="-1">Create an image which appears in stereo when
  1078. viewed with red-blue glasses (Red image on left, blue on right)</font></td>
  1079. </tr>
  1080. <tr>
  1081. <td>
  1082. <center><a name="swirlImage"></a> <font size="-1">swirlImage</font></center>
  1083. </td>
  1084. <td><font size="-1">double degrees_</font></td>
  1085. <td><font size="-1">Swirl image (image pixels are rotated by
  1086. degrees)</font></td>
  1087. </tr>
  1088. <tr>
  1089. <td>
  1090. <center><a name="textureImage"></a> <font size="-1">textureImage</font></center>
  1091. </td>
  1092. <td><font size="-1">const <a href="Image++.html">Image</a>
  1093. &amp;texture_</font></td>
  1094. <td><font size="-1">Layer a texture on image background</font></td>
  1095. </tr>
  1096. <tr>
  1097. <td>
  1098. <center><a name="thresholdImage"></a> <font size="-1">thresholdImage</font></center>
  1099. </td>
  1100. <td><font size="-1">double threshold_</font></td>
  1101. <td><font size="-1">Threshold image</font></td>
  1102. </tr>
  1103. <tr>
  1104. <td rowspan="2">
  1105. <center><a name="transformImage"></a> <font size="-1">transformImage</font></center>
  1106. </td>
  1107. <td><font size="-1">const <a href="Geometry.html">Geometry</a>
  1108. &amp;imageGeometry_</font></td>
  1109. <td rowspan="2"><font size="-1">Transform image based on image
  1110. and crop geometries. Crop geometry is optional.</font></td>
  1111. </tr>
  1112. <tr>
  1113. <td><font size="-1">const <a href="Geometry.html">Geometry</a>
  1114. &amp;imageGeometry_, const <a href="Geometry.html">Geometry</a>
  1115. &amp;cropGeometry_&#160;</font></td>
  1116. </tr>
  1117. <tr>
  1118. <td>
  1119. <center><a name="transparentImage"></a> <font size="-1">transparentImage</font></center>
  1120. </td>
  1121. <td><font size="-1">const <a href="Color.html">Color</a>
  1122. &amp;color_</font></td>
  1123. <td><font size="-1">Add matte image to image, setting pixels
  1124. matching color to transparent.</font></td>
  1125. </tr>
  1126. <tr>
  1127. <td>
  1128. <center><a name="trimImage"></a> <font size="-1">trimImage</font></center>
  1129. </td>
  1130. <td><font size="-1">void</font></td>
  1131. <td><font size="-1">Trim edges that are the background color from
  1132. the image.</font></td>
  1133. </tr>
  1134. <tr>
  1135. <td>
  1136. <center><a name="waveImage"></a> <font size="-1">waveImage</font></center>
  1137. </td>
  1138. <td><font size="-1">double amplitude_ = 25.0, double wavelength_
  1139. = 150.0</font></td>
  1140. <td><font size="-1">Alter an image along a sine wave.</font></td>
  1141. </tr>
  1142. <tr>
  1143. <td>
  1144. <center><a name="zoomImage"></a> <font size="-1">zoomImage</font></center>
  1145. </td>
  1146. <td><font size="-1">const <a href="Geometry.html">Geometry</a>
  1147. &amp;geometry_</font></td>
  1148. <td><font size="-1">Zoom image to specified size.</font></td>
  1149. </tr>
  1150. </tbody>
  1151. </table></ul>
  1152. </p>
  1153. <p>Function objects are available to set attributes on image frames
  1154. which are equivalent to methods in the Image object. These function
  1155. objects allow setting an option across a range of image frames using f<tt>
  1156. or_each()</tt>. </p>
  1157. <p>The following code is an example of how the color 'red' may be set
  1158. to transparent in a GIF animation: </p>
  1159. <pre class="code">
  1160. list&lt;image> images;
  1161. readImages( &amp;images, "animation.gif" );
  1162. for_each ( images.begin(), images.end(), transparentImage( "red" ) );
  1163. writeImages( images.begin(), images.end(), "animation.gif" );
  1164. </pre>
  1165. <p>The available function objects for setting image attributes are <br />
  1166. &#160;
  1167. <ul><table border="1">
  1168. <caption style="font-weight: bold;">Image Attributes</caption> <tbody>
  1169. <tr>
  1170. <td>
  1171. <center><b>Attribute</b></center>
  1172. </td>
  1173. <td>
  1174. <center><b>Type</b></center>
  1175. </td>
  1176. <td>
  1177. <center><b>Constructor Signature(s)</b></center>
  1178. </td>
  1179. <td>
  1180. <center><b>Description</b></center>
  1181. </td>
  1182. </tr>
  1183. <tr>
  1184. <td>
  1185. <center><a name="adjoinImage"></a> <font size="-1">adjoinImage</font></center>
  1186. </td>
  1187. <td><font size="-1">bool</font></td>
  1188. <td><font size="-1">bool flag_</font></td>
  1189. <td><font size="-1">Join images into a single multi-image file.</font></td>
  1190. </tr>
  1191. <tr>
  1192. <td>
  1193. <center><a name="antiAlias"></a> <font size="-1">antiAliasImage</font></center>
  1194. </td>
  1195. <td><font size="-1">bool</font></td>
  1196. <td><font size="-1">bool flag_</font></td>
  1197. <td><font size="-1">Control antialiasing of rendered Postscript
  1198. and Postscript or TrueType fonts. Enabled by default.</font></td>
  1199. </tr>
  1200. <tr>
  1201. <td>
  1202. <center><a name="animationDelay"></a> <font size="-1">animation-</font> <br />
  1203. <font size="-1">DelayImage</font></center>
  1204. </td>
  1205. <td><font size="-1">size_t (0 to 65535)</font></td>
  1206. <td><font size="-1">size_t delay_</font></td>
  1207. <td><font size="-1">Time in 1/100ths of a second (0 to 65535)
  1208. which must expire before displaying the next image in an animated
  1209. sequence. This option is useful for regulating the animation of a
  1210. sequence&#160; of GIF images within Netscape.</font></td>
  1211. </tr>
  1212. <tr>
  1213. <td>
  1214. <center><a name="animationIterations"></a> <font size="-1">animation-</font> <br />
  1215. <font size="-1">IterationsImage</font></center>
  1216. </td>
  1217. <td><font size="-1">size_t</font></td>
  1218. <td><font size="-1">size_t iterations_</font></td>
  1219. <td><font size="-1">Number of iterations to loop an animation
  1220. (e.g. Netscape loop extension) for.</font></td>
  1221. </tr>
  1222. <tr>
  1223. <td>
  1224. <center><a name="backgroundColor"></a> <font size="-1">background-</font> <br />
  1225. <font size="-1">ColorImage</font></center>
  1226. </td>
  1227. <td><font size="-1"><a href="Color.html">Color</a> </font></td>
  1228. <td><font size="-1">const <a href="Color.html">Color</a>
  1229. &amp;color_</font></td>
  1230. <td><font size="-1">Image background color</font></td>
  1231. </tr>
  1232. <tr>
  1233. <td>
  1234. <center><a name="backgroundTexture"></a> <font size="-1">background-</font> <br />
  1235. <font size="-1">TextureImage</font></center>
  1236. </td>
  1237. <td><font size="-1">std::string</font></td>
  1238. <td><font size="-1">const string &amp;texture_</font></td>
  1239. <td><font size="-1">Image to use as background texture.</font></td>
  1240. </tr>
  1241. <tr>
  1242. <td>
  1243. <center><a name="borderColor"></a> <font size="-1">borderColor-</font> <br />
  1244. <font size="-1">Image</font></center>
  1245. </td>
  1246. <td><font size="-1"><a href="Color.html">Color</a> </font></td>
  1247. <td><font size="-1">&#160;const <a href="Color.html">Color</a>
  1248. &amp;color_</font></td>
  1249. <td><font size="-1">Image border color</font></td>
  1250. </tr>
  1251. <tr>
  1252. <td>
  1253. <center><a name="boxColor"></a> <font size="-1">boxColorImage</font></center>
  1254. </td>
  1255. <td><font size="-1"><a href="Color.html">Color</a> </font></td>
  1256. <td><font size="-1">const <a href="Color.html">Color</a>
  1257. &amp;boxColor_</font></td>
  1258. <td><font size="-1">Base color that annotation text is rendered
  1259. on.</font></td>
  1260. </tr>
  1261. <tr>
  1262. <td>
  1263. <center><a name="chromaBluePrimary"></a> <font size="-1">chroma-</font> <br />
  1264. <font size="-1">BluePrimaryImage</font></center>
  1265. </td>
  1266. <td><font size="-1">double x &amp; y</font></td>
  1267. <td><font size="-1">double x_, double y_</font></td>
  1268. <td><font size="-1">Chromaticity blue primary point (e.g. x=0.15,
  1269. y=0.06)</font></td>
  1270. </tr>
  1271. <tr>
  1272. <td>
  1273. <center><a name="chromaGreenPrimary"></a> <font size="-1">chroma-</font> <br />
  1274. <font size="-1">GreenPrimaryImage</font></center>
  1275. </td>
  1276. <td><font size="-1">double x &amp; y</font></td>
  1277. <td><font size="-1">double x_, double y_</font></td>
  1278. <td><font size="-1">Chromaticity green primary point (e.g. x=0.3,
  1279. y=0.6)</font></td>
  1280. </tr>
  1281. <tr>
  1282. <td>
  1283. <center><a name="chromaRedPrimary"></a> <font size="-1">chroma-</font> <br />
  1284. <font size="-1">RedPrimaryImage</font></center>
  1285. </td>
  1286. <td><font size="-1">double x &amp; y</font></td>
  1287. <td><font size="-1">double x_, double y_</font></td>
  1288. <td><font size="-1">Chromaticity red primary point (e.g. x=0.64,
  1289. y=0.33)</font></td>
  1290. </tr>
  1291. <tr>
  1292. <td>
  1293. <center><a name="chromaWhitePoint"></a> <font size="-1">chroma-</font> <br />
  1294. <font size="-1">WhitePointImage</font></center>
  1295. </td>
  1296. <td><font size="-1">double x &amp; y</font></td>
  1297. <td><font size="-1">double x_, double y_</font></td>
  1298. <td><font size="-1">Chromaticity white point (e.g. x=0.3127,
  1299. y=0.329)</font></td>
  1300. </tr>
  1301. <tr>
  1302. <td>
  1303. <center><a name="colorFuzz"></a> <font size="-1">colorFuzzImage</font></center>
  1304. </td>
  1305. <td><font size="-1">double</font></td>
  1306. <td><font size="-1">double fuzz_</font></td>
  1307. <td><font size="-1">Colors within this distance are considered
  1308. equal. A number of algorithms search for a target&#160; color. By
  1309. default the color must be exact. Use this option to match colors that
  1310. are close to the target color in RGB space.</font></td>
  1311. </tr>
  1312. <tr>
  1313. <td>
  1314. <center><a name="colorMap"></a> <font size="-1">colorMapImage</font></center>
  1315. </td>
  1316. <td><font size="-1"><a href="Color.html">Color</a> </font></td>
  1317. <td><font size="-1">size_t index_, const <a
  1318. href="Color.html">Color</a> &amp;color_</font></td>
  1319. <td><font size="-1">Color at color-pallet index.</font></td>
  1320. </tr>
  1321. <tr>
  1322. <td><a name="colorSpaceImage"></a> <font size="-1">colorSpaceImage</font></td>
  1323. <td><font size="-1"><a href="https://imagemagick.org/Magick++/Enumerations.html#ColorspaceType">ColorspaceType</a> </font></td>
  1324. <td><font size="-1"><a href="https://imagemagick.org/Magick++/Enumerations.html#ColorspaceType">ColorspaceType</a>
  1325. colorSpace_</font></td>
  1326. <td><font size="-1">The colorspace (e.g. CMYK) used to represent
  1327. the image pixel colors. Image pixels are always stored as RGB(A) except
  1328. for the case of CMY(K).</font></td>
  1329. </tr>
  1330. <tr>
  1331. <td>
  1332. <center><a name="composeImage"></a> <font size="-1">composeImage</font></center>
  1333. </td>
  1334. <td><font size="-1"><a href="https://imagemagick.org/Magick++/Enumerations.html#CompositeOperator">CompositeOperator</a> </font></td>
  1335. <td><font size="-1"><a href="https://imagemagick.org/Magick++/Enumerations.html#CompositeOperator">CompositeOperator</a>
  1336. compose_</font></td>
  1337. <td><font size="-1">Composition operator to be used when
  1338. composition is implicitly used (such as for image flattening).</font></td>
  1339. </tr>
  1340. <tr>
  1341. <td>
  1342. <center><a name="compressType"></a> <font size="-1">compressType-</font> <br />
  1343. <font size="-1">Image</font></center>
  1344. </td>
  1345. <td><font size="-1"><a href="https://imagemagick.org/Magick++/Enumerations.html#CompressionType">CompressionType</a> </font></td>
  1346. <td><font size="-1"><a href="https://imagemagick.org/Magick++/Enumerations.html#CompressionType">CompressionType</a>
  1347. compressType_</font></td>
  1348. <td><font size="-1">Image compresion type. The default is the
  1349. compression type of the specified image file.</font></td>
  1350. </tr>
  1351. <tr>
  1352. <td>
  1353. <center><a name="density"></a> <font size="-1">densityImage</font></center>
  1354. </td>
  1355. <td><font size="-1"><a href="Geometry.html">Geometry</a> &#160;
  1356. (default 72x72)</font></td>
  1357. <td><font size="-1">const <a href="Geometry.html">Geometry</a>
  1358. &amp;density_</font></td>
  1359. <td><font size="-1">Vertical and horizontal resolution in pixels
  1360. of the image. This option specifies an image density when decoding a
  1361. Postscript or Portable Document page. Often used with <i>psPageSize</i>.</font></td>
  1362. </tr>
  1363. <tr>
  1364. <td>
  1365. <center><a name="depth"></a> <font size="-1">depthImage</font></center>
  1366. </td>
  1367. <td><font size="-1">size_t (8 or 16)</font></td>
  1368. <td><font size="-1">size_t depth_</font></td>
  1369. <td><font size="-1">Image depth. Used to specify the bit depth
  1370. when reading or writing&#160; raw images or thwn the output format
  1371. supports multiple depths. Defaults to the quantum depth that
  1372. ImageMagick is compiled with.</font></td>
  1373. </tr>
  1374. <tr>
  1375. <td>
  1376. <center><a name="endianImage"></a> <font size="-1">endianImage</font></center>
  1377. </td>
  1378. <td><font size="-1"><a href="https://imagemagick.org/Magick++/Enumerations.html#EndianType">EndianType</a> </font></td>
  1379. <td><font size="-1"><a href="https://imagemagick.org/Magick++/Enumerations.html#EndianType">EndianType</a>
  1380. endian_</font></td>
  1381. <td><font size="-1">Specify (or obtain) endian option for formats
  1382. which support it.</font></td>
  1383. </tr>
  1384. <tr>
  1385. <td>
  1386. <center><a name="fileName"></a> <font size="-1">fileNameImage</font></center>
  1387. </td>
  1388. <td><font size="-1">std::string</font></td>
  1389. <td><font size="-1">const std::string &amp;fileName_</font></td>
  1390. <td><font size="-1">Image file name.</font></td>
  1391. </tr>
  1392. <tr>
  1393. <td>
  1394. <center><a name="fillColorImage"></a> <font size="-1">fillColorImage</font></center>
  1395. </td>
  1396. <td><font size="-1">Color</font></td>
  1397. <td><font size="-1">const Color &amp;fillColor_</font></td>
  1398. <td><font size="-1">Color to use when filling drawn objects</font></td>
  1399. </tr>
  1400. <tr>
  1401. <td>
  1402. <center><a name="filterType"></a> <font size="-1">filterTypeImage</font></center>
  1403. </td>
  1404. <td><font size="-1"><a href="https://imagemagick.org/Magick++/Enumerations.html#FilterTypes">FilterTypes</a> </font></td>
  1405. <td><font size="-1"><a href="https://imagemagick.org/Magick++/Enumerations.html#FilterTypes">FilterTypes</a>
  1406. filterType_</font></td>
  1407. <td><font size="-1">Filter to use when resizing image. The
  1408. reduction filter employed has a sigificant effect on the time required
  1409. to resize an image and the resulting quality. The default filter is <i>Lanczos</i>
  1410. which has been shown to produce good results when reducing images.</font></td>
  1411. </tr>
  1412. <tr>
  1413. <td>
  1414. <center><a name="font"></a> <font size="-1">fontImage</font></center>
  1415. </td>
  1416. <td><font size="-1">std::string</font></td>
  1417. <td><font size="-1">const std::string &amp;font_</font></td>
  1418. <td><font size="-1">Text rendering font. If the font is a fully
  1419. qualified X server font name, the font is obtained from an X&#160;
  1420. server. To use a TrueType font, precede the TrueType filename with an @.
  1421. Otherwise, specify&#160; a&#160; Postscript font name (e.g.
  1422. "helvetica").</font></td>
  1423. </tr>
  1424. <tr>
  1425. <td>
  1426. <center><a name="fontPointsize"></a> <font size="-1">fontPointsize-</font> <br />
  1427. <font size="-1">Image</font></center>
  1428. </td>
  1429. <td><font size="-1">size_t</font></td>
  1430. <td><font size="-1">size_t pointSize_</font></td>
  1431. <td><font size="-1">Text rendering font point size</font></td>
  1432. </tr>
  1433. <tr>
  1434. <td>
  1435. <center><a name="gifDisposeMethod"></a> <font size="-1">gifDispose-</font> <br />
  1436. <font size="-1">MethodImage</font></center>
  1437. </td>
  1438. <td><font size="-1">size_t</font> <br />
  1439. <font size="-1">{ 0 = Disposal not specified,</font> <br />
  1440. <font size="-1">1 = Do not dispose of graphic,</font> <br />
  1441. <font size="-1">3 = Overwrite graphic with background color,</font> <br />
  1442. <font size="-1">4 = Overwrite graphic with previous graphic. }</font></td>
  1443. <td><font size="-1">size_t disposeMethod_</font></td>
  1444. <td><font size="-1">layer disposal method. This option is used to
  1445. control how successive frames are rendered (how the preceding frame is
  1446. disposed of) when creating a GIF animation.</font></td>
  1447. </tr>
  1448. <tr>
  1449. <td>
  1450. <center><a name="interlaceType"></a> <font size="-1">interlace-</font> <br />
  1451. <font size="-1">TypeImage</font></center>
  1452. </td>
  1453. <td><font size="-1"><a href="https://imagemagick.org/Magick++/Enumerations.html#InterlaceType">InterlaceType</a> </font></td>
  1454. <td><font size="-1"><a href="https://imagemagick.org/Magick++/Enumerations.html#InterlaceType">InterlaceType</a>
  1455. interlace_</font></td>
  1456. <td><font size="-1">The type of interlacing scheme (default <i>NoInterlace</i>
  1457. ). This option is used to specify the type of&#160; interlacing
  1458. scheme&#160; for&#160; raw&#160; image formats such as RGB or YUV. <i>NoInterlace</i>
  1459. means do not&#160; interlace, <i>LineInterlace</i> uses scanline
  1460. interlacing, and <i>PlaneInterlace</i> uses plane interlacing. <i>
  1461. PartitionInterlace</i> is like <i>PlaneInterlace</i> except the&#160;
  1462. different planes&#160; are saved&#160; to individual files (e.g.&#160;
  1463. image.R, image.G, and image.B). Use <i>LineInterlace</i> or <i>PlaneInterlace</i>
  1464. to create an interlaced GIF or progressive JPEG image.</font></td>
  1465. </tr>
  1466. <tr>
  1467. <td>
  1468. <center><a name="isValidImage"></a> <font size="-1">isValidImage</font></center>
  1469. </td>
  1470. <td><font size="-1">bool</font></td>
  1471. <td><font size="-1">bool isValid_</font></td>
  1472. <td><font size="-1">Set image validity. Valid images become empty
  1473. (inValid) if argument is false.</font></td>
  1474. </tr>
  1475. <tr>
  1476. <td>
  1477. <center><a name="label"></a> <font size="-1">labelImage</font></center>
  1478. </td>
  1479. <td><font size="-1">std::string</font></td>
  1480. <td><font size="-1">const std::string &amp;label_</font></td>
  1481. <td><font size="-1">Image label</font></td>
  1482. </tr>
  1483. <tr>
  1484. <td>
  1485. <center><a name="lineWidth"></a> <font size="-1">lineWidthImage</font></center>
  1486. </td>
  1487. <td><font size="-1">double</font></td>
  1488. <td><font size="-1">double lineWidth_</font></td>
  1489. <td><font size="-1">Line width for drawing lines, circles,
  1490. ellipses, etc. See <a href="Drawable.html">Drawable</a> .</font></td>
  1491. </tr>
  1492. <tr>
  1493. <td>
  1494. <center><a name="magick"></a> <font size="-1">magickImage</font></center>
  1495. </td>
  1496. <td><font size="-1">std::string</font></td>
  1497. <td><font size="-1">&#160;const std::string &amp;magick_</font></td>
  1498. <td><font size="-1">Get image format (e.g. "GIF")</font></td>
  1499. </tr>
  1500. <tr>
  1501. <td>
  1502. <center><a name="matte"></a> <font size="-1">matteImage</font></center>
  1503. </td>
  1504. <td><font size="-1">bool</font></td>
  1505. <td><font size="-1">bool matteFlag_</font></td>
  1506. <td><font size="-1">True if the image has transparency. If set
  1507. True, store matte channel if&#160; the image has one otherwise create
  1508. an opaque one.</font></td>
  1509. </tr>
  1510. <tr>
  1511. <td>
  1512. <center><a name="matteColor"></a> <font size="-1">matteColorImage</font></center>
  1513. </td>
  1514. <td><font size="-1"><a href="Color.html">Color</a> </font></td>
  1515. <td><font size="-1">const <a href="Color.html">Color</a>
  1516. &amp;matteColor_</font></td>
  1517. <td><font size="-1">Image matte (frame) color</font></td>
  1518. </tr>
  1519. <tr>
  1520. <td>
  1521. <center><a name="monochrome"></a> <font size="-1">monochrome-</font> <br />
  1522. <font size="-1">Image</font></center>
  1523. </td>
  1524. <td><font size="-1">bool</font></td>
  1525. <td><font size="-1">bool flag_</font></td>
  1526. <td><font size="-1">Transform the image to black and white</font></td>
  1527. </tr>
  1528. <tr>
  1529. <td>
  1530. <center><a name="pageImage"></a> <font size="-1">pageImage</font></center>
  1531. </td>
  1532. <td><font size="-1"><a href="Geometry.html#PostscriptPageSize">Geometry</a> </font></td>
  1533. <td><font size="-1">const <a
  1534. href="Geometry.html#PostscriptPageSize">Geometry</a> &amp;pageSize_</font></td>
  1535. <td><font size="-1">Preferred size and location of an image
  1536. canvas.</font>
  1537. <p><font size="-1">Use this option to specify the dimensions and
  1538. position of the Postscript page in dots per inch or a TEXT page in
  1539. pixels. This option is typically used in concert with <i><a
  1540. href="STL.html#density">density</a> </i>.</font> </p>
  1541. <p><font size="-1">Page may also be used to position a GIF image
  1542. (such as for a scene in an animation)</font></p>
  1543. </td>
  1544. </tr>
  1545. <tr>
  1546. <td>
  1547. <center><a name="penColor"></a> <font size="-1">penColorImage</font></center>
  1548. </td>
  1549. <td><font size="-1"><a href="Color.html">Color</a> </font></td>
  1550. <td><font size="-1">const <a href="Color.html">Color</a>
  1551. &amp;penColor_</font></td>
  1552. <td><font size="-1">Pen color to use when annotating on or
  1553. drawing on image.</font></td>
  1554. </tr>
  1555. <tr>
  1556. <td>
  1557. <center><a name="penTexture"></a> <font size="-1">penTextureImage</font></center>
  1558. </td>
  1559. <td><font size="-1"><a href="Image++.html">Image</a> </font></td>
  1560. <td><font size="-1">const Image &amp; penTexture_</font></td>
  1561. <td><font size="-1">Texture image to paint with (similar to
  1562. penColor).</font></td>
  1563. </tr>
  1564. <tr>
  1565. <td>
  1566. <center><a name="pixelColor"></a> <font size="-1">pixelColorImage</font></center>
  1567. </td>
  1568. <td><font size="-1"><a href="Color.html">Color</a> </font></td>
  1569. <td><font size="-1">size_t x_, size_t y_, const <a
  1570. href="Color.html"> Color</a> &amp;color_</font></td>
  1571. <td><font size="-1">Get/set pixel color at location x &amp; y.</font></td>
  1572. </tr>
  1573. <tr>
  1574. <td>
  1575. <center><a name="psPageSize"></a> <font size="-1">psPageSizeImage</font></center>
  1576. </td>
  1577. <td><font size="-1"><a href="Geometry.html#PostscriptPageSize">Geometry</a> </font></td>
  1578. <td><font size="-1">const <a
  1579. href="Geometry.html#PostscriptPageSize">Geometry</a> &amp;pageSize_</font></td>
  1580. <td><font size="-1">Postscript page size. Use this&#160; option
  1581. to specify the dimensions&#160; of the Postscript page in dots per inch
  1582. or a TEXT page in pixels. This option is typically used in concert with <i>density</i>.</font></td>
  1583. </tr>
  1584. <tr>
  1585. <td>
  1586. <center><a name="quality"></a> <font size="-1">qualityImage</font></center>
  1587. </td>
  1588. <td><font size="-1">size_t (0 to 100)</font></td>
  1589. <td><font size="-1">size_t quality_</font></td>
  1590. <td><font size="-1">JPEG/MIFF/PNG compression level (default 75).</font></td>
  1591. </tr>
  1592. <tr>
  1593. <td>
  1594. <center><a name="quantizeColors"></a> <font size="-1">quantize-</font> <br />
  1595. <font size="-1">ColorsImage</font></center>
  1596. </td>
  1597. <td><font size="-1">size_t</font></td>
  1598. <td><font size="-1">size_t colors_</font></td>
  1599. <td><font size="-1">Preferred number of colors in the image. The
  1600. actual number of colors in the image may be less than your request, but
  1601. never more. Images with less unique colors than specified with this
  1602. option will have any duplicate or unused colors removed.</font></td>
  1603. </tr>
  1604. <tr>
  1605. <td>
  1606. <center><a name="quantizeColorSpace"></a> <font size="-1">quantize-</font> <br />
  1607. <font size="-1">ColorSpaceImage</font></center>
  1608. </td>
  1609. <td><font size="-1"><a href="https://imagemagick.org/Magick++/Enumerations.html#ColorspaceType">ColorspaceType</a> </font></td>
  1610. <td><font size="-1"><a href="https://imagemagick.org/Magick++/Enumerations.html#ColorspaceType">ColorspaceType</a>
  1611. colorSpace_</font></td>
  1612. <td><font size="-1">Colorspace to quantize colors in (default
  1613. RGB). Empirical evidence suggests that distances in color spaces such
  1614. as YUV or YIQ correspond to perceptual color differences more closely
  1615. than do distances in RGB space. These color spaces may give better
  1616. results when color reducing an image.</font></td>
  1617. </tr>
  1618. <tr>
  1619. <td>
  1620. <center><a name="quantizeDither"></a> <font size="-1">quantize-</font> <br />
  1621. <font size="-1">DitherImage</font></center>
  1622. </td>
  1623. <td><font size="-1">bool</font></td>
  1624. <td><font size="-1">bool flag_</font></td>
  1625. <td><font size="-1">Apply Floyd/Steinberg error diffusion to the
  1626. image. The basic strategy of dithering is to&#160; trade&#160; intensity
  1627. resolution&#160; for&#160; spatial&#160; resolution&#160; by&#160;
  1628. averaging the intensities&#160; of&#160; several&#160;
  1629. neighboring&#160; pixels. Images which&#160; suffer&#160; from&#160;
  1630. severe&#160; contouring&#160; when&#160; reducing colors can be improved
  1631. with this option. The quantizeColors or monochrome option must be set
  1632. for this option to take effect.</font></td>
  1633. </tr>
  1634. <tr>
  1635. <td>
  1636. <center><a name="quantizeTreeDepth"></a> <font size="-1">quantize-</font> <br />
  1637. <font size="-1">TreeDepthImage</font></center>
  1638. </td>
  1639. <td><font size="-1">size_t (0 to 8)</font></td>
  1640. <td><font size="-1">size_t treeDepth_</font></td>
  1641. <td><font size="-1">Depth of the quantization color
  1642. classification tree. Values of 0 or 1 allow selection of the optimal
  1643. tree depth for the color reduction algorithm. Values between 2 and 8 may
  1644. be used to manually adjust the tree depth.</font></td>
  1645. </tr>
  1646. <tr>
  1647. <td>
  1648. <center><a name="renderingIntent"></a> <font size="-1">rendering-</font> <br />
  1649. <font size="-1">IntentImage</font></center>
  1650. </td>
  1651. <td><font size="-1"><a href="https://imagemagick.org/Magick++/Enumerations.html#RenderingIntent">RenderingIntent</a> </font></td>
  1652. <td><font size="-1"><a href="https://imagemagick.org/Magick++/Enumerations.html#RenderingIntent">RenderingIntent</a>
  1653. render_</font></td>
  1654. <td><font size="-1">The type of rendering intent</font></td>
  1655. </tr>
  1656. <tr>
  1657. <td>
  1658. <center><a name="resolutionUnits"></a> <font size="-1">resolution-</font> <br />
  1659. <font size="-1">UnitsImage</font></center>
  1660. </td>
  1661. <td><font size="-1"><a href="https://imagemagick.org/Magick++/Enumerations.html#ResolutionType">ResolutionType</a> </font></td>
  1662. <td><font size="-1"><a href="https://imagemagick.org/Magick++/Enumerations.html#ResolutionType">ResolutionType</a>
  1663. units_</font></td>
  1664. <td><font size="-1">Units of image resolution</font></td>
  1665. </tr>
  1666. <tr>
  1667. <td>
  1668. <center><a name="scene"></a> <font size="-1">sceneImage</font></center>
  1669. </td>
  1670. <td><font size="-1">size_t</font></td>
  1671. <td><font size="-1">size_t scene_</font></td>
  1672. <td><font size="-1">Image scene number</font></td>
  1673. </tr>
  1674. <tr>
  1675. <td>
  1676. <center><a name="size"></a> <font size="-1">sizeImage</font></center>
  1677. </td>
  1678. <td><font size="-1"><a href="Geometry.html">Geometry</a> </font></td>
  1679. <td><font size="-1">const <a href="Geometry.html">Geometry</a>
  1680. &amp;geometry_</font></td>
  1681. <td><font size="-1">Width and height of a raw image (an image
  1682. which does not support width and height information).&#160; Size may
  1683. also be used to affect the image size read from a multi-resolution
  1684. format (e.g. Photo CD, JBIG, or JPEG.</font></td>
  1685. </tr>
  1686. <tr>
  1687. <td>
  1688. <center><a name="stripImage"></a> <font size="-1">stripImage</font></center>
  1689. </td>
  1690. <td><font size="-1">void</font></td>
  1691. <td><font size="-1">strips an image of all profiles and comments.</font></td>
  1692. </tr>
  1693. <tr>
  1694. <td>
  1695. <center><a name="strokeColorImage"></a> <font size="-1">strokeColorImage</font></center>
  1696. </td>
  1697. <td><font size="-1"><a href="Color.html">Color</a> </font></td>
  1698. <td><font size="-1">const <a href="Color.html">Color</a>
  1699. &amp;strokeColor_</font></td>
  1700. <td><font size="-1">Color to use when drawing object outlines</font></td>
  1701. </tr>
  1702. <tr>
  1703. <td>
  1704. <center><a name="subImage"></a> <font size="-1">subImageImage</font></center>
  1705. </td>
  1706. <td><font size="-1">size_t</font></td>
  1707. <td><font size="-1">size_t subImage_</font></td>
  1708. <td><font size="-1">Subimage of an image sequence</font></td>
  1709. </tr>
  1710. <tr>
  1711. <td>
  1712. <center><a name="subRange"></a> <font size="-1">subRangeImage</font></center>
  1713. </td>
  1714. <td><font size="-1">size_t</font></td>
  1715. <td><font size="-1">size_t subRange_</font></td>
  1716. <td><font size="-1">Number of images relative to the base image</font></td>
  1717. </tr>
  1718. <tr>
  1719. <td>
  1720. <center><a name="tileName"></a> <font size="-1">tileNameImage</font></center>
  1721. </td>
  1722. <td><font size="-1">std::string</font></td>
  1723. <td><font size="-1">const std::string &amp;tileName_</font></td>
  1724. <td><font size="-1">Tile name</font></td>
  1725. </tr>
  1726. <tr>
  1727. <td>
  1728. <center><a name="typeImage"></a> <font size="-1">typeImage</font></center>
  1729. </td>
  1730. <td><font size="-1"><a href="https://imagemagick.org/Magick++/Enumerations.html#ImageType">ImageType</a> </font></td>
  1731. <td><font size="-1"><a href="https://imagemagick.org/Magick++/Enumerations.html#ImageType">ImageType</a>
  1732. type_</font></td>
  1733. <td><font size="-1">Image storage type.</font></td>
  1734. </tr>
  1735. <tr>
  1736. <td>
  1737. <center><a name="verbose"></a> <font size="-1">verboseImage</font></center>
  1738. </td>
  1739. <td><font size="-1">bool</font></td>
  1740. <td><font size="-1">bool verboseFlag_</font></td>
  1741. <td><font size="-1">Print detailed information about the image</font></td>
  1742. </tr>
  1743. <tr>
  1744. <td>
  1745. <center><a name="view"></a> <font size="-1">viewImage</font></center>
  1746. </td>
  1747. <td><font size="-1">std::string</font></td>
  1748. <td><font size="-1">const std::string &amp;view_</font></td>
  1749. <td><font size="-1">FlashPix viewing parameters.</font></td>
  1750. </tr>
  1751. <tr>
  1752. <td>
  1753. <center><a name="x11Display"></a> <font size="-1">x11DisplayImage</font></center>
  1754. </td>
  1755. <td><font size="-1">std::string (e.g. "hostname:0.0")</font></td>
  1756. <td><font size="-1">const std::string &amp;display_</font></td>
  1757. <td><font size="-1">X11 display to display to, obtain fonts from,
  1758. or to capture image from</font></td>
  1759. </tr>
  1760. </tbody>
  1761. </table></ul>
  1762. <br />
  1763. &#160; </p>
  1764. <center>
  1765. <h3> Query Image Format Support</h3>
  1766. </center>
  1767. <p>Magick++ provides the&#160;<a name="coderInfoList"></a> <i>coderInfoList()</i>
  1768. function to support obtaining information about the image formats
  1769. supported by ImageMagick. Support for image formats in ImageMagick
  1770. is provided by modules known as "coders". A user-provided container is
  1771. updated based on a boolean truth-table match. The truth-table supports
  1772. matching based on whether ImageMagick can read the format, write the
  1773. format, or supports multiple frames for the format. A wildcard specifier
  1774. is supported for any "don't care" field. The data obtained via
  1775. coderInfoList() may be useful for preparing GUI dialog boxes or for
  1776. deciding which output format to write based on support within the
  1777. ImageMagick build.</p>
  1778. <p>The definition of coderInfoList is: </p>
  1779. <pre class="code">
  1780. class CoderInfo
  1781. {
  1782. public:
  1783. enum MatchType {
  1784. AnyMatch, // match any coder
  1785. TrueMatch, // match coder if true
  1786. FalseMatch // match coder if false
  1787. };
  1788. [ remaining CoderInfo methods ]
  1789. }
  1790. template &lt;class Container >
  1791. void coderInfoList( Container *container_,
  1792. CoderInfo::MatchType isReadable_ = CoderInfo::AnyMatch,
  1793. CoderInfo::MatchType isWritable_ = CoderInfo::AnyMatch,
  1794. CoderInfo::MatchType isMultiFrame_ = CoderInfo::AnyMatch
  1795. );
  1796. </pre>
  1797. <p>The following example shows how to retrieve a list of all of the
  1798. coders which support reading images and print the coder attributes (all
  1799. listed formats will be readable): </p>
  1800. <pre class="code">
  1801. list&lt;CoderInfo> coderList;
  1802. coderInfoList( &amp;coderList, // Reference to output list
  1803. CoderInfo::TrueMatch, // Match readable formats
  1804. CoderInfo::AnyMatch, // Don't care about writable formats
  1805. CoderInfo::AnyMatch); // Don't care about multi-frame support
  1806. list&lt;CoderInfo>::iterator entry = coderList.begin();
  1807. while( entry != coderList.end() )
  1808. {
  1809. cout &lt;&lt; entry->name() &lt;&lt; ": (" &lt;&lt; entry->description() &lt;&lt; ") : ";
  1810. cout &lt;&lt; "Readable = ";
  1811. if ( entry->isReadable() )
  1812. cout &lt;&lt; "true";
  1813. else
  1814. cout &lt;&lt; "false";
  1815. cout &lt;&lt; ", ";
  1816. cout &lt;&lt; "Writable = ";
  1817. if ( entry->isWritable() )
  1818. cout &lt;&lt; "true";
  1819. else
  1820. cout &lt;&lt; "false";
  1821. cout &lt;&lt; ", ";
  1822. cout &lt;&lt; "Multiframe = ";
  1823. if ( entry->isMultiframe() )
  1824. cout &lt;&lt; "true";
  1825. else
  1826. cout &lt;&lt; "false";
  1827. cout &lt;&lt; endl;
  1828. entry ++;
  1829. }
  1830. </pre>
  1831. <tt><font color="#000066">&#160;&#160; }</font></tt>&#160;<!-- p -->
  1832. <h3 style="text-align: center;">Obtaining A Color Histogram&#160; </h3>
  1833. <p>Magick++ provides the <a name="colorHistogram"></a><span
  1834. style="font-weight: bold;">colorHistogram</span> template function to
  1835. retrieve a color histogram from an image. A color histogram provides a
  1836. count of how many times each color occurs in the image. The histogram is
  1837. written into a user-provided container, which (for example) could be a <span
  1838. style="font-style: italic;">&lt;vector&gt;</span> or a <span
  1839. style="font-style: italic;">&lt;map&gt;</span>. &#160;When a
  1840. &lt;map&gt; is used, the <span style="font-style: italic;">Color</span>
  1841. is used as the key so that quick lookups of usage counts for colors may
  1842. be performed. Writing into a <span style="font-style: italic;">&lt;map&gt;</span>
  1843. may be slower than writing into a <span style="font-style: italic;">&lt;vector&gt;</span>
  1844. since the <span style="font-style: italic;">&lt;map&gt;</span> sorts the
  1845. entries (by color intensity) and checks for uniqueness. Each histogram
  1846. entry is contained in type&#160;<span style="font-style: italic;">std::pair&lt;Magick::Color,unsigned
  1847. long&gt;</span><span style="font-style: italic;"> </span>with the first
  1848. member of the pair being a <span style="font-style: italic;">Color,</span>
  1849. and the second member of the pair being an '<span
  1850. style="font-style: italic;">unsigned long</span>'. Use the <span
  1851. style="font-style: italic;">&lt;pair&gt;</span> "<span
  1852. style="font-style: italic;">first</span>" member to access the Color
  1853. and the "<span style="font-style: italic;">second</span>" member to
  1854. access&#160;the number of times the color occurs in the image.</p>
  1855. <p>The template function declaration is as follows:<br />
  1856. </p>
  1857. <pre class="code">
  1858. template &lt;class Container >
  1859. void colorHistogram( Container *histogram_, const Image image)
  1860. </pre>
  1861. <p>The following examples illustrate using both a &lt;map&gt; and a
  1862. &lt;vector&gt; to retrieve the color histogram, and print out a
  1863. formatted summary.<br />
  1864. <br />
  1865. Using &lt;map&gt;:<br />
  1866. &#160; &#160; <br />
  1867. <pre class="code">
  1868. Image image("image.miff");
  1869. map&lt;Color,unsigned long> histogram;
  1870. colorHistogram( &amp;histogram, image );
  1871. std::map&lt;Color,unsigned long>::const_iterator p=histogram.begin();
  1872. while (p != histogram.end())
  1873. {
  1874. cout &lt;&lt; setw(10) &lt;&lt; (int)p->second &lt;&lt; ": ("
  1875. &lt;&lt; setw(quantum_width) &lt;&lt; (int)p->first.redQuantum() &lt;&lt; ","
  1876. &lt;&lt; setw(quantum_width) &lt;&lt; (int)p->first.greenQuantum() &lt;&lt; ","
  1877. &lt;&lt; setw(quantum_width) &lt;&lt; (int)p->first.blueQuantum() &lt;&lt; ")"
  1878. &lt;&lt; endl;
  1879. p++;
  1880. }
  1881. </pre>
  1882. <br />
  1883. Using &lt;vector&gt;:<br />
  1884. &#160; &#160; <br />
  1885. <pre class="code">
  1886. Image image("image.miff");
  1887. std::vector&lt;std::pair&lt;Color,unsigned long> > histogram;
  1888. colorHistogram( &amp;histogram, image );
  1889. std::vector&lt;std::pair&lt;Color,unsigned long> >::const_iterator p=histogram.begin();
  1890. while (p != histogram.end())
  1891. {
  1892. cout &lt;&lt; setw(10) &lt;&lt; (int)p->second &lt;&lt; ": ("
  1893. &lt;&lt; setw(quantum_width) &lt;&lt; (int)p->first.redQuantum() &lt;&lt; ","
  1894. &lt;&lt; setw(quantum_width) &lt;&lt; (int)p->first.greenQuantum() &lt;&lt; ","
  1895. &lt;&lt; setw(quantum_width) &lt;&lt; (int)p->first.blueQuantum() &lt;&lt; ")"
  1896. &lt;&lt; endl;
  1897. p++;
  1898. }
  1899. </pre>
  1900. </p>
  1901. </div>
  1902. </body>
  1903. </html>