Rerun C++ SDK
Loading...
Searching...
No Matches
rerun::archetypes::EncodedImage Struct Reference

Archetype: An image encoded as e.g. More...

#include <rerun/archetypes/encoded_image.hpp>

Public Types

using IndicatorComponent = rerun::components::IndicatorComponent< IndicatorComponentName >
 Indicator component, used to identify the archetype when converting to a list of components.
 

Public Member Functions

 EncodedImage (EncodedImage &&other)=default
 
 EncodedImage (const EncodedImage &other)=default
 
EncodedImageoperator= (const EncodedImage &other)=default
 
EncodedImageoperator= (EncodedImage &&other)=default
 
EncodedImage with_blob (const rerun::components::Blob &_blob) &&
 The encoded content of some image file, e.g. a PNG or JPEG.
 
EncodedImage with_many_blob (const Collection< rerun::components::Blob > &_blob) &&
 This method makes it possible to pack multiple blob in a single component batch.
 
EncodedImage with_media_type (const rerun::components::MediaType &_media_type) &&
 The Media Type of the asset.
 
EncodedImage with_many_media_type (const Collection< rerun::components::MediaType > &_media_type) &&
 This method makes it possible to pack multiple media_type in a single component batch.
 
EncodedImage with_opacity (const rerun::components::Opacity &_opacity) &&
 Opacity of the image, useful for layering several images.
 
EncodedImage with_many_opacity (const Collection< rerun::components::Opacity > &_opacity) &&
 This method makes it possible to pack multiple opacity in a single component batch.
 
EncodedImage with_draw_order (const rerun::components::DrawOrder &_draw_order) &&
 An optional floating point value that specifies the 2D drawing order.
 
EncodedImage 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.
 
Collection< ComponentColumncolumns (const Collection< uint32_t > &lengths_)
 Partitions the component data into multiple sub-batches.
 
Collection< ComponentColumncolumns ()
 Partitions the component data into unit-length sub-batches.
 

Static Public Member Functions

static Result< EncodedImagefrom_file (const std::filesystem::path &filepath)
 Create a new EncodedImage from the contents of a file on disk, e.g. a PNG or JPEG.
 
static EncodedImage from_bytes (rerun::Collection< uint8_t > image_contents, std::optional< rerun::components::MediaType > media_type={})
 Create a new EncodedImage from the contents of an image file, like a PNG or JPEG.
 
static EncodedImage update_fields ()
 Update only some specific fields of a EncodedImage.
 
static EncodedImage clear_fields ()
 Clear all the fields of a EncodedImage.
 

Public Attributes

std::optional< ComponentBatchblob
 The encoded content of some image file, e.g. a PNG or JPEG.
 
std::optional< ComponentBatchmedia_type
 The Media Type of the asset.
 
std::optional< ComponentBatchopacity
 Opacity of the image, useful for layering several images.
 
std::optional< ComponentBatchdraw_order
 An optional floating point value that specifies the 2D drawing order.
 

Static Public Attributes

static constexpr const char IndicatorComponentName []
 
static constexpr const char ArchetypeName [] = "rerun.archetypes.EncodedImage"
 The name of the archetype as used in ComponentDescriptors.
 
static constexpr auto Descriptor_blob
 ComponentDescriptor for the blob field.
 
static constexpr auto Descriptor_media_type
 ComponentDescriptor for the media_type field.
 
static constexpr auto Descriptor_opacity
 ComponentDescriptor for the opacity field.
 
static constexpr auto Descriptor_draw_order
 ComponentDescriptor for the draw_order field.
 

Detailed Description

Archetype: An image encoded as e.g.

a JPEG or PNG.

Rerun also supports uncompressed images with the archetypes::Image. For images that refer to video frames see archetypes::VideoFrameReference.

Example

encoded_image:

#include <rerun.hpp>
#include <filesystem>
#include <fstream>
#include <iostream>
#include <vector>
namespace fs = std::filesystem;
int main() {
const auto rec = rerun::RecordingStream("rerun_example_encoded_image");
rec.spawn().exit_on_failure();
fs::path image_filepath = fs::path(__FILE__).parent_path() / "ferris.png";
rec.log("image", rerun::EncodedImage::from_file(image_filepath).value_or_throw());
}
A RecordingStream handles everything related to logging data into Rerun.
Definition recording_stream.hpp:60

Member Function Documentation

◆ from_bytes()

static EncodedImage rerun::archetypes::EncodedImage::from_bytes ( rerun::Collection< uint8_t >  image_contents,
std::optional< rerun::components::MediaType media_type = {} 
)
inlinestatic

Create a new EncodedImage from the contents of an image file, like a PNG or JPEG.

If no MediaType is specified, the Rerun Viewer will try to guess one from the data at render-time. If it can't, rendering will fail with an error.

◆ with_many_blob()

EncodedImage rerun::archetypes::EncodedImage::with_many_blob ( const Collection< rerun::components::Blob > &  _blob) &&
inline

This method makes it possible to pack multiple blob in a single component batch.

