mirror of
https://github.com/Feliix42/ssd1675.git
synced 2024-11-23 19:26:31 +00:00
Compare commits
No commits in common. "1d4ee1a2e93c4b392bc12253d135539412478360" and "89b973b815906f4fe0feaba013b69eebe82d58b5" have entirely different histories.
1d4ee1a2e9
...
89b973b815
2 changed files with 3 additions and 55 deletions
|
@ -22,7 +22,7 @@ version = "0.2.6"
|
|||
|
||||
[dependencies.embedded-graphics]
|
||||
optional = true
|
||||
version = "0.8.0"
|
||||
version = "0.7.1"
|
||||
|
||||
[dependencies.linux-embedded-hal]
|
||||
optional = true
|
||||
|
@ -30,9 +30,7 @@ version = "0.3.2"
|
|||
|
||||
[dependencies.profont]
|
||||
optional = true
|
||||
#version = "0.6"
|
||||
git = "https://github.com/sambenko/profont"
|
||||
branch = "embedded-graphics-0.8.0-fixes"
|
||||
version = "0.5.0"
|
||||
|
||||
[features]
|
||||
default = ["graphics"]
|
||||
|
|
52
src/color.rs
52
src/color.rs
|
@ -15,7 +15,7 @@ extern crate embedded_graphics;
|
|||
#[cfg(feature = "graphics")]
|
||||
use self::embedded_graphics::pixelcolor::raw::RawU8;
|
||||
#[cfg(feature = "graphics")]
|
||||
use self::embedded_graphics::pixelcolor::{BinaryColor, Rgb555, Rgb565, Rgb888, RgbColor};
|
||||
use self::embedded_graphics::pixelcolor::{BinaryColor, Rgb888, RgbColor};
|
||||
#[cfg(feature = "graphics")]
|
||||
use self::embedded_graphics::prelude::*;
|
||||
#[cfg(feature = "graphics")]
|
||||
|
@ -80,56 +80,6 @@ impl Into<Rgb888> for Color {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "graphics")]
|
||||
impl From<Rgb555> for Color {
|
||||
fn from(value: Rgb555) -> Self {
|
||||
// NOTE(feliix42): This is admittedly a very simplistic approximation, it'd be more
|
||||
// accurate to map the colors accordingly, but since that's an injective mapping anyways,
|
||||
// why not keep it simple for now.
|
||||
match value {
|
||||
Rgb555::WHITE => Color::White,
|
||||
Rgb555::BLACK => Color::Black,
|
||||
_ => Color::Red,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "graphics")]
|
||||
impl Into<Rgb555> for Color {
|
||||
fn into(self) -> Rgb555 {
|
||||
match self {
|
||||
Color::White => Rgb555::WHITE,
|
||||
Color::Black => Rgb555::BLACK,
|
||||
Color::Red => Rgb555::RED,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "graphics")]
|
||||
impl From<Rgb565> for Color {
|
||||
fn from(value: Rgb565) -> Self {
|
||||
// NOTE(feliix42): This is admittedly a very simplistic approximation, it'd be more
|
||||
// accurate to map the colors accordingly, but since that's an injective mapping anyways,
|
||||
// why not keep it simple for now.
|
||||
match value {
|
||||
Rgb565::WHITE => Color::White,
|
||||
Rgb565::BLACK => Color::Black,
|
||||
_ => Color::Red,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "graphics")]
|
||||
impl Into<Rgb565> for Color {
|
||||
fn into(self) -> Rgb565 {
|
||||
match self {
|
||||
Color::White => Rgb565::WHITE,
|
||||
Color::Black => Rgb565::BLACK,
|
||||
Color::Red => Rgb565::RED,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
|
Loading…
Reference in a new issue