Struct RgbImage
pub struct RgbImage { /* private fields */ }
Available on crate feature
dep_fltk
only.Expand description
Creates a struct holding a raw RGB image
Implementations§
§impl RgbImage
impl RgbImage
pub fn new(
data: &[u8],
w: i32,
h: i32,
depth: ColorDepth,
) -> Result<RgbImage, FltkError> ⓘ
pub fn new( data: &[u8], w: i32, h: i32, depth: ColorDepth, ) -> Result<RgbImage, FltkError> ⓘ
Initializes a new raw RgbImage
, copies the data and handles its lifetime.
If you need to work with RGB data,
§Errors
Errors on invalid or unsupported image format
pub unsafe fn from_data(
data: &[u8],
w: i32,
h: i32,
depth: ColorDepth,
) -> Result<RgbImage, FltkError> ⓘ
pub unsafe fn from_data( data: &[u8], w: i32, h: i32, depth: ColorDepth, ) -> Result<RgbImage, FltkError> ⓘ
pub unsafe fn new2(
data: &[u8],
w: i32,
h: i32,
depth: i32,
line_data: i32,
) -> Result<RgbImage, FltkError> ⓘ
pub unsafe fn new2( data: &[u8], w: i32, h: i32, depth: i32, line_data: i32, ) -> Result<RgbImage, FltkError> ⓘ
pub unsafe fn from_data2(
data: &[u8],
w: i32,
h: i32,
depth: i32,
line_data: i32,
) -> Result<RgbImage, FltkError> ⓘ
pub unsafe fn from_data2( data: &[u8], w: i32, h: i32, depth: i32, line_data: i32, ) -> Result<RgbImage, FltkError> ⓘ
pub fn from_pixmap(image: &Pixmap) -> RgbImage
pub fn from_pixmap(image: &Pixmap) -> RgbImage
Creates an RgbImage from a pixmap
pub fn convert(&self, new_depth: ColorDepth) -> Result<RgbImage, FltkError> ⓘ
pub fn convert(&self, new_depth: ColorDepth) -> Result<RgbImage, FltkError> ⓘ
Convert from one ColorDepth to another ColorDepth
pub fn convert_transparent(&self) -> Result<RgbImage, FltkError> ⓘ
pub fn convert_transparent(&self) -> Result<RgbImage, FltkError> ⓘ
Convert black pixels to transparent
pub fn blur(&self, radius: u32) -> Result<RgbImage, FltkError> ⓘ
pub fn blur(&self, radius: u32) -> Result<RgbImage, FltkError> ⓘ
Blur the image Adapted from https://www.cairographics.org/cookbook/blur.c/
pub fn to_srgb_image(&self) -> Result<RgbImage, FltkError> ⓘ
pub fn to_srgb_image(&self) -> Result<RgbImage, FltkError> ⓘ
Returns an SRGB image
pub fn set_scaling_algorithm(algorithm: RgbScaling)
pub fn set_scaling_algorithm(algorithm: RgbScaling)
Sets the scaling algorithm
pub fn scaling_algorithm() -> RgbScaling
pub fn scaling_algorithm() -> RgbScaling
Gets the scaling algorithm
Trait Implementations§
§impl ImageExt for RgbImage
impl ImageExt for RgbImage
§fn copy_sized(&self, w: i32, h: i32) -> RgbImage
fn copy_sized(&self, w: i32, h: i32) -> RgbImage
Performs a deep copy of the image but to a new size. This will make use of the scaling algorithm when resizing.
§fn draw(&mut self, arg2: i32, arg3: i32, arg4: i32, arg5: i32)
fn draw(&mut self, arg2: i32, arg3: i32, arg4: i32, arg5: i32)
Draws the image at the presupplied coordinates and size
§fn draw_ext(
&mut self,
arg2: i32,
arg3: i32,
arg4: i32,
arg5: i32,
cx: i32,
cy: i32,
)
fn draw_ext( &mut self, arg2: i32, arg3: i32, arg4: i32, arg5: i32, cx: i32, cy: i32, )
Draws the image at the presupplied coordinates and size and offset cx, cy
§fn as_image_ptr(&self) -> *mut Fl_Image
fn as_image_ptr(&self) -> *mut Fl_Image
Returns a pointer of the image
§unsafe fn from_image_ptr(ptr: *mut Fl_Image) -> RgbImage
unsafe fn from_image_ptr(ptr: *mut Fl_Image) -> RgbImage
Transforms a raw image pointer to an image Read more
§fn to_rgb_data(&self) -> Vec<u8> ⓘ
fn to_rgb_data(&self) -> Vec<u8> ⓘ
Returns the underlying raw rgb image data
§fn to_raw_data(&self) -> *const *const u8
fn to_raw_data(&self) -> *const *const u8
Returns the underlying raw image data
§fn to_rgb_image(&self) -> Result<RgbImage, FltkError> ⓘ
fn to_rgb_image(&self) -> Result<RgbImage, FltkError> ⓘ
Transforms the image into an
RgbImage
Read more§fn scale(
&mut self,
width: i32,
height: i32,
proportional: bool,
can_expand: bool,
)
fn scale( &mut self, width: i32, height: i32, proportional: bool, can_expand: bool, )
Scales the image
§fn count(&self) -> i32
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)
§fn depth(&self) -> ColorDepth
fn depth(&self) -> ColorDepth
Gets the image’s depth
§fn was_deleted(&self) -> bool
fn was_deleted(&self) -> bool
Checks if the image was deleted
§unsafe fn into_image<I>(self) -> Iwhere
I: ImageExt,
unsafe fn into_image<I>(self) -> Iwhere
I: ImageExt,
Transforms an Image base into another Image Read more
impl Eq for RgbImage
impl Send for RgbImage
impl Sync for RgbImage
Auto Trait Implementations§
impl Freeze for RgbImage
impl RefUnwindSafe for RgbImage
impl Unpin for RgbImage
impl UnwindSafe for RgbImage
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> ByteSized for T
impl<T> ByteSized for T
Source§const BYTE_ALIGN: usize = _
const BYTE_ALIGN: usize = _
The alignment of this type in bytes.
Source§fn byte_align(&self) -> usize
fn byte_align(&self) -> usize
Returns the alignment of this type in bytes.
Source§fn ptr_size_ratio(&self) -> [usize; 2]
fn ptr_size_ratio(&self) -> [usize; 2]
Source§impl<T, R> Chain<R> for Twhere
T: ?Sized,
impl<T, R> Chain<R> for Twhere
T: ?Sized,
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.Source§impl<T> ExtAny for T
impl<T> ExtAny for T
Source§fn type_hash_with<H: Hasher>(&self, hasher: H) -> u64
fn type_hash_with<H: Hasher>(&self, hasher: H) -> u64
Returns a deterministic hash of the
TypeId
of Self
using a custom hasher.Source§fn as_any_mut(&mut self) -> &mut dyn Anywhere
Self: Sized,
fn as_any_mut(&mut self) -> &mut dyn Anywhere
Self: Sized,
Source§impl<T> ExtMem for Twhere
T: ?Sized,
impl<T> ExtMem for Twhere
T: ?Sized,
Source§const NEEDS_DROP: bool = _
const NEEDS_DROP: bool = _
Know whether dropping values of this type matters, in compile-time.
Source§fn mem_align_of<T>() -> usize
fn mem_align_of<T>() -> usize
Returns the minimum alignment of the type in bytes. Read more
Source§fn mem_align_of_val(&self) -> usize
fn mem_align_of_val(&self) -> usize
Returns the alignment of the pointed-to value in bytes. Read more
Source§fn mem_size_of<T>() -> usize
fn mem_size_of<T>() -> usize
Returns the size of a type in bytes. Read more
Source§fn mem_size_of_val(&self) -> usize
fn mem_size_of_val(&self) -> usize
Returns the size of the pointed-to value in bytes. Read more
Source§fn mem_needs_drop(&self) -> bool
fn mem_needs_drop(&self) -> bool
Returns
true
if dropping values of this type matters. Read moreSource§fn mem_forget(self)where
Self: Sized,
fn mem_forget(self)where
Self: Sized,
Forgets about
self
without running its destructor. Read moreSource§fn mem_replace(&mut self, other: Self) -> Selfwhere
Self: Sized,
fn mem_replace(&mut self, other: Self) -> Selfwhere
Self: Sized,
Source§unsafe fn mem_zeroed<T>() -> T
unsafe fn mem_zeroed<T>() -> T
Available on crate feature
unsafe_layout
only.Returns the value of type
T
represented by the all-zero byte-pattern. Read moreSource§unsafe fn mem_transmute_copy<Src, Dst>(src: &Src) -> Dst
unsafe fn mem_transmute_copy<Src, Dst>(src: &Src) -> Dst
Available on crate feature
unsafe_layout
only.Returns the value of type
T
represented by the all-zero byte-pattern. Read moreSource§fn mem_as_bytes(&self) -> &[u8] ⓘ
fn mem_as_bytes(&self) -> &[u8] ⓘ
Available on crate feature
unsafe_slice
only.§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> Hook for T
impl<T> Hook for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more