Skip to content

[BUG] DrawingArea::fill doesn't fill the right and bottom edge in some backends #368

Description

@shinmili

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.

<svgwidth="100"height="100"viewBox="0 0 100 100"xmlns="http://www.w3.org/2000/svg">
<rectx="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::*;fnmain() -> Result<(),Box<dyn std::error::Error>>{letmut 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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions