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

A filmstrip image containing N frames of a control at different values. More...

#include <sprite_strip.hpp>

Public Types

enum class  Orientation { vertical , horizontal }
enum class  Source { raw_pixels , image_file }
 Where the strip's pixel data lives. More...

Public Member Functions

 SpriteStrip ()=default
void load (const uint8_t *data, size_t data_size, int total_width, int total_height, int frame_count, Orientation orientation=Orientation::vertical)
 Load from raw pixel data (RGBA8, row-major).
void load_from_file (std::string file_path, int total_width, int total_height, int frame_count, Orientation orientation=Orientation::vertical)
 Load from an encoded image file (PNG/JPEG/etc.).
int frame_for_value (float value) const
 Get the frame index for a normalized value [0.0–1.0].
void frame_offset (int frame, int &x, int &y) const
 Get the pixel offset (x, y) for a given frame index.
bool loaded () const
Source source () const
const std::string & path () const
int frame_count () const
int frame_width () const
int frame_height () const
int total_width () const
int total_height () const
Orientation orientation () const
const uint8_t * data () const
size_t data_size () const
const std::string & data_key () const
 Lowercase hex SHA-256 of data(), computed when the strip loads; empty for an image_file strip.
void set_decoded_size (int width, int height)
 Pixel size a canvas decoder reported for data(), recorded by the painting widget on the first successful measure.
bool decoded_size_known () const
int decoded_width () const
int decoded_height () const
void set_interpolate (bool v)
 Whether to interpolate between adjacent frames for smooth sub-frame animation.
bool interpolate () const

Detailed Description

A filmstrip image containing N frames of a control at different values.

Used for designer-created knob/fader skins. The control's current value (0.0–1.0) selects which frame to display.

Typical usage: a 128x128px knob rendered at 128 rotation angles produces a 128x16384 vertical filmstrip. The widget renders the frame corresponding to its current parameter value.

Member Enumeration Documentation

◆ Orientation

Enumerator
vertical 
horizontal 

◆ Source

Where the strip's pixel data lives.

raw_pixels is the legacy in-memory RGBA8 path; image_file defers decoding to Skia via the file path stored in path_ (added for Track A1 figma-plugin imports — avoids round-tripping the decoded bytes through the JS bridge).

Enumerator
raw_pixels 
image_file 

Constructor & Destructor Documentation

◆ SpriteStrip()

pulp::view::SpriteStrip::SpriteStrip ( )
default

Member Function Documentation

◆ data()

const uint8_t * pulp::view::SpriteStrip::data ( ) const
inline

◆ data_key()

const std::string & pulp::view::SpriteStrip::data_key ( ) const
inline

Lowercase hex SHA-256 of data(), computed when the strip loads; empty for an image_file strip.

The content key for Canvas::draw_image_from_keyed_data.

◆ data_size()

size_t pulp::view::SpriteStrip::data_size ( ) const
inline

◆ decoded_height()

int pulp::view::SpriteStrip::decoded_height ( ) const
inline

◆ decoded_size_known()

bool pulp::view::SpriteStrip::decoded_size_known ( ) const
inline

◆ decoded_width()

int pulp::view::SpriteStrip::decoded_width ( ) const
inline

◆ frame_count()

int pulp::view::SpriteStrip::frame_count ( ) const
inline

◆ frame_for_value()

int pulp::view::SpriteStrip::frame_for_value ( float value) const
inline

Get the frame index for a normalized value [0.0–1.0].

◆ frame_height()

int pulp::view::SpriteStrip::frame_height ( ) const
inline

◆ frame_offset()

void pulp::view::SpriteStrip::frame_offset ( int frame,
int & x,
int & y ) const
inline

Get the pixel offset (x, y) for a given frame index.

◆ frame_width()

int pulp::view::SpriteStrip::frame_width ( ) const
inline

◆ interpolate()

bool pulp::view::SpriteStrip::interpolate ( ) const
inline

◆ load()

void pulp::view::SpriteStrip::load ( const uint8_t * data,
size_t data_size,
int total_width,
int total_height,
int frame_count,
Orientation orientation = Orientation::vertical )
inline

Load from raw pixel data (RGBA8, row-major).

◆ load_from_file()

void pulp::view::SpriteStrip::load_from_file ( std::string file_path,
int total_width,
int total_height,
int frame_count,
Orientation orientation = Orientation::vertical )
inline

Load from an encoded image file (PNG/JPEG/etc.).

The strip caches the path; Skia decodes lazily inside the canvas. Caller MUST pass the strip's total pixel width/height (Skia will not be re-queried).

◆ loaded()

bool pulp::view::SpriteStrip::loaded ( ) const
inline

◆ orientation()

Orientation pulp::view::SpriteStrip::orientation ( ) const
inline

◆ path()

const std::string & pulp::view::SpriteStrip::path ( ) const
inline

◆ set_decoded_size()

void pulp::view::SpriteStrip::set_decoded_size ( int width,
int height )
inline

Pixel size a canvas decoder reported for data(), recorded by the painting widget on the first successful measure.

Unknown (and treated as raw RGBA pixels) until then; load forgets it.

◆ set_interpolate()

void pulp::view::SpriteStrip::set_interpolate ( bool v)
inline

Whether to interpolate between adjacent frames for smooth sub-frame animation.

◆ source()

Source pulp::view::SpriteStrip::source ( ) const
inline

◆ total_height()

int pulp::view::SpriteStrip::total_height ( ) const
inline

◆ total_width()

int pulp::view::SpriteStrip::total_width ( ) const
inline

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