Implement Canvas pixel manipulation

This commit is contained in:
Edit Balint 2015-01-15 17:20:26 +01:00 committed by Josh Matthews
parent e68d6d2924
commit 325400dce4
14 changed files with 305 additions and 84 deletions

View file

@ -83,6 +83,16 @@ impl LayoutHTMLCanvasElementHelpers for LayoutJS<HTMLCanvasElement> {
}
}
pub trait HTMLCanvasElementHelpers {
fn get_size(&self) -> Size2D<i32>;
}
impl<'a> HTMLCanvasElementHelpers for JSRef<'a, HTMLCanvasElement> {
fn get_size(&self) -> Size2D<i32> {
Size2D(self.Width() as i32, self.Height() as i32)
}
}
impl<'a> HTMLCanvasElementMethods for JSRef<'a, HTMLCanvasElement> {
fn Width(self) -> u32 {
self.width.get()