Rerun C++ SDK
Loading...
Searching...
No Matches
rgba32.hpp
1// DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/cpp/mod.rs
2// Based on "crates/store/re_types/definitions/rerun/datatypes/rgba32.fbs".
3
4#pragma once
5
6#include "../component_descriptor.hpp"
7#include "../result.hpp"
8
9#include <cstdint>
10#include <memory>
11
12namespace arrow {
13 /// \private
14 template <typename T>
15 class NumericBuilder;
16
17 class Array;
18 class DataType;
19 class UInt32Type;
20 using UInt32Builder = NumericBuilder<UInt32Type>;
21} // namespace arrow
22
23namespace rerun::datatypes {
24 /// **Datatype**: An RGBA color with unmultiplied/separate alpha, in sRGB gamma space with linear alpha.
25 ///
26 /// The color is stored as a 32-bit integer, where the most significant
27 /// byte is `R` and the least significant byte is `A`.
28 struct Rgba32 {
29 uint32_t rgba;
30
31 public: // START of extensions from rgba32_ext.cpp:
32 /// Construct Rgba32 from unmultiplied RGBA values.
33 Rgba32(uint8_t r, uint8_t g, uint8_t b, uint8_t a = 255)
34 : Rgba32(static_cast<uint32_t>((r << 24) | (g << 16) | (b << 8) | a)) {}
35
36 /// Construct Rgba32 from unmultiplied RGBA values.
37 Rgba32(const uint8_t (&_rgba)[4]) : Rgba32(_rgba[0], _rgba[1], _rgba[2], _rgba[3]) {}
38
39 /// Construct Rgba32 from RGB values, setting alpha to 255.
40 Rgba32(const uint8_t (&_rgb)[3]) : Rgba32(_rgb[0], _rgb[1], _rgb[2]) {}
41
42 uint8_t r() const {
43 return static_cast<uint8_t>((rgba >> 24) & 0xFF);
44 }
45
46 uint8_t g() const {
47 return static_cast<uint8_t>((rgba >> 16) & 0xFF);
48 }
49
50 uint8_t b() const {
51 return static_cast<uint8_t>((rgba >> 8) & 0xFF);
52 }
53
54 uint8_t a() const {
55 return static_cast<uint8_t>(rgba & 0xFF);
56 }
57
58 // END of extensions from rgba32_ext.cpp, start of generated code:
59
60 public:
61 Rgba32() = default;
62
63 Rgba32(uint32_t rgba_) : rgba(rgba_) {}
64
65 Rgba32& operator=(uint32_t rgba_) {
66 rgba = rgba_;
67 return *this;
68 }
69 };
70} // namespace rerun::datatypes
71
72namespace rerun {
73 template <typename T>
74 struct Loggable;
75
76 /// \private
77 template <>
78 struct Loggable<datatypes::Rgba32> {
79 static constexpr ComponentDescriptor Descriptor = "rerun.datatypes.Rgba32";
80
81 /// Returns the arrow data type this type corresponds to.
82 static const std::shared_ptr<arrow::DataType>& arrow_datatype();
83
84 /// Serializes an array of `rerun::datatypes::Rgba32` into an arrow array.
85 static Result<std::shared_ptr<arrow::Array>> to_arrow(
86 const datatypes::Rgba32* instances, size_t num_instances
87 );
88
89 /// Fills an arrow array builder with an array of this type.
90 static rerun::Error fill_arrow_array_builder(
91 arrow::UInt32Builder* builder, const datatypes::Rgba32* elements, size_t num_elements
92 );
93 };
94} // namespace rerun
Status outcome object (success or error) returned for fallible operations.
Definition error.hpp:95
All built-in datatypes. See Types in the Rerun manual.
Definition rerun.hpp:83
All Rerun C++ types and functions are in the rerun namespace or one of its nested namespaces.
Definition rerun.hpp:23
Datatype: An RGBA color with unmultiplied/separate alpha, in sRGB gamma space with linear alpha.
Definition rgba32.hpp:28
Rgba32(const uint8_t(&_rgb)[3])
Construct Rgba32 from RGB values, setting alpha to 255.
Definition rgba32.hpp:40
Rgba32(uint8_t r, uint8_t g, uint8_t b, uint8_t a=255)
Construct Rgba32 from unmultiplied RGBA values.
Definition rgba32.hpp:33
Rgba32(const uint8_t(&_rgba)[4])
Construct Rgba32 from unmultiplied RGBA values.
Definition rgba32.hpp:37