naming.html 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <head>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  6. <title>Naming Conventions - Boost.GIL documentation</title>
  7. <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
  8. <link rel="stylesheet" href="_static/style.css" type="text/css" />
  9. <script type="text/javascript">
  10. var DOCUMENTATION_OPTIONS = {
  11. URL_ROOT: './',
  12. VERSION: '',
  13. COLLAPSE_MODINDEX: false,
  14. FILE_SUFFIX: '.html'
  15. };
  16. </script>
  17. <script type="text/javascript" src="_static/jquery.js"></script>
  18. <script type="text/javascript" src="_static/underscore.js"></script>
  19. <script type="text/javascript" src="_static/doctools.js"></script>
  20. <link rel="index" title="Index" href="genindex.html" />
  21. <link rel="search" title="Search" href="search.html" />
  22. <link rel="top" title="Boost.GIL documentation" href="index.html" />
  23. <link rel="next" title="Design Guide" href="design/index.html" />
  24. <link rel="prev" title="Tutorial: Image Gradient" href="tutorial/gradient.html" />
  25. </head>
  26. <body>
  27. <div class="header">
  28. <table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
  29. "header">
  30. <tr>
  31. <td valign="top" width="300">
  32. <h3><a href="index.html"><img
  33. alt="C++ Boost" src="_static/gil.png" border="0"></a></h3>
  34. </td>
  35. <td >
  36. <h1 align="center"><a href="index.html"></a></h1>
  37. </td>
  38. <td>
  39. <div id="searchbox" style="display: none">
  40. <form class="search" action="search.html" method="get">
  41. <input type="text" name="q" size="18" />
  42. <input type="submit" value="Search" />
  43. <input type="hidden" name="check_keywords" value="yes" />
  44. <input type="hidden" name="area" value="default" />
  45. </form>
  46. </div>
  47. <script type="text/javascript">$('#searchbox').show(0);</script>
  48. </td>
  49. </tr>
  50. </table>
  51. </div>
  52. <hr/>
  53. <div class="content">
  54. <div class="navbar" style="text-align:right;">
  55. <a class="prev" title="Tutorial: Image Gradient" href="tutorial/gradient.html"><img src="_static/prev.png" alt="prev"/></a>
  56. <a class="next" title="Design Guide" href="design/index.html"><img src="_static/next.png" alt="next"/></a>
  57. </div>
  58. <div class="section" id="naming-conventions">
  59. <h1>Naming Conventions</h1>
  60. <p>Description of established naming conventions used in source code of GIL,
  61. tests and examples.</p>
  62. <div class="section" id="concrete-types">
  63. <h2>Concrete Types</h2>
  64. <p>Concrete (non-generic) GIL types follow this naming convention:</p>
  65. <div class="highlight-c++"><div class="highlight"><pre><span class="n">ColorSpace</span> <span class="o">+</span> <span class="n">BitDepth</span> <span class="o">+</span> <span class="p">[</span><span class="n">f</span> <span class="o">|</span> <span class="n">s</span><span class="p">]</span><span class="o">+</span> <span class="p">[</span><span class="n">c</span><span class="p">]</span> <span class="o">+</span> <span class="p">[</span><span class="n">_planar</span><span class="p">]</span> <span class="o">+</span> <span class="p">[</span><span class="n">_step</span><span class="p">]</span> <span class="o">+</span> <span class="n">ClassType</span> <span class="o">+</span> <span class="n">_t</span>
  66. </pre></div>
  67. </div>
  68. <p>where:</p>
  69. <ul class="simple">
  70. <li><code class="docutils literal"><span class="pre">ColorSpace</span></code> indicates layout and ordering of components.
  71. For example, <code class="docutils literal"><span class="pre">rgb</span></code>, <code class="docutils literal"><span class="pre">bgr</span></code>, <code class="docutils literal"><span class="pre">cmyk</span></code>, <code class="docutils literal"><span class="pre">rgba</span></code>.</li>
  72. <li><code class="docutils literal"><span class="pre">BitDepth</span></code> indicates the bit depth of the color channel.
  73. For example, <code class="docutils literal"><span class="pre">8</span></code>,``16``,``32``.</li>
  74. <li>By default, type of channel is unsigned integral.
  75. The <code class="docutils literal"><span class="pre">s</span></code> tag indicates signed integral.
  76. The <code class="docutils literal"><span class="pre">f</span></code> tag indicates a floating point type, which is always signed.</li>
  77. <li>By default, objects operate on mutable pixels.
  78. The <code class="docutils literal"><span class="pre">c</span></code> tag indicates object operating over immutable pixels.</li>
  79. <li><code class="docutils literal"><span class="pre">_planar</span></code> indicates planar organization (as opposed to interleaved).</li>
  80. <li><code class="docutils literal"><span class="pre">_step</span></code> indicates special image views, locators and iterators which
  81. traverse the data in non-trivial way. For example, backwards or every other
  82. pixel.</li>
  83. <li><code class="docutils literal"><span class="pre">ClassType</span></code> is <code class="docutils literal"><span class="pre">_image</span></code> (image), <code class="docutils literal"><span class="pre">_view</span></code> (image view), <code class="docutils literal"><span class="pre">_loc</span></code> (pixel
  84. 2D locator) <code class="docutils literal"><span class="pre">_ptr</span></code> (pixel iterator), <code class="docutils literal"><span class="pre">_ref</span></code> (pixel reference),
  85. <code class="docutils literal"><span class="pre">_pixel</span></code> (pixel value).</li>
  86. <li><code class="docutils literal"><span class="pre">_t</span></code> suffix indicaes it is a name of a type.</li>
  87. </ul>
  88. <p>For example:</p>
  89. <div class="highlight-cpp"><div class="highlight"><pre><span class="n">bgr8_image_t</span> <span class="n">a</span><span class="p">;</span> <span class="c1">// 8-bit interleaved BGR image</span>
  90. <span class="n">cmyk16_pixel_t</span> <span class="n">b</span><span class="p">;</span> <span class="c1">// 16-bit CMYK pixel value;</span>
  91. <span class="n">cmyk16c_planar_ref_t</span> <span class="nf">c</span><span class="p">(</span><span class="n">b</span><span class="p">);</span> <span class="c1">// const reference to a 16-bit planar CMYK pixel.</span>
  92. <span class="n">rgb32f_planar_step_ptr_t</span> <span class="n">d</span><span class="p">;</span> <span class="c1">// step pointer to a 32-bit planar RGB pixel.</span>
  93. </pre></div>
  94. </div>
  95. </div>
  96. </div>
  97. <div class="navbar" style="text-align:right;">
  98. <a class="prev" title="Tutorial: Image Gradient" href="tutorial/gradient.html"><img src="_static/prev.png" alt="prev"/></a>
  99. <a class="next" title="Design Guide" href="design/index.html"><img src="_static/next.png" alt="next"/></a>
  100. </div>
  101. </div>
  102. <div class="footer" role="contentinfo">
  103. Last updated on 2019-12-10 00:12:10.
  104. Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.5.6.
  105. </div>
  106. </body>
  107. </html>