4 ms·
On a similar note: "How do I draw a sharp, single-pixel-wide line?", from the Cairo FAQ: https://www.cairographics.org/FAQ/#sharp_lines https://www.cairographic
by Matumio 5y ago
On a similar note: "How do I draw a sharp, single-pixel-wide line?", from the Cairo FAQ: https://www.cairographics.org/FAQ/#sharp_lines https://www.cairographics.org/FAQ/#sharp_lines
TL;DR: always think of the upper left pixel's position as (0.5, 0.5).
- threatripper 5y ago> TL;DR: always think of the upper left pixel's position as (0.5, 0.5). The position of the center of the pixel. That pixel goes from (0,0) to (1,1) and therefore the center is (0.5,0.5). The image area goes from the upper left corner of the upper left pixel to the lower right corner of the lower right pixel. The centers are shifted by half of a pixel versus a grid starting at 0 and ending at N-1. When drawing a line you need to hit the center of the pixel you want to fill.