-
Notifications
You must be signed in to change notification settings - Fork 11
"invalid bounding box" #17
Copy link
Copy link
Open
Description
Why is the following code producing "invalid bounding box"?
use ril::prelude::*;
fn main() -> ril::Result<()> {
let mut image = Image::<Rgba>::open("sample.png")?;
let (width, height) = image.dimensions();
let vertices = vec![(50, 0), (100, 25), (100, 75), (50, 100), (0, 75), (0, 25)];
let border = Border::<L>::new(L(255), 1);
let hexagon = Polygon::from_vertices(vertices)
.with_fill(L(255))
.with_border(border);
let mut mask = Image::new(width, height, L(0));
mask.draw(&hexagon);
image.mask_alpha(&mask);
image.save_inferred("sample_hexagon.png")?;
Ok(())
}
This error doesn't happen if you remove .with_border(border);.
By the way, this is sample.png: https://i.stack.imgur.com/hTIji.jpg. It's a png image of 1024 x 1024 pixels.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels