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 12, 2024
1 parent af7b2d5 commit 38155cf
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 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,22 @@ 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);
* std::uint32_t rgba = (a << 24 | (r << 16 | (g << 8) | b;
* \endcode
*
* To unpack it use:
*
* \code
* int rgb = ...;
* // unpack rgb into r/g/b
* std::uint32_t rgb = p.rgba;
* 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 38155cf

Please sign in to comment.