6#include "../collection.hpp"
7#include "../compiler_utils.hpp"
8#include "../component_batch.hpp"
9#include "../components/draw_order.hpp"
10#include "../components/image_buffer.hpp"
11#include "../components/image_format.hpp"
12#include "../components/opacity.hpp"
13#include "../image_utils.hpp"
14#include "../indicator_component.hpp"
15#include "../result.hpp"
154 std::optional<rerun::components::Opacity>
opacity;
162 static constexpr const char IndicatorComponentName[] =
"rerun.components.ImageIndicator";
179 ErrorCode::InvalidTensorDimension,
180 "Image buffer has the wrong size. Got " + std::to_string(
buffer.
size()) +
198 :
Image{std::move(bytes), datatypes::ImageFormat{resolution, pixel_format}} {}
213 :
Image(std::move(bytes), datatypes::ImageFormat(resolution, color_model, datatype)) {}
225 template <
typename T>
227 :
Image(elements.to_uint8(), resolution, color_model, get_datatype(elements.data())) {}
238 template <
typename T>
242 reinterpret_cast<const uint8_t*>(elements),
245 resolution, color_model, get_datatype(elements)
308 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(
return std::move(*
this);)
317 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(
return std::move(*
this);)
325 template <
typename T>
330 struct AsComponents<archetypes::Image> {
332 static Result<std::vector<ComponentBatch>> serialize(
const archetypes::Image& archetype);
Generic collection of elements that are roughly contiguous in memory.
Definition collection.hpp:49
Status outcome object (success or error) returned for fallible operations.
Definition error.hpp:95
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:77
PixelFormat
Datatype: Specifieds a particular format of an archetypes::Image.
Definition pixel_format.hpp:35
ColorModel
Datatype: Specified what color components are present in an archetypes::Image.
Definition color_model.hpp:27
@ 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:27
@ 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:461
The width and height of an image.
Definition image_utils.hpp:13
Archetype: A monochrome or color image.
Definition image.hpp:144
static Image from_greyscale8(Collection< uint8_t > bytes, WidthHeight resolution)
Assumes single channel greyscale/luminance with 8-bit per value.
Definition image.hpp:255
Image(Collection< uint8_t > bytes, components::ImageFormat format_)
Construct an image from bytes and image format.
Definition image.hpp:175
Image with_opacity(rerun::components::Opacity _opacity) &&
Opacity of the image, useful for layering several images.
Definition image.hpp:305
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:226
rerun::components::ImageFormat format
The format of the image.
Definition image.hpp:149
Image(Collection< uint8_t > bytes, WidthHeight resolution, datatypes::PixelFormat pixel_format)
Construct an image from resolution, pixel format and bytes.
Definition image.hpp:195
std::optional< rerun::components::DrawOrder > draw_order
An optional floating point value that specifies the 2D drawing order.
Definition image.hpp:159
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:239
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:209
rerun::components::ImageBuffer buffer
The raw image data.
Definition image.hpp:146
std::optional< rerun::components::Opacity > opacity
Opacity of the image, useful for layering several images.
Definition image.hpp:154
static Image from_rgba32(Collection< uint8_t > bytes, WidthHeight resolution)
Assumes RGBA, 8-bit per channel, with separate alpha.
Definition image.hpp:287
Image with_draw_order(rerun::components::DrawOrder _draw_order) &&
An optional floating point value that specifies the 2D drawing order.
Definition image.hpp:314
static Image from_rgb24(Collection< uint8_t > bytes, WidthHeight resolution)
Assumes RGB, 8-bit per channel, packed as RGBRGBRGB….
Definition image.hpp:271
Component: Draw order of 2D elements.
Definition draw_order.hpp:20
Component: A buffer that is known to store image data.
Definition image_buffer.hpp:19
size_t size() const
Number of bytes.
Definition image_buffer.hpp:24
Indicator component used by archetypes when converting them to component lists.
Definition indicator_component.hpp:32
Component: Degree of transparency ranging from 0.0 (fully transparent) to 1.0 (fully opaque).
Definition opacity.hpp:18