Loading...
Searching...
No Matches

What a texture outlet produces, as an image any view can paint: an inspector widget, an item of the scene. More...

Detailed Description

What a texture outlet produces, as an image any view can paint: an inspector widget, an item of the scene.

When an output of the patch renders the producer, its render list reads the outlet back as it renders it (score::gfx::PreviewTap): the preview costs one small pass and readback, and shows what the output shows. Otherwise the preview has an offscreen output of its own, which pulls the producer: it then renders even when nothing else consumes it. The GfxContext switches between the two as outputs come and go; image() is the latest frame.

Public Member Functions

 TexturePreview (const TexturePreview &)=delete
 
TexturePreview & operator= (const TexturePreview &)=delete
 
void attach (GfxContext *ctx, port_index producer, QSize size)
 
void setProducer (port_index producer)
 Rewires the preview to another producer, or to none.
 
void setSize (QSize size)
 
void detach ()
 
bool attached () const noexcept
 
port_index producer () const noexcept
 
bool tapped () const noexcept
 
bool onHub () const noexcept
 Whether the shared output of the previews renders it.
 
QImage image () const
 

Static Public Member Functions

static QRectF fit (const QRectF &box, QSize size) noexcept
 Where an image of size goes in box: as large as fits, centred.
 

Member Function Documentation

◆ attach()

void Gfx::TexturePreview::attach ( GfxContext *  ctx,
port_index  producer,
QSize  size 
)

Starts previewing producer, at most size pixels. Replaces any previous one.

◆ image()

QImage Gfx::TexturePreview::image ( ) const

The latest frame, empty until one was read back. It keeps the aspect of the texture. It refers to the readback's memory: copy it to keep it past the next frame. Taking it asks for the next frame to be read back.

◆ tapped()

bool Gfx::TexturePreview::tapped ( ) const
noexcept

Whether a render list of the patch reads it, rather than an output of its own.


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