#[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

Implements some convenience methods for ColorDepth

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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.