Implement image viewer example

This commit is contained in:
Héctor Ramón Jiménez 2019-11-30 02:14:56 +01:00
parent 505588d585
commit cdd34e1e4b
5 changed files with 245 additions and 18 deletions

View file

@ -25,6 +25,18 @@ impl Color {
a: 1.0,
};
/// Creates a [`Color`] from its RGB8 components.
///
/// [`Color`]: struct.Color.html
pub fn from_rgb8(r: u8, g: u8, b: u8) -> Color {
Color {
r: f32::from(r) / 255.0,
g: f32::from(g) / 255.0,
b: f32::from(b) / 255.0,
a: 1.0,
}
}
/// Converts the [`Color`] into its linear values.
///
/// [`Color`]: struct.Color.html