Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- extern crate image;
- extern crate num_traits;
- use image::{GenericImage, Pixel};
- #[derive(Clone, Copy)]
- enum SplitDirection {
- Horiz,
- Vert,
- }
- #[derive(Clone, Copy)]
- struct Split {
- dir: SplitDirection,
- at: u32,
- size: u32,
- }
- struct Node<I>
- where
- I: image::GenericImage + 'static,
- {
- color: <I as GenericImage>::Pixel,
- child: Option<Box<NodeChild<I>>>,
- }
- struct NodeChild<I>
- where
- I: image::GenericImage + 'static,
- {
- a: Node<I>,
- b: Node<I>,
- split: Split,
- }
- impl<'i, I> Node<I>
- where
- I: GenericImage + 'static,
- Self: 'static,
- I: 'static,
- I::Pixel: 'static,
- <I::Pixel as Pixel>::Subpixel: 'static,
- {
- fn new(image: &'i I) -> Self {
- Self::new(&image.sub_image(0, 0, 1, 1))
- }
- }
- fn main() {}
Add Comment
Please, Sign In to add comment