From 38155cf8ff3505570dfca6d96a65cf831d9852ad Mon Sep 17 00:00:00 2001 From: Reini Urban Date: Mon, 9 Sep 2024 15:53:32 +0200 Subject: [PATCH] Document the RGBA structure --- common/include/pcl/impl/point_types.hpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/common/include/pcl/impl/point_types.hpp b/common/include/pcl/impl/point_types.hpp index 88ca63a4d1a..5be134bf0a6 100644 --- a/common/include/pcl/impl/point_types.hpp +++ b/common/include/pcl/impl/point_types.hpp @@ -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 @@ -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 * */ @@ -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