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"
137 std::optional<rerun::components::Opacity>
opacity;
145 static constexpr const char IndicatorComponentName[] =
"rerun.components.ImageIndicator";
162 ErrorCode::InvalidTensorDimension,
163 "Image buffer has the wrong size. Got " + std::to_string(
buffer.
size()) +
181 :
Image{std::move(bytes), datatypes::ImageFormat{resolution, pixel_format}} {}
196 :
Image(std::move(bytes), datatypes::ImageFormat(resolution, color_model, datatype)) {}
208 template <
typename T>
210 :
Image(elements.to_uint8(), resolution, color_model, get_datatype(elements.data())) {}
221 template <
typename T>
225 reinterpret_cast<const uint8_t*>(elements),
228 resolution, color_model, get_datatype(elements)
291 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(
return std::move(*
this);)
300 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(
return std::move(*
this);)
308 template <
typename T>
313 struct AsComponents<archetypes::Image> {
315 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:91
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:72
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
@ 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:22
size_t color_model_channel_count(datatypes::ColorModel color_model)
Returns the number of channels for a given color model.
Definition image_utils.hpp:136
Collection< TElement > borrow(const TElement *data, size_t num_instances=1)
Borrows binary data into a Collection from a pointer.
Definition collection.hpp:425
The width and height of an image.
Definition image_utils.hpp:12
Archetype: A monochrome or color image.
Definition image.hpp:127
static Image from_greyscale8(Collection< uint8_t > bytes, WidthHeight resolution)
Assumes single channel greyscale/luminance with 8-bit per value.
Definition image.hpp:238
Image(Collection< uint8_t > bytes, components::ImageFormat format_)
Construct an image from bytes and image format.
Definition image.hpp:158
Image with_opacity(rerun::components::Opacity _opacity) &&
Opacity of the image, useful for layering several images.
Definition image.hpp:288
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:209
rerun::components::ImageFormat format
The format of the image.
Definition image.hpp:132
Image(Collection< uint8_t > bytes, WidthHeight resolution, datatypes::PixelFormat pixel_format)
Construct an image from resolution, pixel format and bytes.
Definition image.hpp:178
std::optional< rerun::components::DrawOrder > draw_order
An optional floating point value that specifies the 2D drawing order.
Definition image.hpp:142
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:222
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:192
rerun::components::ImageBuffer buffer
The raw image data.
Definition image.hpp:129
std::optional< rerun::components::Opacity > opacity
Opacity of the image, useful for layering several images.
Definition image.hpp:137
static Image from_rgba32(Collection< uint8_t > bytes, WidthHeight resolution)
Assumes RGBA, 8-bit per channel, with separate alpha.
Definition image.hpp:270
Image with_draw_order(rerun::components::DrawOrder _draw_order) &&
An optional floating point value that specifies the 2D drawing order.
Definition image.hpp:297
static Image from_rgb24(Collection< uint8_t > bytes, WidthHeight resolution)
Assumes RGB, 8-bit per channel, packed as RGBRGBRGB….
Definition image.hpp:254
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
size_t size() const
Number of bytes.
Definition image_buffer.hpp:23
Indicator component used by archetypes when converting them to component lists.
Definition indicator_component.hpp:30
Component: Degree of transparency ranging from 0.0 (fully transparent) to 1.0 (fully opaque).
Definition opacity.hpp:17