parent
91a0202a52
commit
0b55d8d3db
@ -1,6 +1,3 @@
|
||||
pub mod bitmap_base;
|
||||
pub mod mono8;
|
||||
pub mod rgb565;
|
||||
pub mod rgba8888;
|
||||
|
||||
pub use bitmap_base::{Bitmap, BitmapFormat, BitmapView};
|
||||
|
@ -1,37 +0,0 @@
|
||||
use super::{Bitmap, BitmapFormat, BitmapView};
|
||||
use crate::{
|
||||
trezorhal::bitblt::{BitBltCopy, BitBltFill},
|
||||
ui::{display::Color, geometry::Rect},
|
||||
};
|
||||
|
||||
impl<'a> Bitmap<'a> {
|
||||
/// Fills a rectangle with the specified color.
|
||||
///
|
||||
/// The function is aplicable only on bitmaps with MONO8 format.
|
||||
pub fn mono8_fill(&mut self, r: Rect, clip: Rect, color: Color, alpha: u8) {
|
||||
if let Some(bitblt) = BitBltFill::new(r, clip, color, alpha) {
|
||||
bitblt.mono8_fill(self);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
pub fn mono8_copy(&mut self, r: Rect, clip: Rect, src: &BitmapView) {
|
||||
if let Some(bitblt) = BitBltCopy::new(r, clip, src) {
|
||||
match src.format() {
|
||||
BitmapFormat::MONO1P => bitblt.mono8_copy_mono1p(self),
|
||||
BitmapFormat::MONO4 => bitblt.mono8_copy_mono4(self),
|
||||
_ => panic!("Unsupported DMA operation"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn mono8_blend(&mut self, r: Rect, clip: Rect, src: &BitmapView) {
|
||||
if let Some(bitblt) = BitBltCopy::new(r, clip, src) {
|
||||
match src.format() {
|
||||
BitmapFormat::MONO1P => bitblt.mono8_blend_mono1p(self),
|
||||
BitmapFormat::MONO4 => bitblt.mono8_blend_mono4(self),
|
||||
_ => panic!("Unsupported DMA operation"),
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,41 +0,0 @@
|
||||
use super::{Bitmap, BitmapFormat, BitmapView};
|
||||
use crate::{
|
||||
trezorhal::bitblt::{BitBltCopy, BitBltFill},
|
||||
ui::{display::Color, geometry::Rect},
|
||||
};
|
||||
|
||||
impl<'a> Bitmap<'a> {
|
||||
/// Fills a rectangle with the specified color.
|
||||
///
|
||||
/// The function is aplicable only on bitmaps with RGB565 format.
|
||||
pub fn rgb565_fill(&mut self, r: Rect, clip: Rect, color: Color, alpha: u8) {
|
||||
if let Some(bitblt) = BitBltFill::new(r, clip, color, alpha) {
|
||||
bitblt.rgb565_fill(self);
|
||||
}
|
||||
}
|
||||
|
||||
/// Copy a rectangle from the source bitmap to the destination bitmap.
|
||||
///
|
||||
/// The function is aplicable only on bitmaps with RGB565 format.
|
||||
pub fn rgb565_copy(&mut self, r: Rect, clip: Rect, src: &BitmapView) {
|
||||
if let Some(bitblt) = BitBltCopy::new(r, clip, src) {
|
||||
match src.format() {
|
||||
BitmapFormat::MONO4 => bitblt.rgb565_copy_mono4(self),
|
||||
BitmapFormat::RGB565 => bitblt.rgb565_copy_rgb565(self),
|
||||
_ => panic!("Unsupported DMA operation"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Blend a rectangle from the source bitmap to the destination bitmap.
|
||||
///
|
||||
/// The function is aplicable only on bitmaps with RGB565 format.
|
||||
pub fn rgb565_blend(&mut self, r: Rect, clip: Rect, src: &BitmapView) {
|
||||
if let Some(bitblt) = BitBltCopy::new(r, clip, src) {
|
||||
match src.format() {
|
||||
BitmapFormat::MONO4 => bitblt.rgb565_blend_mono4(self),
|
||||
_ => panic!("Unsupported DMA operation"),
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
use super::{Bitmap, BitmapFormat, BitmapView};
|
||||
use crate::{
|
||||
trezorhal::bitblt::{BitBltCopy, BitBltFill},
|
||||
ui::{display::Color, geometry::Rect},
|
||||
};
|
||||
|
||||
impl<'a> Bitmap<'a> {
|
||||
/// Fills a rectangle with the specified color.
|
||||
///
|
||||
/// The function is aplicable only on bitmaps with RGBA888 format.
|
||||
pub fn rgba8888_fill(&mut self, r: Rect, clip: Rect, color: Color, alpha: u8) {
|
||||
if let Some(bitblt) = BitBltFill::new(r, clip, color, alpha) {
|
||||
bitblt.rgba8888_fill(self);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn rgba8888_copy(&mut self, r: Rect, clip: Rect, src: &BitmapView) {
|
||||
if let Some(bitblt) = BitBltCopy::new(r, clip, src) {
|
||||
match src.format() {
|
||||
BitmapFormat::MONO4 => bitblt.rgba8888_copy_mono4(self),
|
||||
BitmapFormat::RGB565 => bitblt.rgba8888_copy_rgb565(self),
|
||||
BitmapFormat::RGBA8888 => bitblt.rgba8888_copy_rgba8888(self),
|
||||
_ => panic!("Unsupported DMA operation"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn rgba8888_blend(&mut self, r: Rect, clip: Rect, src: &BitmapView) {
|
||||
if let Some(bitblt) = BitBltCopy::new(r, clip, src) {
|
||||
match src.format() {
|
||||
BitmapFormat::MONO4 => bitblt.rgba8888_blend_mono4(self),
|
||||
_ => panic!("Unsupported DMA operation"),
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in new issue