use crate::core::{Texture, Renderer, Context, Program, BlendMode, Postprocessor, Color, Point2};
pub struct Basic {
source : Texture,
program : Program,
}
impl Postprocessor for Basic {
type T = BlendMode;
fn target(self: &Self) -> &Texture {
&self.source
}
fn draw(self: &Self, renderer: &Renderer, blendmode: &Self::T) {
renderer.fill().blendmode(*blendmode).program(&self.program).texture(&self.source).draw();
}
}
impl Basic {
pub fn new<T>(context: &Context, program: Program, dimensions: T) -> Self where Point2<u32>: From<T> {
let (width, height) = Point2::<u32>::from(dimensions);
let result = Basic {
source : Texture::new(&context, width, height),
program : program,
};
result.source.clear(Color::TRANSPARENT);
result
}
}