Rerun C++ SDK
Loading...
Searching...
No Matches
image.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_sdk_types/definitions/rerun/archetypes/image.fbs".
3
4#pragma once
5
6#include "../collection.hpp"
7#include "../component_batch.hpp"
8#include "../component_column.hpp"
9#include "../components/draw_order.hpp"
10#include "../components/image_buffer.hpp"
11#include "../components/image_format.hpp"
12#include "../components/magnification_filter.hpp"
13#include "../components/opacity.hpp"
14#include "../image_utils.hpp"
15#include "../result.hpp"
16
17#include <cstdint>
18#include <optional>
19#include <utility>
20#include <vector>
21
22namespace rerun::archetypes {
23 /// **Archetype**: A monochrome or color image.
24 ///
25 /// See also `archetypes::DepthImage` and `archetypes::SegmentationImage`.
26 ///
27 /// Rerun also supports compressed images (JPEG, PNG, …), using `archetypes::EncodedImage`.
28 /// For images that refer to video frames see `archetypes::VideoFrameReference`.
29 /// Compressing images or using video data instead can save a lot of bandwidth and memory.
30 ///
31 /// The raw image data is stored as a single buffer of bytes in a `components::Blob`.
32 /// The meaning of these bytes is determined by the `components::ImageFormat` which specifies the resolution
33 /// and the pixel format (e.g. RGB, RGBA, …).
34 ///
35 /// The order of dimensions in the underlying `components::Blob` follows the typical
36 /// row-major, interleaved-pixel image format.
37 ///
38 /// Since the underlying [rerun::components::Blob] uses `rerun::Collection` internally,
39 /// data can be passed in without a copy from raw pointers or by reference from `std::vector`/`std::array`/c-arrays.
40 /// If needed, this "borrow-behavior" can be extended by defining your own `rerun::CollectionAdapter`.
41 ///
42 /// ## Examples
43 ///
44 /// ### image_simple:
45 /// ![image](https://static.rerun.io/image_simple/06ba7f8582acc1ffb42a7fd0006fad7816f3e4e4/full.png)
46 ///
47 /// ```cpp
48 /// #include <rerun.hpp>
49 ///
50 /// #include <vector>
51 ///
52 /// int main(int argc, char* argv[]) {
53 /// const auto rec = rerun::RecordingStream("rerun_example_image");
54 /// rec.spawn().exit_on_failure();
55 ///
56 /// // Create a synthetic image.
57 /// const int HEIGHT = 200;
58 /// const int WIDTH = 300;
59 /// std::vector<uint8_t> data(WIDTH * HEIGHT * 3, 0);
60 /// for (size_t i = 0; i <data.size(); i += 3) {
61 /// data[i] = 255;
62 /// }
63 /// for (size_t y = 50; y <150; ++y) {
64 /// for (size_t x = 50; x <150; ++x) {
65 /// data[(y * WIDTH + x) * 3 + 0] = 0;
66 /// data[(y * WIDTH + x) * 3 + 1] = 255;
67 /// data[(y * WIDTH + x) * 3 + 2] = 0;
68 /// }
69 /// }
70 ///
71 /// rec.log("image", rerun::Image::from_rgb24(data, {WIDTH, HEIGHT}));
72 /// }
73 /// ```
74 ///
75 /// ### Logging images with various formats
76 /// ![image](https://static.rerun.io/image_formats/182a233fb4d0680eb31912a82f328ddaaa66324e/full.png)
77 ///
78 /// ```cpp
79 /// #include <algorithm>
80 /// #include <cstdint>
81 /// #include <vector>
82 ///
83 /// #include <rerun.hpp>
84 ///
85 /// int main(int argc, char* argv[]) {
86 /// const auto rec = rerun::RecordingStream("rerun_example_image_formats");
87 /// rec.spawn().exit_on_failure();
88 ///
89 /// // Simple gradient image
90 /// std::vector<uint8_t> image(256 * 256 * 3);
91 /// for (size_t y = 0; y <256; ++y) {
92 /// for (size_t x = 0; x <256; ++x) {
93 /// image[(y * 256 + x) * 3 + 0] = static_cast<uint8_t>(x);
94 /// image[(y * 256 + x) * 3 + 1] =
95 /// static_cast<uint8_t>(std::min<size_t>(255, x + y));
96 /// image[(y * 256 + x) * 3 + 2] = static_cast<uint8_t>(y);
97 /// }
98 /// }
99 ///
100 /// // RGB image
101 /// rec.log("image_rgb", rerun::Image::from_rgb24(image, {256, 256}));
102 ///
103 /// // Green channel only (Luminance)
104 /// std::vector<uint8_t> green_channel(256 * 256);
105 /// for (size_t i = 0; i <256 * 256; ++i) {
106 /// green_channel[i] = image[i * 3 + 1];
107 /// }
108 /// rec.log(
109 /// "image_green_only",
110 /// rerun::Image(
111 /// rerun::borrow(green_channel),
112 /// {256, 256},
113 /// rerun::ColorModel::L
114 /// )
115 /// );
116 ///
117 /// // BGR image
118 /// std::vector<uint8_t> bgr_image(256 * 256 * 3);
119 /// for (size_t i = 0; i <256 * 256; ++i) {
120 /// bgr_image[i * 3 + 0] = image[i * 3 + 2];
121 /// bgr_image[i * 3 + 1] = image[i * 3 + 1];
122 /// bgr_image[i * 3 + 2] = image[i * 3 + 0];
123 /// }
124 /// rec.log(
125 /// "image_bgr",
126 /// rerun::Image(
127 /// rerun::borrow(bgr_image),
128 /// {256, 256},
129 /// rerun::ColorModel::BGR
130 /// )
131 /// );
132 ///
133 /// // New image with Separate Y/U/V planes with 4:2:2 chroma downsampling
134 /// std::vector<uint8_t> yuv_bytes(256 * 256 + 128 * 256 * 2);
135 /// std::fill_n(
136 /// yuv_bytes.begin(),
137 /// 256 * 256,
138 /// static_cast<uint8_t>(128) // Fixed value for Y
139 /// );
140 /// size_t u_plane_offset = 256 * 256;
141 /// size_t v_plane_offset = u_plane_offset + 128 * 256;
142 /// for (size_t y = 0; y <256; ++y) {
143 /// for (size_t x = 0; x <128; ++x) {
144 /// auto coord = y * 128 + x;
145 /// yuv_bytes[u_plane_offset + coord] =
146 /// static_cast<uint8_t>(x * 2); // Gradient for U
147 /// yuv_bytes[v_plane_offset + coord] =
148 /// static_cast<uint8_t>(y); // Gradient for V
149 /// }
150 /// }
151 /// rec.log(
152 /// "image_yuv422",
153 /// rerun::Image(
154 /// rerun::borrow(yuv_bytes),
155 /// {256, 256},
156 /// rerun::PixelFormat::Y_U_V16_FullRange
157 /// )
158 /// );
159 ///
160 /// return 0;
161 /// }
162 /// ```
163 struct Image {
164 /// The raw image data.
165 std::optional<ComponentBatch> buffer;
166
167 /// The format of the image.
168 std::optional<ComponentBatch> format;
169
170 /// Opacity of the image, useful for layering several media.
171 ///
172 /// Defaults to 1.0 (fully opaque).
173 std::optional<ComponentBatch> opacity;
174
175 /// An optional floating point value that specifies the 2D drawing order.
176 ///
177 /// Objects with higher values are drawn on top of those with lower values.
178 /// Defaults to `-10.0`.
179 std::optional<ComponentBatch> draw_order;
180
181 /// Optional filter used when a texel is magnified (displayed larger than a screen pixel).
182 std::optional<ComponentBatch> magnification_filter;
183
184 public:
185 /// The name of the archetype as used in `ComponentDescriptor`s.
186 static constexpr const char ArchetypeName[] = "rerun.archetypes.Image";
187
188 /// `ComponentDescriptor` for the `buffer` field.
189 static constexpr auto Descriptor_buffer = ComponentDescriptor(
191 );
192 /// `ComponentDescriptor` for the `format` field.
193 static constexpr auto Descriptor_format = ComponentDescriptor(
195 );
196 /// `ComponentDescriptor` for the `opacity` field.
199 );
200 /// `ComponentDescriptor` for the `draw_order` field.
203 );
204 /// `ComponentDescriptor` for the `magnification_filter` field.
206 ArchetypeName, "Image:magnification_filter",
208 );
209
210 public: // START of extensions from image_ext.cpp:
211 /// Construct an image from bytes and image format.
212 ///
213 /// @param bytes The raw image data as bytes.
214 /// If the data does not outlive the image, use `std::move` or create the `rerun::Collection`
215 /// explicitly ahead of time with `rerun::Collection::take_ownership`.
216 /// The length of the data should be `W * H * image_format.bytes_per_pixel`.
217 /// @param format_ How the data should be interpreted.
219 if (bytes.size() != format_.image_format.num_bytes()) {
220 Error(
221 ErrorCode::InvalidTensorDimension,
222 "Image buffer has the wrong size. Got " + std::to_string(bytes.size()) +
223 " bytes, expected " + std::to_string(format_.image_format.num_bytes())
224 )
225 .handle();
226 }
227 *this = std::move(*this).with_buffer(bytes).with_format(format_);
228 }
229
230 /// Construct an image from resolution, pixel format and bytes.
231 ///
232 /// @param bytes The raw image data as bytes.
233 /// If the data does not outlive the image, use `std::move` or create the `rerun::Collection`
234 /// explicitly ahead of time with `rerun::Collection::take_ownership`.
235 /// The length of the data should be `W * H * pixel_format.bytes_per_pixel`.
236 /// @param resolution The resolution of the image as {width, height}.
237 /// @param pixel_format How the data should be interpreted.
239 Collection<uint8_t> bytes, WidthHeight resolution, datatypes::PixelFormat pixel_format
240 )
241 : Image{std::move(bytes), datatypes::ImageFormat{resolution, pixel_format}} {}
242
243 /// Construct an image from resolution, color model, channel datatype and bytes.
244 ///
245 /// @param bytes The raw image data.
246 /// If the data does not outlive the image, use `std::move` or create the `rerun::Collection`
247 /// explicitly ahead of time with `rerun::Collection::take_ownership`.
248 /// The length of the data should be `W * H * datatype.bytes * color_model.num_channels`.
249 /// @param resolution The resolution of the image as {width, height}.
250 /// @param color_model The color model of the pixel data.
251 /// @param datatype Datatype of the individual channels of the color model.
253 Collection<uint8_t> bytes, WidthHeight resolution, datatypes::ColorModel color_model,
255 )
256 : Image(std::move(bytes), datatypes::ImageFormat(resolution, color_model, datatype)) {}
257
258 /// Construct an image from resolution, color model and elements,
259 /// inferring the channel datatype from the element type.
260 ///
261 /// @param elements Pixel data as a `rerun::Collection`.
262 /// If the data does not outlive the image, use `std::move` or create the `rerun::Collection`
263 /// explicitly ahead of time with `rerun::Collection::take_ownership`.
264 /// The length of the data should be `W * H * color_model.num_channels`.
265 /// @param resolution The resolution of the image as {width, height}.
266 /// @param color_model The color model of the pixel data.
267 /// Each element in elements is interpreted as a single channel of the color model.
268 template <typename T>
269 Image(Collection<T> elements, WidthHeight resolution, datatypes::ColorModel color_model)
270 : Image(elements.to_uint8(), resolution, color_model, get_datatype(elements.data())) {}
271
272 /// Construct an image from resolution, color model and element pointer,
273 /// inferring the channel datatype from the element type.
274 ///
275 /// @param elements The raw image data.
276 /// ⚠️ Does not take ownership of the data, the caller must ensure the data outlives the image.
277 /// The number of elements is assumed to be `W * H * color_model.num_channels`.
278 /// @param resolution The resolution of the image as {width, height}.
279 /// @param color_model The color model of the pixel data.
280 /// Each element in elements is interpreted as a single channel of the color model.
281 template <typename T>
282 Image(const T* elements, WidthHeight resolution, datatypes::ColorModel color_model)
283 : Image(
284 rerun::Collection<uint8_t>::borrow(
285 reinterpret_cast<const uint8_t*>(elements),
286 resolution.width * resolution.height * color_model_channel_count(color_model)
287 ),
288 resolution, color_model, get_datatype(elements)
289 ) {}
290
291 /// Assumes single channel grayscale/luminance with 8-bit per value.
292 ///
293 /// @param bytes Pixel data as a `rerun::Collection`.
294 /// If the data does not outlive the image, use `std::move` or create the `rerun::Collection`
295 /// explicitly ahead of time with `rerun::Collection::take_ownership`.
296 /// The length of the data should be `W * H`.
297 /// @param resolution The resolution of the image as {width, height}.
299 return Image(
300 bytes,
301 resolution,
304 );
305 }
306
307 /// Assumes single channel grayscale/luminance with 8-bit per value.
308 ///
309 /// @param bytes Pixel data as a `rerun::Collection`.
310 /// If the data does not outlive the image, use `std::move` or create the `rerun::Collection`
311 /// explicitly ahead of time with `rerun::Collection::take_ownership`.
312 /// The length of the data should be `W * H`.
313 /// @param resolution The resolution of the image as {width, height}.
314 [[deprecated("Renamed `from_grayscale8`")]] static Image from_greyscale8(
315 Collection<uint8_t> bytes, WidthHeight resolution
316 ) {
317 return Image(
318 bytes,
319 resolution,
322 );
323 }
324
325 /// Assumes RGB, 8-bit per channel, packed as `RGBRGBRGB…`.
326 ///
327 /// @param bytes Pixel data as a `rerun::Collection`.
328 /// If the data does not outlive the image, use `std::move` or create the `rerun::Collection`
329 /// explicitly ahead of time with `rerun::Collection::take_ownership`.
330 /// The length of the data should be `W * H * 3`.
331 /// @param resolution The resolution of the image as {width, height}.
333 return Image(
334 bytes,
335 resolution,
338 );
339 }
340
341 /// Assumes RGBA, 8-bit per channel, with separate alpha.
342 ///
343 /// @param bytes Pixel data as a `rerun::Collection`.
344 /// If the data does not outlive the image, use `std::move` or create the `rerun::Collection`
345 /// explicitly ahead of time with `rerun::Collection::take_ownership`.
346 /// The length of the data should be `W * H * 4`.
347 /// @param resolution The resolution of the image as {width, height}.
349 return Image(
350 bytes,
351 resolution,
354 );
355 }
356
357 // END of extensions from image_ext.cpp, start of generated code:
358
359 public:
360 Image() = default;
361 Image(Image&& other) = default;
362 Image(const Image& other) = default;
363 Image& operator=(const Image& other) = default;
364 Image& operator=(Image&& other) = default;
365
366 /// Update only some specific fields of a `Image`.
368 return Image();
369 }
370
371 /// Clear all the fields of a `Image`.
373
374 /// The raw image data.
376 buffer = ComponentBatch::from_loggable(_buffer, Descriptor_buffer).value_or_throw();
377 return std::move(*this);
378 }
379
380 /// This method makes it possible to pack multiple `buffer` in a single component batch.
381 ///
382 /// This only makes sense when used in conjunction with `columns`. `with_buffer` should
383 /// be used when logging a single row's worth of data.
385 buffer = ComponentBatch::from_loggable(_buffer, Descriptor_buffer).value_or_throw();
386 return std::move(*this);
387 }
388
389 /// The format of the image.
391 format = ComponentBatch::from_loggable(_format, Descriptor_format).value_or_throw();
392 return std::move(*this);
393 }
394
395 /// This method makes it possible to pack multiple `format` in a single component batch.
396 ///
397 /// This only makes sense when used in conjunction with `columns`. `with_format` should
398 /// be used when logging a single row's worth of data.
400 format = ComponentBatch::from_loggable(_format, Descriptor_format).value_or_throw();
401 return std::move(*this);
402 }
403
404 /// Opacity of the image, useful for layering several media.
405 ///
406 /// Defaults to 1.0 (fully opaque).
408 opacity = ComponentBatch::from_loggable(_opacity, Descriptor_opacity).value_or_throw();
409 return std::move(*this);
410 }
411
412 /// This method makes it possible to pack multiple `opacity` in a single component batch.
413 ///
414 /// This only makes sense when used in conjunction with `columns`. `with_opacity` should
415 /// be used when logging a single row's worth of data.
417 opacity = ComponentBatch::from_loggable(_opacity, Descriptor_opacity).value_or_throw();
418 return std::move(*this);
419 }
420
421 /// An optional floating point value that specifies the 2D drawing order.
422 ///
423 /// Objects with higher values are drawn on top of those with lower values.
424 /// Defaults to `-10.0`.
426 draw_order =
427 ComponentBatch::from_loggable(_draw_order, Descriptor_draw_order).value_or_throw();
428 return std::move(*this);
429 }
430
431 /// This method makes it possible to pack multiple `draw_order` in a single component batch.
432 ///
433 /// This only makes sense when used in conjunction with `columns`. `with_draw_order` should
434 /// be used when logging a single row's worth of data.
436 draw_order =
437 ComponentBatch::from_loggable(_draw_order, Descriptor_draw_order).value_or_throw();
438 return std::move(*this);
439 }
440
441 /// Optional filter used when a texel is magnified (displayed larger than a screen pixel).
443 const rerun::components::MagnificationFilter& _magnification_filter
444 ) && {
446 _magnification_filter,
448 )
449 .value_or_throw();
450 return std::move(*this);
451 }
452
453 /// This method makes it possible to pack multiple `magnification_filter` in a single component batch.
454 ///
455 /// This only makes sense when used in conjunction with `columns`. `with_magnification_filter` should
456 /// be used when logging a single row's worth of data.
458 const Collection<rerun::components::MagnificationFilter>& _magnification_filter
459 ) && {
461 _magnification_filter,
463 )
464 .value_or_throw();
465 return std::move(*this);
466 }
467
468 /// Partitions the component data into multiple sub-batches.
469 ///
470 /// Specifically, this transforms the existing `ComponentBatch` data into `ComponentColumn`s
471 /// instead, via `ComponentBatch::partitioned`.
472 ///
473 /// This makes it possible to use `RecordingStream::send_columns` to send columnar data directly into Rerun.
474 ///
475 /// The specified `lengths` must sum to the total length of the component batch.
477
478 /// Partitions the component data into unit-length sub-batches.
479 ///
480 /// This is semantically similar to calling `columns` with `std::vector<uint32_t>(n, 1)`,
481 /// where `n` is automatically guessed.
483 };
484
485} // namespace rerun::archetypes
486
487namespace rerun {
488 /// \private
489 template <typename T>
490 struct AsComponents;
491
492 /// \private
493 template <>
494 struct AsComponents<archetypes::Image> {
495 /// Serialize all set component batches.
496 static Result<Collection<ComponentBatch>> as_batches(const archetypes::Image& archetype);
497 };
498} // namespace rerun
Generic collection of elements that are roughly contiguous in memory.
Definition collection.hpp:49
size_t size() const
Returns the number of instances in this collection.
Definition collection.hpp:291
Status outcome object (success or error) returned for fallible operations.
Definition error.hpp:103
void handle() const
Handle this error based on the set log handler.
A class for representing either a usable value, or an error.
Definition result.hpp:14
All built-in archetypes. See Types in the Rerun manual.
Definition rerun.hpp:87
MagnificationFilter
Component: Filter used when a single texel/pixel of an image is displayed larger than a single screen...
Definition magnification_filter.hpp:27
PixelFormat
Datatype: Specifieds a particular format of an archetypes::Image.
Definition pixel_format.hpp:34
ColorModel
Datatype: Specified what color components are present in an archetypes::Image.
Definition color_model.hpp:26
@ RGB
Red, Green, Blue.
@ L
Grayscale luminance intencity/brightness/value, sometimes called Y
@ RGBA
Red, Green, Blue, Alpha.
ChannelDatatype
Datatype: The innermost datatype of an image.
Definition channel_datatype.hpp:26
@ U8
8-bit unsigned integer.
All Rerun C++ types and functions are in the rerun namespace or one of its nested namespaces.
Definition rerun.hpp:23
size_t color_model_channel_count(datatypes::ColorModel color_model)
Returns the number of channels for a given color model.
Definition image_utils.hpp:139
Collection< TElement > borrow(const TElement *data, size_t num_instances=1)
Borrows binary data into a Collection from a pointer.
Definition collection.hpp:462
static Result< ComponentBatch > from_loggable(const rerun::Collection< T > &components, const ComponentDescriptor &descriptor)
Creates a new component batch from a collection of component instances.
Definition component_batch.hpp:46
A ComponentDescriptor fully describes the semantics of a column of data.
Definition component_descriptor.hpp:16
The Loggable trait is used by all built-in implementation of rerun::AsComponents to serialize a colle...
Definition loggable.hpp:11
The width and height of an image.
Definition image_utils.hpp:13
Archetype: A monochrome or color image.
Definition image.hpp:163
Collection< ComponentColumn > columns(const Collection< uint32_t > &lengths_)
Partitions the component data into multiple sub-batches.
Image with_draw_order(const rerun::components::DrawOrder &_draw_order) &&
An optional floating point value that specifies the 2D drawing order.
Definition image.hpp:425
static constexpr auto Descriptor_opacity
ComponentDescriptor for the opacity field.
Definition image.hpp:197
Image with_many_format(const Collection< rerun::components::ImageFormat > &_format) &&
This method makes it possible to pack multiple format in a single component batch.
Definition image.hpp:399
Image with_magnification_filter(const rerun::components::MagnificationFilter &_magnification_filter) &&
Optional filter used when a texel is magnified (displayed larger than a screen pixel).
Definition image.hpp:442
Image with_format(const rerun::components::ImageFormat &_format) &&
The format of the image.
Definition image.hpp:390
Image with_buffer(const rerun::components::ImageBuffer &_buffer) &&
The raw image data.
Definition image.hpp:375
static constexpr auto Descriptor_buffer
ComponentDescriptor for the buffer field.
Definition image.hpp:189
static Image from_greyscale8(Collection< uint8_t > bytes, WidthHeight resolution)
Assumes single channel grayscale/luminance with 8-bit per value.
Definition image.hpp:314
Image(Collection< uint8_t > bytes, components::ImageFormat format_)
Construct an image from bytes and image format.
Definition image.hpp:218
Image with_many_opacity(const Collection< rerun::components::Opacity > &_opacity) &&
This method makes it possible to pack multiple opacity in a single component batch.
Definition image.hpp:416
static constexpr auto Descriptor_draw_order
ComponentDescriptor for the draw_order field.
Definition image.hpp:201
Collection< ComponentColumn > columns()
Partitions the component data into unit-length sub-batches.
static constexpr auto Descriptor_format
ComponentDescriptor for the format field.
Definition image.hpp:193
Image(Collection< T > elements, WidthHeight resolution, datatypes::ColorModel color_model)
Construct an image from resolution, color model and elements, inferring the channel datatype from the...
Definition image.hpp:269
static Image clear_fields()
Clear all the fields of a Image.
Image with_many_magnification_filter(const Collection< rerun::components::MagnificationFilter > &_magnification_filter) &&
This method makes it possible to pack multiple magnification_filter in a single component batch.
Definition image.hpp:457
Image(Collection< uint8_t > bytes, WidthHeight resolution, datatypes::PixelFormat pixel_format)
Construct an image from resolution, pixel format and bytes.
Definition image.hpp:238
Image(const T *elements, WidthHeight resolution, datatypes::ColorModel color_model)
Construct an image from resolution, color model and element pointer, inferring the channel datatype f...
Definition image.hpp:282
std::optional< ComponentBatch > format
The format of the image.
Definition image.hpp:168
Image with_opacity(const rerun::components::Opacity &_opacity) &&
Opacity of the image, useful for layering several media.
Definition image.hpp:407
Image(Collection< uint8_t > bytes, WidthHeight resolution, datatypes::ColorModel color_model, datatypes::ChannelDatatype datatype)
Construct an image from resolution, color model, channel datatype and bytes.
Definition image.hpp:252
Image with_many_draw_order(const Collection< rerun::components::DrawOrder > &_draw_order) &&
This method makes it possible to pack multiple draw_order in a single component batch.
Definition image.hpp:435
static constexpr auto Descriptor_magnification_filter
ComponentDescriptor for the magnification_filter field.
Definition image.hpp:205
static Image update_fields()
Update only some specific fields of a Image.
Definition image.hpp:367
std::optional< ComponentBatch > draw_order
An optional floating point value that specifies the 2D drawing order.
Definition image.hpp:179
std::optional< ComponentBatch > buffer
The raw image data.
Definition image.hpp:165
static constexpr const char ArchetypeName[]
The name of the archetype as used in ComponentDescriptors.
Definition image.hpp:186
static Image from_grayscale8(Collection< uint8_t > bytes, WidthHeight resolution)
Assumes single channel grayscale/luminance with 8-bit per value.
Definition image.hpp:298
std::optional< ComponentBatch > opacity
Opacity of the image, useful for layering several media.
Definition image.hpp:173
static Image from_rgba32(Collection< uint8_t > bytes, WidthHeight resolution)
Assumes RGBA, 8-bit per channel, with separate alpha.
Definition image.hpp:348
std::optional< ComponentBatch > magnification_filter
Optional filter used when a texel is magnified (displayed larger than a screen pixel).
Definition image.hpp:182
static Image from_rgb24(Collection< uint8_t > bytes, WidthHeight resolution)
Assumes RGB, 8-bit per channel, packed as RGBRGBRGB….
Definition image.hpp:332
Image with_many_buffer(const Collection< rerun::components::ImageBuffer > &_buffer) &&
This method makes it possible to pack multiple buffer in a single component batch.
Definition image.hpp:384
Component: Draw order of 2D elements.
Definition draw_order.hpp:19
Component: A buffer that is known to store image data.
Definition image_buffer.hpp:18
Component: The metadata describing the contents of a components::ImageBuffer.
Definition image_format.hpp:14
Component: Degree of transparency ranging from 0.0 (fully transparent) to 1.0 (fully opaque).
Definition opacity.hpp:17
size_t num_bytes() const
How many bytes will this image occupy?
Definition image_format.hpp:65