Trait fltk::prelude::ImageExt

source ·
pub unsafe trait ImageExt {
Show 24 methods // Required methods fn copy(&self) -> Self where Self: Sized; fn copy_sized(&self, w: i32, h: i32) -> Self where Self: Sized; fn draw(&mut self, x: i32, y: i32, width: i32, height: i32); fn draw_ext( &mut self, x: i32, y: i32, width: i32, height: i32, cx: i32, cy: i32 ); fn width(&self) -> i32; fn height(&self) -> i32; fn w(&self) -> i32; fn h(&self) -> i32; fn as_image_ptr(&self) -> *mut Fl_Image; unsafe fn from_image_ptr(ptr: *mut Fl_Image) -> Self where Self: Sized; fn to_rgb_data(&self) -> Vec<u8>; fn to_raw_data(&self) -> *const *const u8; fn to_rgb(&self) -> Result<RgbImage, FltkError>; fn to_rgb_image(&self) -> Result<RgbImage, FltkError>; fn scale( &mut self, width: i32, height: i32, proportional: bool, can_expand: bool ); fn count(&self) -> i32; fn data_w(&self) -> i32; fn data_h(&self) -> i32; fn depth(&self) -> ColorDepth; fn ld(&self) -> i32; fn inactive(&mut self); unsafe fn delete(img: Self) where Self: Sized; fn was_deleted(&self) -> bool; unsafe fn into_image<I: ImageExt>(self) -> I where Self: Sized;
}
Expand description

Defines the methods implemented by all image types

§Safety

fltk-rs traits depend on some FLTK internal code

§Warning

fltk-rs traits are non-exhaustive, to avoid future breakage if you try to implement them manually, use the Deref and DerefMut pattern

Required Methods§

source

fn copy(&self) -> Self
where Self: Sized,

Performs a deep copy of the image

source

fn copy_sized(&self, w: i32, h: i32) -> Self
where Self: Sized,

Performs a deep copy of the image but to a new size. This will make use of the scaling algorithm when resizing.

source

fn draw(&mut self, x: i32, y: i32, width: i32, height: i32)

Draws the image at the presupplied coordinates and size

source

fn draw_ext( &mut self, x: i32, y: i32, width: i32, height: i32, cx: i32, cy: i32 )

Draws the image at the presupplied coordinates and size and offset cx, cy

source

fn width(&self) -> i32

Return the width of the image

source

fn height(&self) -> i32

Return the height of the image

source

fn w(&self) -> i32

Return the width of the image

source

fn h(&self) -> i32

Return the height of the image

source

fn as_image_ptr(&self) -> *mut Fl_Image

Returns a pointer of the image

source

unsafe fn from_image_ptr(ptr: *mut Fl_Image) -> Self
where Self: Sized,

Transforms a raw image pointer to an image

§Safety

The pointer must be valid

source

fn to_rgb_data(&self) -> Vec<u8>

Returns the underlying raw rgb image data

source

fn to_raw_data(&self) -> *const *const u8

Returns the underlying raw image data

source

fn to_rgb(&self) -> Result<RgbImage, FltkError>

Transforms the image into an RgbImage

§Errors

Errors on failure to transform to RgbImage

source

fn to_rgb_image(&self) -> Result<RgbImage, FltkError>

Transforms the image into an RgbImage

§Errors

Errors on failure to transform to RgbImage

source

fn scale( &mut self, width: i32, height: i32, proportional: bool, can_expand: bool )

Scales the image

source

fn count(&self) -> i32

Return the count of pointers in an image (Pixmaps have more than 1, bitmaps have 0, Rgb based images have 1)

source

fn data_w(&self) -> i32

Gets the image’s data width

source

fn data_h(&self) -> i32

Gets the image’s data height

source

fn depth(&self) -> ColorDepth

Gets the image’s depth

source

fn ld(&self) -> i32

Gets the image’s line data size

source

fn inactive(&mut self)

Greys the image

source

unsafe fn delete(img: Self)
where Self: Sized,

Deletes the image

§Safety

An image shouldn’t be deleted while it’s being used by a widget

source

fn was_deleted(&self) -> bool

Checks if the image was deleted

source

unsafe fn into_image<I: ImageExt>(self) -> I
where Self: Sized,

Transforms an Image base into another Image

§Safety

Can be unsafe if used to downcast to an image of different format

Implementors§