#72: PNG driver: boundary rendering is off by one pixel --------------------------+------------------------------------------------- Reporter: hamish | Owner: grass-dev@lists.osgeo.org Type: defect | Status: new Priority: blocker | Milestone: 6.4.0 Component: default | Version: svn-develbranch6 Resolution: | Keywords: d.vect, rendering, PNG_DRIVER Platform: Unspecified | Cpu: Unspecified --------------------------+------------------------------------------------- Comment (by glynn):
Replying to [comment:10 hamish]: {{{ echo "symbol geology/strike_triangle 22 50 50 black black" > draw_triangle.dgr d.graph draw_triangle.dgr }}} Okay. There were two problems with the existing polygon filler, which should be fixed by attachment:ticket:72:pngdriver-polygon.patch. The first is that the x coordinates were calculated for the top of the pixel rather than the centre, causing an effective downward shift. The second is that the x coordinates were truncated rather than rounded, causing a leftward shift. In the test case, both of these contribute to the gap on the right-hand side, while the latter contributes to the overlap on the left-hand side. The one issue which this patch doesn't attempt to address is the fact that all lines are effectively shifted half a pixel down and to the right. This is inherent in the use of integer coordinates. While you can draw a polygon with orthogonal edges perfectly aligned to the pixel grid, you can't draw a single-pixel orthogonal stroke with its centre-line so aligned. I have attached PNG files containing the output before and after the patch, as well as corresponding SVG files which show exactly what is happening in more detail. The actual vertices passed to the rendering functions (both line and polygon) are [(315,240), (320,229), (325,240)]. This corresponds to the black triangle. The red triangle shows the half pixel down-right shift inherent in the line drawing. -- Ticket URL: <https://trac.osgeo.org/grass/ticket/72#comment:11> GRASS GIS <http://grass.osgeo.org>
_______________________________________________ grass-dev mailing list grass-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-dev