Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Aliasing and filling defects #366

Open
Tracked by #380
facorread opened this issue Jun 14, 2022 · 1 comment
Open
Tracked by #380

[BUG] Aliasing and filling defects #366

facorread opened this issue Jun 14, 2022 · 1 comment
Labels
bug Something isn't working
Milestone

Comments

@facorread
Copy link
Member

facorread commented Jun 14, 2022

Describe the bug
The anti-alias algorithm seems to be wrapping in the horizontal direction. As a consequence, the images below show artifacts.

Additionally, the antialias pixels do not cover the circles uniformly. They are even absent at some angles.

Finally, there are additional lines on the filled circle to the right.

To Reproduce
The following two examples come from 0f2d3d8:

use plotters::prelude::*;
let drawing_area = BitMapBackend::new("shape_style_filled.png", (400, 200)).into_drawing_area();
let original_style = ShapeStyle {
    color: GREEN.mix(0.8),
    filled: false,
    stroke_width: 2,
};
let filled_style = original_style.filled();
drawing_area.draw(&Circle::new((100, 100), 120, original_style));
drawing_area.draw(&Circle::new((300, 100), 120, filled_style));

shape_style_filled

use plotters::prelude::*;
let drawing_area = BitMapBackend::new("shape_style_stroke_width.png", (400, 200)).into_drawing_area();
let original_style = ShapeStyle {
    color: GREEN.mix(0.8),
    filled: false,
    stroke_width: 2,
};
let new_style = original_style.stroke_width(5);
drawing_area.draw(&Circle::new((100, 100), 120, original_style));
drawing_area.draw(&Circle::new((300, 100), 120, new_style));

shape_style_stroke_width

Version Information
Using Plotters from the GitHub master

The examples above use the BitMapBackend. The SVGBackend seems unaffected.

See also
#128

@facorread facorread added the bug Something isn't working label Jun 14, 2022
facorread added a commit to facorread/plotters that referenced this issue Jun 14, 2022
@38
Copy link
Member

38 commented Jul 4, 2022

Hi @facorread , I think I prefer to postpone fixing this issue until we are publishing next major release.

One reason is - due to current integer backend coordinate constraint, the default rasterization code must consider anti-aliasing, and this is going to change when we move on to a backend that supports float point backend coordinates - and this will make the anti-aliasing algorithm easier to implement.

So I just fixed the part that is easy enough to fix - but for the ring filling one, I'd like to revist this later.

Please let me know if you have any thoughts.

Thanks,
Hao

@38 38 added this to the 0.4 milestone Jul 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants