Re: [JAVA2D] Problem with garbled screen repaints

2007-04-12 Thread java2d
I'm not sure whether this is the problem, but I may have a few minor pointers.

The rectangle into which you draw is probably not what you want.  You have your 
height and width sorted out properly, but not your origin, which should be 
(LEFT_MARGIN, TOP_MARGIN) rather than (0, 0), if I understand your intent 
correctly.

The 'null' parameter is your ImageObserver; it doesn't hurt to make the parent 
panel your observer so that new information can be sent properly.  Possibly 
this is your issue: the bottom-right pixels (the ones progressed lastly) aren't 
drawn properly because the information might never be made available.

All this would change your call to [i]Graphics2D.drawImage[/i] to:
[code]
int x = LEFT_MARGIN, y = TOP_MARGIN;
int width = getWidth()  - RIGHT_MARGIN - LEFT_MARGIN:
int height = getHeight() - TOP_MARGIN   - BOTTOM_MARGIN;
canvas.drawImage(image, x, y, width, height, this);
[/code]
Hope this helps.
[Message sent by forum member 'tarbo' (tarbo)]

http://forums.java.net/jive/thread.jspa?messageID=212048

===
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message signoff JAVA2D-INTEREST.  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message help.


Re: [JAVA2D] Retiring the package com.sun.image.codec.jpeg

2007-04-12 Thread java2d
My results are 18,250ms for ImageIO and 15,172 for JpegEncode.
I will try to make a more thorough test and will try JAI.
Thank,
Carl
[Message sent by forum member 'carcour' (carcour)]

http://forums.java.net/jive/thread.jspa?messageID=212065

===
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message signoff JAVA2D-INTEREST.  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message help.


[JAVA2D] Filtered subsampling

2007-04-12 Thread Chris Nokleberg

[I sent this earlier to [EMAIL PROTECTED] but it didn't show up
anywhere AFAICT]

I read Chris Campbell's article on image scaling the other day:
http://today.java.net/pub/a/today/2007/04/03/perils-of-image-getscaledinstance.html

In the comments Chris mentioned that for very large images it is
better to first use ImageIO subsampling to reduce the image first, and
then use traditional scaling methods to reduce it further.

In my own applications I use subsampling quite heavily (we often have
5000x5000 images which only need to be 100x100 on the screen). The
problem has always been that the subsampling in ImageIO is really
crude--it actually just picks out every Nth column/row and tosses all
the rest. After reading much too much about sampling theory it was
revealed that the solution is to use a low pass filter on the original
image before downscaling, for example a Gaussian blur. If you combine
this with the subsampling algorithm it isn't even terribly expensive,
because you only have to calculate the blur for each of the output
pixels.

This inspired me to add this feature to my PNG decoder library
(http://javapng.sf.net/). To subsample every 4th row/column the sample
code would be something like:

 PngConfig config = new PngConfig.Builder()
   .sourceSubsampling(4, 4, 0, 0)
   .lowPassFilter(true)
   .build();
 BufferedImage image = new PngImage(config).read(new File(test.png));

I've tested the result on the demo image from Chris' article and the
result is on par with the best of the scaling algorithms shown there
(arguably better).

Now, besides being an infomercial the real reason for this message is
to plead for a similar feature in ImageIO, if only for JPEG images. I
just don't have it in me to write a JPEG decoder too :-) Maybe there
is already a third-party library that does this? Does a RFE have any
chance?

Chris

p.s. In case anyone is listening the bugs I reported in the PNG
metadata spec are now over five years old:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4518989

===
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message signoff JAVA2D-INTEREST.  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message help.


Re: [JAVA2D] Java 2D Enhancements in JDK 6 and JDK 7

2007-04-12 Thread java2d
Hi Chet,
  from Chris's blog, I know what you mean Single Threaded Rendering (STR). 
And I have learned many Java 2D knowledges from your blog, thanks!
[Message sent by forum member 'ylzhao' (ylzhao)]

http://forums.java.net/jive/thread.jspa?messageID=212216

===
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message signoff JAVA2D-INTEREST.  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message help.