Skip to content

Commit

Permalink
Document the RGBA structure
Browse files Browse the repository at this point in the history
  • Loading branch information
Reini Urban committed Sep 9, 2024
1 parent af7b2d5 commit a97d0a9
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions common/include/pcl/impl/point_types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ namespace pcl
PCL_EXPORTS std::ostream& operator << (std::ostream& os, const RGB& p);
/** \brief A structure representing RGB color information.
*
* The RGBA information is available either as separate r, g, b, or as a
* The RGB information is available either as separate r, g, b or as a
* packed std::uint32_t rgba value. To pack it, use:
*
* \code
Expand All @@ -355,7 +355,7 @@ namespace pcl
* int rgb = ...;
* std::uint8_t r = (rgb >> 16) & 0x0000ff;
* std::uint8_t g = (rgb >> 8) & 0x0000ff;
* std::uint8_t b = (rgb) & 0x0000ff;
* std::uint8_t b = (rgb) & 0x0000ff;
* \endcode
*
*/
Expand Down Expand Up @@ -506,20 +506,21 @@ namespace pcl
PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointXYZRGBA& p);
/** \brief A point structure representing Euclidean xyz coordinates, and the RGBA color.
*
* The RGBA information is available either as separate r, g, b, or as a
* packed std::uint32_t rgba value. To pack it, use:
* The RGBA information is available either as separate r, g, b and a uint8_t values,
* or as a packed std::uint32_t rgba value. To pack it, use:
*
* \code
* int rgb = ((int)r) << 16 | ((int)g) << 8 | ((int)b);
* int rgba = ((int)a) << 24 | (int)r) << 16 | ((int)g) << 8 | ((int)b);
* \endcode
*
* To unpack it use:
*
* \code
* int rgb = ...;
* std::uint8_t a = (rgb >> 24) & 0x0000ff;
* std::uint8_t r = (rgb >> 16) & 0x0000ff;
* std::uint8_t g = (rgb >> 8) & 0x0000ff;
* std::uint8_t b = (rgb) & 0x0000ff;
* std::uint8_t b = (rgb) & 0x0000ff;
* \endcode
*
* \ingroup common
Expand Down

0 comments on commit a97d0a9

Please sign in to comment.