Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / November 2007

Tip: Looking for answers? Try searching our database.

Scaling more than one object when printing?

Thread view: 
Elliot - 15 Nov 2007 21:05 GMT
Hi all,

I'm using the following code to scale a jpg  that I've loaded off disk
in a Java application:

        Graphics2D g2d = (Graphics2D)g;
        g2d.translate(x0,y0 );
        g2d.scale( scaleFactor,scaleFactor );
        AffineTransform at = AffineTransform.getTranslateInstance(x0,y0);
        BufferedImage  bufImage = this.toBufferedImage(this.imgSource);
        g2d.drawRenderedImage(bufImage, at);

The image scales correctly as determined by "scaleFactor", however I
also have some rectangles on the same page and they are scaling as
well. How do I apply the transformation just to the image and not to
everything else on the page?

Thanks

Elliot
Hunter Gratzner - 15 Nov 2007 21:15 GMT
> I'm using the following code to scale a jpg  that I've loaded off disk
> in a Java application:
[quoted text clipped - 10 lines]
> well. How do I apply the transformation just to the image and not to
> everything else on the page?

Do the obvious. Either draw that other stuff before you scale, or
reset g2d to its original transformation after you have drawn the
image.
Elliot - 21 Nov 2007 14:50 GMT
> > I'm using the following code to scale a jpg  that I've loaded off disk
> > in a Java application:
[quoted text clipped - 14 lines]
> reset g2d to its original transformation after you have drawn the
> image.

Thanks for the ideas
Elliot


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.