-
Notifications
You must be signed in to change notification settings - Fork 314
Description
Describe the bug
DrawingArea::fill doesn't fill the right and bottom edge in some backends and leaves transparent edges in a generated image. As far as I have checked, plotters-svg and plotters-canvas have this issue. BitMapBackend is fine about this.
For CanvasBackend, it's quick to see #165's attached image. It continues in the latest code too.
For SVGBackend, The repro code below prints this result. width and height in the rect element should be "100" here.
<svg width="100" height="100" viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg">
<rect x="0" y="0" width="99" height="99" opacity="1" fill="#0000FF" stroke="none"/>
</svg>Other backends with sub-pixel coordinate might have the same issue. Can be related to #128.
To Reproduce
use plotters::prelude::*;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut content = String::new();
{
let area = SVGBackend::with_string(&mut content, (100, 100)).into_drawing_area();
area.fill(&BLUE)?;
}
println!("{content}");
Ok(())
}Version Information
plotters: current master (a72bfbc)
plotters-svg: current master (plotters-rs/plotters-svg@47289e8)
plotters-canvas: current master (plotters-rs/plotters-canvas@111fce5)