This is continuation of pixel alignment work started in !7798 (merged)
Main parts:
- Canvas rectangle alignment
- Canvas control handles
- Add some tests for the pixel alignment code introduced previously and the new parts
Closes #6074
Rectangle changes primarily motivated by page border. Ideally if you have a canvas 100x100px canvas thats the size of white rectangle you should see at 100% zoom. The changes add some options for rect based canvas items to choose how the rectangle outline should be placed for each widget. In case of page border placing it on outside, in rest of the cases for now defaulting to center inside (center with bias towards inside in case of odd pixel width). In general case with arbitrary zoom/object size relationship relative to drawing pixels can be slightly inconsistent due to antialised pixels slightly peeking beyond rounded rectangle edge.
Some of the introduced utilities are also used for pixel snapping bounding box intervals on rulers.
One unintended side effect of changes is that page border looks darker due to being drawn on top of the infinite gray background instead of white page area.
Other major group of changes is canvas item handle icons. The changes should produce sharper non blurry versions of them. Did my best to keep the size as close as possible to the previous one. Also introduce optional flag for rounding towards specific dimension parity. Even width icon can't be properly centered on odd width lines. For now using this only for guide handle circles, matching their size parity with guide line width. With rest of the item handles the parity needs are less clear.
For circle handles I have made a bit of tradeoff in favor of smoother more incremental size change instead of attempting to pixel snap edge on the 4 cardinal directions. That might make circles with outlines slightly more blurry, but I think it's acceptable considering that most of the pixels along the curve of circle aren't going to be aligned with anything even if you align top/left/bottom/right sides.
Testing
Canvas border
- Canvas size 1x perfect pixel scaling
- Canvas size 2x perfect pixel scaling
- Generic case (A4 1x and 2x)
- Canvas edge weirdness at 2x scale before change
- Shadow with and without rotation no OpenGL
- Shadow with and without rotation with OpenGL
Canvas handle icons at 1x, 2x, 3x scaling, 3 versions of after - preferred size, forced even parity, forced odd parity.
Download and open in inkscape so that relevant parts can be inspected at suitable zoom level.
Raw screenshots for easier comparison of canvas item ctrl icons in image comparison tool of your choice. I found it most convenient to open them as layers in gimp with original version at the bottom and toggling visibility.






