This only makes sense when used in conjunction with columns. with_blob should be used when logging a single row's worth of data.

◆ with_media_type()

EncodedImage rerun::archetypes::EncodedImage::with_media_type ( const rerun::components::MediaType _media_type) &&
inline

The Media Type of the asset.

Supported values:

  • image/jpeg
  • image/png

If omitted, the viewer will try to guess from the data blob. If it cannot guess, it won't be able to render the asset.

◆ with_many_media_type()

EncodedImage rerun::archetypes::EncodedImage::with_many_media_type ( const Collection< rerun::components::MediaType > &  _media_type) &&
inline

This method makes it possible to pack multiple media_type in a single component batch.

This only makes sense when used in conjunction with columns. with_media_type should be used when logging a single row's worth of data.

◆ with_opacity()

EncodedImage rerun::archetypes::EncodedImage::with_opacity ( const rerun::components::Opacity _opacity) &&
inline

Opacity of the image, useful for layering several images.

Defaults to 1.0 (fully opaque).

◆ with_many_opacity()

EncodedImage rerun::archetypes::EncodedImage::with_many_opacity ( const Collection< rerun::components::Opacity > &  _opacity) &&
inline

This method makes it possible to pack multiple opacity in a single component batch.

This only makes sense when used in conjunction with columns. with_opacity should be used when logging a single row's worth of data.

◆ with_draw_order()

EncodedImage rerun::archetypes::EncodedImage::with_draw_order ( const rerun::components::DrawOrder _draw_order) &&
inline

An optional floating point value that specifies the 2D drawing order.

Objects with higher values are drawn on top of those with lower values.

◆ with_many_draw_order()

EncodedImage rerun::archetypes::EncodedImage::with_many_draw_order ( const Collection< rerun::components::DrawOrder > &  _draw_order) &&
inline

This method makes it possible to pack multiple draw_order in a single component batch.

This only makes sense when used in conjunction with columns. with_draw_order should be used when logging a single row's worth of data.

◆ columns() [1/2]

Collection< ComponentColumn > rerun::archetypes::EncodedImage::columns ( const Collection< uint32_t > &  lengths_)

Partitions the component data into multiple sub-batches.

Specifically, this transforms the existing ComponentBatch data into ComponentColumns instead, via ComponentBatch::partitioned.

This makes it possible to use RecordingStream::send_columns to send columnar data directly into Rerun.

The specified lengths must sum to the total length of the component batch.

◆ columns() [2/2]

Collection< ComponentColumn > rerun::archetypes::EncodedImage::columns ( )

Partitions the component data into unit-length sub-batches.

This is semantically similar to calling columns with std::vector<uint32_t>(n, 1), where n is automatically guessed.

Member Data Documentation

◆ media_type

std::optional<ComponentBatch> rerun::archetypes::EncodedImage::media_type

The Media Type of the asset.

Supported values:

  • image/jpeg
  • image/png

If omitted, the viewer will try to guess from the data blob. If it cannot guess, it won't be able to render the asset.

◆ opacity

std::optional<ComponentBatch> rerun::archetypes::EncodedImage::opacity

Opacity of the image, useful for layering several images.

Defaults to 1.0 (fully opaque).

◆ draw_order

std::optional<ComponentBatch> rerun::archetypes::EncodedImage::draw_order

An optional floating point value that specifies the 2D drawing order.

Objects with higher values are drawn on top of those with lower values.

◆ IndicatorComponentName

constexpr const char rerun::archetypes::EncodedImage::IndicatorComponentName[]
staticconstexpr
Initial value:
=
"rerun.components.EncodedImageIndicator"

◆ Descriptor_blob

constexpr auto rerun::archetypes::EncodedImage::Descriptor_blob
staticconstexpr
Initial value:
= ComponentDescriptor(
ArchetypeName, "blob", Loggable<rerun::components::Blob>::Descriptor.component_name
)
static constexpr const char ArchetypeName[]
The name of the archetype as used in ComponentDescriptors.
Definition encoded_image.hpp:81

ComponentDescriptor for the blob field.

◆ Descriptor_media_type

constexpr auto rerun::archetypes::EncodedImage::Descriptor_media_type
staticconstexpr
Initial value:
= ComponentDescriptor(
ArchetypeName, "media_type",
Loggable<rerun::components::MediaType>::Descriptor.component_name
)

ComponentDescriptor for the media_type field.

◆ Descriptor_opacity

constexpr auto rerun::archetypes::EncodedImage::Descriptor_opacity
staticconstexpr
Initial value:
= ComponentDescriptor(
ArchetypeName, "opacity",
Loggable<rerun::components::Opacity>::Descriptor.component_name
)

ComponentDescriptor for the opacity field.

◆ Descriptor_draw_order

constexpr auto rerun::archetypes::EncodedImage::Descriptor_draw_order
staticconstexpr
Initial value:
= ComponentDescriptor(
ArchetypeName, "draw_order",
Loggable<rerun::components::DrawOrder>::Descriptor.component_name
)

ComponentDescriptor for the draw_order field.


The documentation for this struct was generated from the following file: