Michael is right. Anyway, coding a ZUI is not the easiest thing to do especially if you want to do it right from A to Z. Unless you really have time to code it yourself, or unless you have very specific problems to deal with that are not addressed by existing ZUI toolkits, I would strongly recommend using one of the existing open source libraries for providing a zooming framework to you application, no matter whether it is ZVTM [1], Piccolo (formerly known as Jazz [2]) or anything else.
[1] http://zvtm.sourceforge.net [2] http://www.cs.umd.edu/hcil/jazz/
These will provide you with easy methods to manage your ZUI, taking care of low-level graphics operation for you (applying appropriate affine transforms on the right objects, doing specific clipping to enhance performances, etc.). They are especially useful if your application is not just a viewer but an editor.
Emmanuel
Jim Graham wrote:
Hi Michael,
Yes, I guess you do apply *a* transform to *a* graphics object before you get to the code that draws the text, but it's the wrong graphics object that you apply the scale to.
You are scaling the graphics object that is passed to your paint method - the one that you subsequently hand off to your children. But, the only thing that graphics object is used for when your code is run in its default "buffered" mode is to execute a call to drawImage - thus the only thing it gets a chance to scale are the pixels that have been put into that BufferedImage. But the pixels you placed in that BufferedImage were placed there by a different Graphics object (called "bufferedGraphics" in your example code). This "bufferedGraphics" object never has a scale applied to it so it is rendering the text at a default 1:1 coordinate mapping.
The net result is that the BufferedImage ends up containing pixels representing unzoomed text and you render the pixels of that BufferedImage to the screen via a zoomed (i.e. scaled) Graphics object - thus you get "pixelated" zooming.
What Phil and Emmanuel have been trying to tell you is that you need to have applied a scale to the same graphics object that you execute the "drawString" call on in order to have the text scaled smoothly. You need to draw the text into the BufferedImage using a graphics object that has a zoom applied to it and then copy it to the output graphics with the default (unzoomed) transform.
...jim
-- Emmanuel Pietriga ([EMAIL PROTECTED]) tel (mobile): +33 6 88 51 94 98 http://claribole.net
=========================================================================== 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".
