Struct kiss_ui::image::Image [] [src]

pub struct Image(_);

An image buffer allocated by IUP.

Note: Not a Renderable Widget

While this type can be dereferenced and converted to BaseWidget, it is not a renderable widget and adding it to a container will have no visual effect.

Instead, it should be set on another widget type that implements the ImageContainer trait, which will handle the actual rendering.

Note: Memory Usage

This struct should be freed by calling .destroy() on it when it is no longer in use. Otherwise, it will be freed when kiss_ui::show_gui() exits[citation needed].

Note: Cloning

Cloning this image does not duplicate its allocation. Thus, destroying one image cloned from another will destroy them both.

Methods

impl Image

fn new_rgb(width: u32, height: u32, pixels: &[(u8, u8, u8)]) -> Image

Create a new RGB image buffer from a slice of 3-byte tuples, copying the data into a new allocation.

See transmute_buffer_rgb() in this module.

Panics

If width * height is not equal to pixels.len().

fn new_rgba(width: u32, height: u32, pixels: &[(u8, u8, u8, u8)]) -> Image

Create a new RGBA image buffer from a slice of 4-byte tuples, copying the data into a new allocation.

See transmute_buffer_rgba in this module.

Panics

If width * height is not equal to pixels.len().

Trait Implementations

impl Destroy for Image

fn destroy(self)

impl Widget for Image

fn show(self) -> Self

fn hide(self) -> Self

fn set_visible(self, visible: bool) -> Self

fn set_enabled(self, enabled: bool) -> Self

fn set_position(self, x: i32, y: i32) -> Self

fn get_position(self) -> (i32, i32)

fn set_name(self, name: &str) -> Self

fn get_name(&self) -> Option<WidgetStr>

fn get_sibling(self) -> Option<BaseWidget>

fn get_parent(self) -> Option<BaseWidget>

fn get_dialog(self) -> Option<Dialog>

fn get_size_pixels(self) -> (u32, u32)

fn store<N: Into<String>>(self, name: N) -> Option<BaseWidget>

fn to_base(self) -> BaseWidget

impl Copy for Image

impl Clone for Image

fn clone(&self) -> Self

fn clone_from(&mut self, source: &Self)

impl Downcast for Image

fn can_downcast(base: &BaseWidget) -> bool

fn try_downcast(base: BaseWidget) -> Result<Self, BaseWidget>