pub struct Image<'a> {
pub style: Style,
/* private fields */
}Expand description
Display a raw pixel buffer.
Fields§
§style: StyleStyling for the image background.
Implementations§
Source§impl<'a> Image<'a>
impl<'a> Image<'a>
Sourcepub fn new(bounds: Rect, width: i32, height: i32, pixels: &'a [Color]) -> Self
pub fn new(bounds: Rect, width: i32, height: i32, pixels: &'a [Color]) -> Self
Create an image widget backed by a slice of pixels.
Sourcepub fn with_blit_opts(self, blit_opts: BlitOpts) -> Self
pub fn with_blit_opts(self, blit_opts: BlitOpts) -> Self
Configure low-level blit options for this image instance.
Sourcepub fn set_pixels(&mut self, width: i32, height: i32, pixels: &'a [Color])
pub fn set_pixels(&mut self, width: i32, height: i32, pixels: &'a [Color])
Replace the displayed pixel buffer and its dimensions at runtime.
The widget’s pixel buffer was previously construction-only. This
setter exists so generated reactive bindings (QT-05g
PredicateBinding) can swap artwork as a state machine’s
predicates change, without rebuilding the widget tree. The blit
options (e.g. a stretch scale) are left unchanged — callers that
swap to a differently-sized buffer and need a different scale must
also call set_blit_opts.
Sourcepub fn set_blit_opts(&mut self, blit_opts: BlitOpts)
pub fn set_blit_opts(&mut self, blit_opts: BlitOpts)
Replace the low-level blit options at runtime (companion to
set_pixels when the new buffer differs in size).
Hide or show the image at runtime. A hidden image’s
draw is a no-op — it paints nothing (not even its
background), leaving whatever is behind it visible. Generated reactive
bindings (QT-05h VisibilityBinding) use this to drive a widget’s
visibility from a state-machine predicate without removing it from the
widget tree.
Whether the image is currently hidden.
Trait Implementations§
Source§impl<'a> Widget for Image<'a>
impl<'a> Widget for Image<'a>
Source§fn handle_event(&mut self, _event: &Event) -> bool
fn handle_event(&mut self, _event: &Event) -> bool
Images are purely visual and do not handle events.
Source§fn clear_region(&mut self) -> Option<Rect>
fn clear_region(&mut self) -> Option<Rect>
None. Read more