[piccolo2d-dev] Re: Issue 181 in piccolo2d: PNode.toImage is not centered and can create cropped images for PNodes with non-integral (x,y) bounds

2011-03-26 Thread piccolo2d

Updates:
Labels: -Milestone-1.3.1 Milestone-2.0

Comment #16 on issue 181 by atdi...@gmail.com: 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

Moving to 2.0. (Just to note: got a +1 for moving to 2.0 on developer  
thread http://goo.gl/qXt7P)


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


[piccolo2d-dev] Re: Issue 181 in piccolo2d: PNode.toImage is not centered and can create cropped images for PNodes with non-integral (x,y) bounds

2011-03-21 Thread cmal...@pixelzoom.com
+1 for moving to 2.0.

On Mar 20, 3:11 pm, piccol...@googlecode.com wrote:
> Comment #15 on issue 181 by atdi...@gmail.com: PNode.toImage is not  
> centered and can create cropped images for PNodes with non-integral (x,y)  
> boundshttp://code.google.com/p/piccolo2d/issues/detail?id=181
>
> I'm changing my vote and recommending we move this ticket to a future  
> release (2.0) and intend to implement a fully correct solution.
>
> Given that there is a workaround for 1.3, I don't want to cause any  
> regression for people that have implemented workarounds that depend on the  
> behavior of 1.3. Especially since the proposed fix here is not a full fix  
> and will still require workaround.
>
> Can I get votes on this recommendation?

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


[piccolo2d-dev] Re: Issue 181 in piccolo2d: PNode.toImage is not centered and can create cropped images for PNodes with non-integral (x,y) bounds

2011-03-20 Thread piccolo2d


Comment #15 on issue 181 by atdi...@gmail.com: 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

I'm changing my vote and recommending we move this ticket to a future  
release (2.0) and intend to implement a fully correct solution.


Given that there is a workaround for 1.3, I don't want to cause any  
regression for people that have implemented workarounds that depend on the  
behavior of 1.3. Especially since the proposed fix here is not a full fix  
and will still require workaround.


Can I get votes on this recommendation?

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


[piccolo2d-dev] Re: Issue 181 in piccolo2d: PNode.toImage is not centered and can create cropped images for PNodes with non-integral (x,y) bounds

2011-03-20 Thread piccolo2d


Comment #14 on issue 181 by atdi...@gmail.com: 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

I'm changing my vote and recommending we move this ticket to a future  
release (2.0) and intend to implement a fully correct solution.


Given that there is a workaround for 1.3, I don't want to cause any  
regression for people that have implemented workarounds that depend on the  
behavior of 1.3. Especially since the proposed fix here is not a full fix  
and will still require workaround.


Can I get votes on this recommendation?

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


[piccolo2d-dev] Re: Issue 181 in piccolo2d: PNode.toImage is not centered and can create cropped images for PNodes with non-integral (x,y) bounds

2011-03-06 Thread piccolo2d


Comment #13 on issue 181 by atdi...@gmail.com: 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

Ah, I see, so make me a +0.5.

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


[piccolo2d-dev] Re: Issue 181 in piccolo2d: PNode.toImage is not centered and can create cropped images for PNodes with non-integral (x,y) bounds

2011-03-05 Thread piccolo2d


Comment #12 on issue 181 by heue...@gmail.com: 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

I'm +0, see

Expressing Votes: +1, 0, -1, and Fractions
http://www.apache.org/foundation/voting.html

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


[piccolo2d-dev] Re: Issue 181 in piccolo2d: PNode.toImage is not centered and can create cropped images for PNodes with non-integral (x,y) bounds

2011-03-05 Thread piccolo2d


Comment #11 on issue 181 by atdi...@gmail.com: 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

Michael, Are you +0, or +1? :)

Yes, I would think is should apply to print(...), too.

Is the compatibility concern that reids expressed significant?



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


[piccolo2d-dev] Re: Issue 181 in piccolo2d: PNode.toImage is not centered and can create cropped images for PNodes with non-integral (x,y) bounds

2011-03-02 Thread piccolo2d


Comment #10 on issue 181 by heue...@gmail.com: 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

I'm +0.

If we apply the fix, should it also be applied to PNode.print(Graphics,  
PageFormat, int) ?


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


[piccolo2d-dev] Re: Issue 181 in piccolo2d: PNode.toImage is not centered and can create cropped images for PNodes with non-integral (x,y) bounds

2011-03-01 Thread piccolo2d


Comment #9 on issue 181 by atdi...@gmail.com: 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

Allain, I'll +1 to that.

