Skip to content

GDI: do not crop when frameless#2053

Merged
swharden merged 8 commits intomainfrom
2051
Aug 18, 2022
Merged

GDI: do not crop when frameless#2053
swharden merged 8 commits intomainfrom
2051

Conversation

@swharden
Copy link
Member

Cropping results in anti-aliasing artifacts near the edges of the bitmap

resolves #2051

@swharden
Copy link
Member Author

For added context, most of what we're fighting here is anti-aliasing errors near edges.

The clipping area is automatically expanded by 1 pixel to reduce these artifacts, and typically the "blended" edges are covered by the black line that outlines the data area

/* These dimensions are withdrawn by 1 pixel to leave room for a 1px wide data frame.
* Rounding is intended to exactly match rounding used when frame placement is determined.
*/
float left = (int)Math.Round(dims.DataOffsetX) + 1;
float top = (int)Math.Round(dims.DataOffsetY) + 1;
float width = (int)Math.Round(dims.DataWidth) - 1;
float height = (int)Math.Round(dims.DataHeight) - 1;
gfx.Clip = new Region(new RectangleF(left, top, width, height));

@swharden swharden enabled auto-merge August 18, 2022 00:04
@swharden swharden merged commit c42a1c6 into main Aug 18, 2022
@swharden swharden deleted the 2051 branch August 18, 2022 00:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AddHorizontalSpan: off by 1px on frameless plots

2 participants