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