Replies: 1 comment 6 replies
-
For a proper answer, I need more time to look at these examples and do a deeper analysis to get a 100% understanding on what's happening. Unfortunately, I can't do it now, and I can't give you ETA at the moment :( In the meanwhile I can share my understanding of the coordinate handling rules I learned while optimizing the scanning code:
1.1 When there is no antialiasing, the same rules apply, we calculate everything as if there was antialiasing, then apply a
2.4 The polygon is being filled according to the rules in 1. I don't understand why is (2.3) necessary or beneficial. To me it seems like weird exception to a general rule in 1. Skia does not do this when drawing strokes. @tocsoft: can give an explanation for 2.3? Can you also confirm if my understanding on the 1-2.4 steps is correct? @atruskie: does 1-2.4 explain what you experience? |
Beta Was this translation helpful? Give feedback.
-
Hi all,
I draw a lot of non-antialiased lines, and I'd like to get a sense of what expected behavior is so I can file better bug reports.
The basic questions are:
Given a line (particularly a horizontal or vertical one) how do we expect a solid non-antialised pen of varying stroke widths to be drawn?
I've got a set of test cases below which illustrate what I am talking about:
1) Drawing an inset rectangle
Goals: draw a border around the inside edge of a rectangle.
Code:
This test passes for 1 and 3 px wide pens, but fails on 2px. Test code:
Result (Expected, delta, actual):
Flaw: 3px red border in actual, corners are missing/rounded.
Changing
PenOffset
tooWhich results in (Expected, delta, actual):
2) Drawing a horizontal line
Very similar issue to above.
I have a draw line helper method:
Test:
Result (Expected, delta, actual):
Adding in that sub-pixel wiggle from above:
Summary
Beta Was this translation helpful? Give feedback.
All reactions