As for solving the anti-aliasing size problem... this is just an  
off-the-cuff idea, but if there's not a way to predetermine the  
anti-aliasing size increase, maybe oversizing the image at first and then  
doing something like an "auto-crop" a la Photoshop would work?


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


[piccolo2d-dev] Re: Issue 181 in piccolo2d: PNode.toImage is not centered and can create cropped images for PNodes with non-integral (x,y) bounds

2011-03-01 Thread piccolo2d


Comment #8 on issue 181 by allain.lalonde: 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

Can we assume that the patch proposed in comment #3 is a step in the right  
direction? That is is better than the current behaviour, though obviously  
not a complete solution?


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


[piccolo2d-dev] Re: Issue 181 in piccolo2d: PNode.toImage is not centered and can create cropped images for PNodes with non-integral (x,y) bounds

2010-12-21 Thread piccolo2d

Updates:
Labels: Milestone-1.3.1

Comment #7 on issue 181 by heue...@gmail.com: 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

(No comment was entered for this change.)

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


[piccolo2d-dev] Re: Issue 181 in piccolo2d: PNode.toImage is not centered and can create cropped images for PNodes with non-integral (x,y) bounds

2010-07-19 Thread piccolo2d


Comment #5 on issue 181 by heue...@gmail.com: 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

I have also noticed this problem.  As a workaround, I usually add the  
padding when calculating an image size and then use the  
PNode.toImage(BufferedImage, Paint) method.


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


[piccolo2d-dev] Re: Issue 181 in piccolo2d: PNode.toImage is not centered and can create cropped images for PNodes with non-integral (x,y) bounds

2010-07-14 Thread piccolo2d


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


[piccolo2d-dev] Re: Issue 181 in piccolo2d: PNode.toImage is not centered and can create cropped images for PNodes with non-integral (x,y) bounds

2010-07-12 Thread piccolo2d


Comment #3 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

I isolated the problem and identified a potential solution. The problem was  
being caused around line 2845 in PNode, where the node bounds is expanded  
to integer dimensions for rendering to a buffered image. Only the width and  
height should be rounded to integer, but the x and y are also being  
rounded. This is problematic because (for the node defined in  
TestPPathToImage) the node bounds are (x,y,w,h) = (-2.5,-2.5,105,105), so  
this is rounded to (-3,-3,105,105), so instead of setting the pnode to  
appear at the origin, it is off by (0.5,0.5). I tried solving this problem  
by expanding only the (w,h) to be integer, and letting the (x,y) remain  
floating. This yielded the correct behavior; see attached file  
TestPPathToImage-fixed.png.  Here's a minimal patch that resolves the  
problem:


Index: 
../../../../workingcopy/piccolo2d.java/core/src/main/java/org/piccolo2d/PNode.java
===
--- ../../../../workingcopy/piccolo2d.java/core/src/main/java/org/piccolo2d/PNode.java	 
(revision  
1020)
+++ ../../../../workingcopy/piccolo2d.java/core/src/main/java/org/piccolo2d/PNode.java	 
(revision  
)

@@ -2854,7 +2854,7 @@
 g2.setClip(0, 0, imageWidth, imageHeight);

 final PBounds nodeBounds = getFullBounds();
-nodeBounds.expandNearestIntegerDimensions();
+ 
nodeBounds.setSize(Math.ceil(nodeBounds.getWidth()),Math.ceil(nodeBounds.getHeight()));


 final double nodeWidth = nodeBounds.getWidth();
 final double nodeHeight = nodeBounds.getHeight();

I haven't tested the behavior outside of TestPPathToImage, and I'm not sure  
how many incompatibilities this fix will cause in existing programs.  For  
instance, applications may be working around this problem currently, and  
may obtain the wrong behavior after this is fixed in piccolo.


Attachments:
TestPPathToImage-fixed.png  1.7 KB

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


[piccolo2d-dev] Re: Issue 181 in piccolo2d: PNode.toImage is not centered and can create cropped images for PNodes with non-integral (x,y) bounds

2010-07-12 Thread piccolo2d


Comment #2 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

Here is the test case program and resultant output image file.


Attachments:
TestPPathToImage.java  1.9 KB
TestPPathToImage.png  1.7 KB

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


[piccolo2d-dev] Re: Issue 181 in piccolo2d: PNode.toImage is not centered and can create cropped images for PNodes with non-integral (x,y) bounds

2010-07-12 Thread piccolo2d


Comment #1 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

Here is the test case program and resultant output image file.

Attachments:
TestPPathToImage.java  1.9 KB
TestPPathToImage.png  1.7 KB

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