Comment #4 on issue 181 by re...@colorado.edu: PNode.toImage is not centered and can create cropped images for PNodes with non-integral (x,y) bounds
http://code.google.com/p/piccolo2d/issues/detail?id=181

The fix described in Comment 3 is not general; for instance, applying that solution to a stroke with an even number of pixels for width ends up cropping the bottom and right side. Inspection of that image shows that the problem with bounds are due to the anti-aliasing. When anti-aliasing is disabled, the fix proposed in comment 3 works properly. When anti-aliasing is enabled, there is some semi-transparent gray matter to the top, left, right and bottom of the image, and both solutions (that is, with or without the fix in comment 3) end up cropping some of it. The underlying problem is that piccolo nodes do not account for the extra width created by anti-aliasing. The heuristic of always adding a 1-pixel padding around every pnode is unappealing because it would cause non-anti-aliased (or anti-aliased nodes where there is no extended semitransparent gray matter) to not fill the extent of the allocated image.

--
Piccolo2D Developers Group: http://groups.google.com/group/piccolo2d-dev?hl=en

Reply via email to