Enum fltk::enums::ColorDepth
source · #[repr(u8)]pub enum ColorDepth {
L8 = 1,
La8 = 2,
Rgb8 = 3,
Rgba8 = 4,
}
Expand description
Defines the color depth for drawing and rgb images
Variants§
L8 = 1
Luminance/grayscale
La8 = 2
Luminance with Alpha channel
Rgb8 = 3
RGB888
Rgba8 = 4
RGBA8888 with Alpha channel
Implementations§
source§impl ColorDepth
impl ColorDepth
Implements some convenience methods for ColorDepth
sourcepub fn from_u8(val: u8) -> Result<ColorDepth, FltkError>
pub fn from_u8(val: u8) -> Result<ColorDepth, FltkError>
Create a ColorDepth from an u8 value
Examples found in repository?
examples/rounded_images.rs (line 60)
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
fn main() {
let app = app::App::default().with_scheme(app::Scheme::Gleam);
app::background(0, 0, 0);
let image = image::SharedImage::load("screenshots/calc2.jpg")
.unwrap()
.to_rgb()
.unwrap();
let mut wind = window::Window::new(100, 100, 800, 400, "Hello from rust");
let row = group::Flex::default()
.row()
.with_size(800, 200)
.center_of_parent();
for i in 1..=4 {
let color_depth = enums::ColorDepth::from_u8(i).unwrap();
let image = image.convert(color_depth).unwrap();
RoundImageBox::new(100, image);
}
row.end();
wind.end();
wind.show();
app.run().unwrap();
}
Trait Implementations§
source§impl Clone for ColorDepth
impl Clone for ColorDepth
source§fn clone(&self) -> ColorDepth
fn clone(&self) -> ColorDepth
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for ColorDepth
impl Debug for ColorDepth
source§impl PartialEq for ColorDepth
impl PartialEq for ColorDepth
source§fn eq(&self, other: &ColorDepth) -> bool
fn eq(&self, other: &ColorDepth) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl Copy for ColorDepth
impl Eq for ColorDepth
impl StructuralEq for ColorDepth
impl StructuralPartialEq for ColorDepth
Auto Trait Implementations§
impl RefUnwindSafe for ColorDepth
impl Send for ColorDepth
impl Sync for ColorDepth
impl Unpin for ColorDepth
impl UnwindSafe for ColorDepth
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