Enum fltk::enums::ColorDepth
source · [−]#[repr(u8)]
pub enum ColorDepth {
L8,
La8,
Rgb8,
Rgba8,
}Expand description
Defines the color depth for drawing and rgb images
Variants
L8
Luminance/grayscale
La8
Luminance with Alpha channel
Rgb8
RGB888
Rgba8
RGBA8888 with Alpha channel
Implementations
sourceimpl 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 mut pack = group::Pack::default()
.with_size(800, 200)
.center_of_parent();
pack.set_type(group::PackType::Horizontal);
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);
}
pack.end();
wind.end();
wind.show();
app.run().unwrap();
}Trait Implementations
sourceimpl Clone for ColorDepth
impl Clone for ColorDepth
sourcefn clone(&self) -> ColorDepth
fn clone(&self) -> ColorDepth
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read more
sourceimpl Debug for ColorDepth
impl Debug for ColorDepth
sourceimpl PartialEq<ColorDepth> for ColorDepth
impl PartialEq<ColorDepth> for ColorDepth
impl Copy 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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more