Hi,

I was waiting to see if someone with more experience with Java2D would
respond to this, but since no one has, here's what I think.

On Wednesday, February 26, 2003, at 11:57 AM, Eric Kolotyluk wrote:
While reading Lawrence Rodriques' book `Building Imaging Applications
with Java Technology,' on page 261 he says "If you need better
resolution, you can perform the scale operation on the Graphics
context."

I'm not sure what he means by better resolution in this context, but

I am not familiar with the book, but it seems likely to me that he is referring to rendering vector graphics to a raster context. If you apply a scale to the Graphics2D object before drawing on it, everything will get proportionally more pixels in the output. More pixels equals better resolution of sloped lines and curves.

To put it another way, the continuous media of the vector graphics
objects will be sampled at a higher rate, resulting in a smoother
approximation.

it's got me thinking about the difference between transforms like

   Graphics2D g;
   AffineTransform t;
   BufferedImage b;

   a)
       g.scale(2.0, 2.0);
       g.drawImage(b, 0, 0, null);

   b)
       t.scale(2.0, 2.0);
       g.drawImage(b, t, null);

Are (a) and (b) equal in performance and quality (aside from which
space
operations are happening in)? Sometimes it's more convenient to think
in
one space or the other, but are there any other reason to use one
method
over the other (or combinations of the two)? This is particularly
important in print() methods where far more rendering is performed,
especially with high quality large images on large printers.

I think that the process will be indistinguishable for the specific example you've given. However, when there is more than one object being drawn (be they images or Rectangles, or whatever), it seems to me that (a) would/could outperform (b). This is because the matrix multiplication for the scale transform only has to happen once (when the composite is scaled), instead of once per object (when each object is scaled to fit on a larger canvas). I don't know in what contexts (if any) this would be a noticeable difference. It seems like it could be dependent on the particular Java2D implementation, too.

Rhett

--
Rhett Sutphin
Research Assistant (Software)
Coordinated Laboratory for Computational Genomics
  and the Center for Macular Degeneration
University of Iowa - Iowa City, IA 52242 - USA
4111 MEBRF - email: [EMAIL PROTECTED]

===========================================================================
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".

Reply via email to