Skip to content

Commit 38155cf

Browse files
author
Reini Urban
committed
Document the RGBA structure
1 parent af7b2d5 commit 38155cf

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

common/include/pcl/impl/point_types.hpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ namespace pcl
342342
PCL_EXPORTS std::ostream& operator << (std::ostream& os, const RGB& p);
343343
/** \brief A structure representing RGB color information.
344344
*
345-
* The RGBA information is available either as separate r, g, b, or as a
345+
* The RGB information is available either as separate r, g, b or as a
346346
* packed std::uint32_t rgba value. To pack it, use:
347347
*
348348
* \code
@@ -355,7 +355,7 @@ namespace pcl
355355
* int rgb = ...;
356356
* std::uint8_t r = (rgb >> 16) & 0x0000ff;
357357
* std::uint8_t g = (rgb >> 8) & 0x0000ff;
358-
* std::uint8_t b = (rgb) & 0x0000ff;
358+
* std::uint8_t b = (rgb) & 0x0000ff;
359359
* \endcode
360360
*
361361
*/
@@ -506,20 +506,22 @@ namespace pcl
506506
PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointXYZRGBA& p);
507507
/** \brief A point structure representing Euclidean xyz coordinates, and the RGBA color.
508508
*
509-
* The RGBA information is available either as separate r, g, b, or as a
510-
* packed std::uint32_t rgba value. To pack it, use:
509+
* The RGBA information is available either as separate r, g, b and a uint8_t values,
510+
* or as a packed std::uint32_t rgba value. To pack it, use:
511511
*
512512
* \code
513-
* int rgb = ((int)r) << 16 | ((int)g) << 8 | ((int)b);
513+
* std::uint32_t rgba = (a << 24 | (r << 16 | (g << 8) | b;
514514
* \endcode
515515
*
516516
* To unpack it use:
517517
*
518518
* \code
519-
* int rgb = ...;
519+
* // unpack rgb into r/g/b
520+
* std::uint32_t rgb = p.rgba;
521+
* std::uint8_t a = (rgb >> 24) & 0x0000ff;
520522
* std::uint8_t r = (rgb >> 16) & 0x0000ff;
521523
* std::uint8_t g = (rgb >> 8) & 0x0000ff;
522-
* std::uint8_t b = (rgb) & 0x0000ff;
524+
* std::uint8_t b = (rgb) & 0x0000ff;
523525
* \endcode
524526
*
525527
* \ingroup common

0 commit comments

Comments
 (0)