naming.rst 1.6 KB

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