gil/doc/naming.rst
Mateusz Łoskot 6b181acce2
[doc] Split tutorial into separate documents for quickstart section [ci skip] (#325)
Split the table of contents into two section:
  - Quickstart materials
  - Detailed documentation
Move doc/before_after.dox to tutorial/histogram.rst (closes #286).
Tidy up tutorial reST paragraphs, mark-up and code samples.
2019-07-21 20:54:03 +02:00

49 lines
1.6 KiB
ReStructuredText

Naming Conventions
==================
Description of established naming conventions used in source code of GIL,
tests and examples.
Concrete Types
--------------
Concrete (non-generic) GIL types follow this naming convention::
ColorSpace + BitDepth + [f | s]+ [c] + [_planar] + [_step] + ClassType + _t
where:
- ``ColorSpace`` indicates layout and ordering of components.
For example, ``rgb``, ``bgr``, ``cmyk``, ``rgba``.
- ``BitDepth`` indicates the bit depth of the color channel.
For example, ``8``,``16``,``32``.
- By default, type of channel is unsigned integral.
The ``s`` tag indicates signed integral.
The ``f`` tag indicates a floating point type, which is always signed.
- By default, objects operate on mutable pixels.
The ``c`` tag indicates object operating over immutable pixels.
- ``_planar`` indicates planar organization (as opposed to interleaved).
- ``_step`` indicates special image views, locators and iterators which
traverse the data in non-trivial way. For example, backwards or every other
pixel.
- ``ClassType`` is ``_image`` (image), ``_view`` (image view), ``_loc`` (pixel
2D locator) ``_ptr`` (pixel iterator), ``_ref`` (pixel reference),
``_pixel`` (pixel value).
- ``_t`` suffix indicaes it is a name of a type.
For example:
.. code-block:: cpp
bgr8_image_t a; // 8-bit interleaved BGR image
cmyk16_pixel_t b; // 16-bit CMYK pixel value;
cmyk16c_planar_ref_t c(b); // const reference to a 16-bit planar CMYK pixel.
rgb32f_planar_step_ptr_t d; // step pointer to a 32-bit planar RGB pixel.