|
|
@ -30,6 +30,22 @@ pub trait Buffer2d: Sized { |
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn patch_rotated<B>(&mut self, x: usize, y: usize, buf: &B)
|
|
|
|
where B: Buffer2d<Pixel=Self::Pixel>
|
|
|
|
{
|
|
|
|
let (w, h) = buf.dimensions();
|
|
|
|
|
|
|
|
// TODO: can this be optimized by performing an unsafe memcpy of some sort?
|
|
|
|
for sy in 0..h {
|
|
|
|
for sx in 0..w {
|
|
|
|
match buf.get(sx, sy) {
|
|
|
|
Some(v) => self.set(x+h-sy-1, y+sy, v),
|
|
|
|
_ => (),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub trait ResizeableBuffer2d: Buffer2d {
|
|
|
|