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