Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
pulp::canvas::SceneImage Class Reference

#include <scene_image.hpp>

Public Member Functions

 SceneImage ()
void set_rect (float x, float y, float w, float h)
float x () const
float y () const
float w () const
float h () const
void set_rgba_pixels (std::vector< uint8_t > rgba, int pixel_width, int pixel_height)
 Attach a decoded RGBA byte buffer.
void set_encoded_bytes (std::vector< uint8_t > bytes)
 Attach an encoded image blob (PNG/JPEG bytes).
void set_file_path (std::string path)
 Attach a path to an encoded image on disk.
const std::vector< uint8_t > & rgba_pixels () const
const std::vector< uint8_t > & encoded_bytes () const
const std::string & encoded_bytes_key () const
 Lowercase hex SHA-256 of encoded_bytes(); empty when none are set.
const std::string & file_path () const
int pixel_width () const
int pixel_height () const
SceneRect local_bounds () const override
 Local-coordinate bounding box (pre-transform, pre-opacity).
void paint_geometry (Canvas &canvas) const override
 Paint this node (and its sub-tree) into canvas.
SceneNodeKind kind () const
const std::string & id () const
void set_id (std::string v)
bool visible () const
void set_visible (bool v)
float opacity () const
void set_opacity (float a)
const SceneTransform & transform () const
void set_transform (const SceneTransform &t)
SceneGroup * parent () const
SceneRect transformed_local_bounds () const
 Bounds after the node's own transform — used for parent group unions.
bool dirty () const
void mark_dirty ()
 Mark this node and (recursively) every ancestor dirty.
void mark_clean (const SceneRect &painted_scene_bounds)
 Called by the scene walker after a full paint.
const SceneRect & last_painted_bounds () const
 The scene-space rect this node occupied at the last paint.

Constructor & Destructor Documentation

◆ SceneImage()

pulp::canvas::SceneImage::SceneImage ( )
inline

Member Function Documentation

◆ dirty()

bool pulp::canvas::SceneNode::dirty ( ) const
inlineinherited

◆ encoded_bytes()

const std::vector< uint8_t > & pulp::canvas::SceneImage::encoded_bytes ( ) const
inline

◆ encoded_bytes_key()

const std::string & pulp::canvas::SceneImage::encoded_bytes_key ( ) const
inline

Lowercase hex SHA-256 of encoded_bytes(); empty when none are set.

◆ file_path()

const std::string & pulp::canvas::SceneImage::file_path ( ) const
inline

◆ h()

float pulp::canvas::SceneImage::h ( ) const
inline

◆ id()

const std::string & pulp::canvas::SceneNode::id ( ) const
inlineinherited

◆ kind()

SceneNodeKind pulp::canvas::SceneNode::kind ( ) const
inlineinherited

◆ last_painted_bounds()

const SceneRect & pulp::canvas::SceneNode::last_painted_bounds ( ) const
inlineinherited

The scene-space rect this node occupied at the last paint.

Always united with the post-mutation bounds to derive the "what needs repainting" rect — this is the whole point of the retained scene graph: small mutations → small repaint rects.

◆ local_bounds()

SceneRect pulp::canvas::SceneImage::local_bounds ( ) const
inlineoverridevirtual

Local-coordinate bounding box (pre-transform, pre-opacity).

Subclasses MUST compute this from current geometry.

Implements pulp::canvas::SceneNode.

◆ mark_clean()

void pulp::canvas::SceneNode::mark_clean ( const SceneRect & painted_scene_bounds)
inlineinherited

Called by the scene walker after a full paint.

Captures the bounding box that was painted (in scene coordinates) so the next mutation knows what to invalidate.

◆ mark_dirty()

void pulp::canvas::SceneNode::mark_dirty ( )
inherited

Mark this node and (recursively) every ancestor dirty.

Returning the current node's last_painted_bounds() union with the new transformed_local_bounds() lets VectorScene::take_dirty_rect() report the exact rect that needs to be re-painted.

◆ opacity()

float pulp::canvas::SceneNode::opacity ( ) const
inlineinherited

◆ paint_geometry()

void pulp::canvas::SceneImage::paint_geometry ( Canvas & canvas) const
overridevirtual

Paint this node (and its sub-tree) into canvas.

The walker calls save() / restore() around this call, applies the composed CTM, and pushes opacity if opacity_ < 1.0. Implementations therefore emit geometry/state only — they MUST NOT touch save/restore.

Implements pulp::canvas::SceneNode.

◆ parent()

SceneGroup * pulp::canvas::SceneNode::parent ( ) const
inlineinherited

◆ pixel_height()

int pulp::canvas::SceneImage::pixel_height ( ) const
inline

◆ pixel_width()

int pulp::canvas::SceneImage::pixel_width ( ) const
inline

◆ rgba_pixels()

const std::vector< uint8_t > & pulp::canvas::SceneImage::rgba_pixels ( ) const
inline

◆ set_encoded_bytes()

void pulp::canvas::SceneImage::set_encoded_bytes ( std::vector< uint8_t > bytes)

Attach an encoded image blob (PNG/JPEG bytes).

The SHA-256 of the bytes is computed here, once, and paint draws through Canvas::draw_image_from_keyed_data, so a caching backend decodes and uploads the blob once rather than on every paint.

◆ set_file_path()

void pulp::canvas::SceneImage::set_file_path ( std::string path)
inline

Attach a path to an encoded image on disk.

◆ set_id()

void pulp::canvas::SceneNode::set_id ( std::string v)
inlineinherited

◆ set_opacity()

void pulp::canvas::SceneNode::set_opacity ( float a)
inlineinherited

◆ set_rect()

void pulp::canvas::SceneImage::set_rect ( float x,
float y,
float w,
float h )
inline

◆ set_rgba_pixels()

void pulp::canvas::SceneImage::set_rgba_pixels ( std::vector< uint8_t > rgba,
int pixel_width,
int pixel_height )
inline

Attach a decoded RGBA byte buffer.

The caller-supplied bytes are stored by value so the node remains valid after the caller's buffer goes out of scope.

◆ set_transform()

void pulp::canvas::SceneNode::set_transform ( const SceneTransform & t)
inlineinherited

◆ set_visible()

void pulp::canvas::SceneNode::set_visible ( bool v)
inlineinherited

◆ transform()

const SceneTransform & pulp::canvas::SceneNode::transform ( ) const
inlineinherited

◆ transformed_local_bounds()

SceneRect pulp::canvas::SceneNode::transformed_local_bounds ( ) const
inlineinherited

Bounds after the node's own transform — used for parent group unions.

◆ visible()

bool pulp::canvas::SceneNode::visible ( ) const
inlineinherited

◆ w()

float pulp::canvas::SceneImage::w ( ) const
inline

◆ x()

float pulp::canvas::SceneImage::x ( ) const
inline

◆ y()

float pulp::canvas::SceneImage::y ( ) const
inline

The documentation for this class was generated from the following file:
  • /home/runner/work/pulp/pulp/core/canvas/include/pulp/canvas/scene/scene_image.hpp