Skip to main content

Image

Struct Image 

Source
pub struct Image<'a> {
    pub style: Style,
    /* private fields */
}
Expand description

Display a raw pixel buffer.

Fields§

§style: Style

Styling for the image background.

Implementations§

Source§

impl<'a> Image<'a>

Source

pub fn new(bounds: Rect, width: i32, height: i32, pixels: &'a [Color]) -> Self

Create an image widget backed by a slice of pixels.

Source

pub fn with_blit_opts(self, blit_opts: BlitOpts) -> Self

Configure low-level blit options for this image instance.

Source

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.

Source

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).

Source

pub fn set_hidden(&mut self, hidden: bool)

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.

Source

pub fn is_hidden(&self) -> bool

Whether the image is currently hidden.

Trait Implementations§

Source§

impl<'a> Widget for Image<'a>

Source§

fn handle_event(&mut self, _event: &Event) -> bool

Images are purely visual and do not handle events.

Source§

fn bounds(&self) -> Rect

Return the area this widget occupies relative to its parent.
Source§

fn draw(&self, renderer: &mut dyn Renderer)

Render the widget using the provided Renderer.
Source§

fn clear_region(&mut self) -> Option<Rect>

Return a region (in draw/landscape coordinates) that should be restored from the pristine background copy, or None. Read more
Source§

fn set_bounds(&mut self, _bounds: Rect)

Called by the LPAR-10 layout pass to notify this widget of its layout-computed bounds. Read more
Source§

fn widget_font_mut(&mut self) -> Option<&mut WidgetFont>

Expose this widget’s font slot for cascade-driven font resolution (FONT-05 §5.B). Read more

Auto Trait Implementations§

§

impl<'a> Freeze for Image<'a>

§

impl<'a> RefUnwindSafe for Image<'a>

§

impl<'a> Send for Image<'a>

§

impl<'a> Sync for Image<'a>

§

impl<'a> Unpin for Image<'a>

§

impl<'a> UnsafeUnpin for Image<'a>

§

impl<'a> UnwindSafe for Image<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.