mappings: split coord mapping from pixel mapping
This commit is contained in:
@@ -2,12 +2,30 @@ use std::io;
|
||||
use rgb::Rgb;
|
||||
|
||||
use crate::geometry::*;
|
||||
use crate::lib8::Rgb8Blend;
|
||||
use crate::lib8::interpolate::Fract8Ops;
|
||||
use crate::power::AsMilliwatts;
|
||||
use crate::task::Task;
|
||||
use crate::time::Periodically;
|
||||
use running_average::RealTimeRunningAverage;
|
||||
use std::marker::PhantomData;
|
||||
use std::fmt::Debug;
|
||||
|
||||
pub trait HardwarePixel: Send + Sync + Rgb8Blend + Copy + AsMilliwatts + Default + From<Rgb<u8>> + Fract8Ops {}
|
||||
impl<T> HardwarePixel for T where T: Send + Sync + Rgb8Blend + Copy + AsMilliwatts + Default + From<Rgb<u8>> + Fract8Ops {}
|
||||
|
||||
pub trait PixelView {
|
||||
type Pixel: HardwarePixel;
|
||||
fn next(&mut self) -> Option<(Coordinates<Virtual>, &mut Self::Pixel)>;
|
||||
}
|
||||
|
||||
pub trait Sample {
|
||||
type Pixel: HardwarePixel;
|
||||
|
||||
fn sample(&mut self, rect: &Rectangle<Virtual>) -> impl PixelView<Pixel = Self::Pixel>;
|
||||
}
|
||||
|
||||
|
||||
pub trait Shader: Send + Debug {
|
||||
fn draw(&self, surface_coords: &VirtualCoordinates, frame: usize) -> Rgb<u8>;
|
||||
}
|
||||
|
Reference in New Issue
Block a user