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