On Fri, 24 Aug 2001, Ted Hill wrote:

> I don't believe that the Java 2D API has a resolution independent mapping
> mode.
>
> In order to ensure that your on-screen graphics have the size that you want,
> I think you can use
>
> Toolkit.getScreenResolution()
>
> to get the current number of pixels per inch, then adjust your pixel
> measurements accordingly.
>
> Ted Hill



I played around with my screen resolution and an app that has this
in its paintComponent() method:

     GraphicsConfiguration gc = this.getGraphicsConfiguration();
     Toolkit tk = Toolkit.getDefaultToolkit();

     System.out.println( "## default trans: " + gc.getDefaultTransform() );
     System.out.println( "## normal trans: " + gc.getNormalizingTransform() );
     System.out.println( "## screen res: " + tk.getScreenResolution() );

I get

  ## default trans: AffineTransform[[1.0, 0.0, 0.0], [0.0, 1.0, 0.0]]
  ## normal trans: AffineTransform[[1.0, 0.0, 0.0], [0.0, 1.0, 0.0]]
  ## screen res: 96

regardless of my resolution settings.

I'm not sure what you can do.

-David


>
> ----- Original Message -----
> From: "Tacci, Florence" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Friday, August 24, 2001 11:06 AM
> Subject: [JAVA2D] User space - device space conversion
>
>
> >         Hi everyone,
> >
> > In the Java 2D API Graphics (Sun microsystems press) book, I have read and
> > understood (perhaps misunderstood) the conversion from user and device
> > spaces is resolution independent, and if I draw a line of 1 cm (or
> whatever
> > the unit is), changing the output device, and so the resolution, will
> change
> > the number of used pixels but not the actual size in units (it should stay
> > 1, approximatively).
> > In the case I decrease my screen resolution, (so I am not in the situation
> > described in the book, because I keep the same device with a different
> > resolution) the line drawn looks longer. My problem is that I would like
> my
> > application to be independent of the screen resolution and even more, to
> > represent the object at the same size on the screen, whatever its
> resolution
> > is. I have tried to use the normalizing transform, like described in API :
> > GraphicsConfiguration gc = g.getDeviceConfiguration();
> > g.setTransform(gc.getDefaultTransform());
> > g.transform(gc.getNormalizingTransform());
> >
> > but when changing my screen resolution, the graphic object size is
> modified.
> > Is there a way of keeping an element size on any screen ?
> >
> > Thanks for your help,
> >
> > Florence
> >
> > PS: I am working on NT4.0, with jdk1.3.
> >


-----------------------------------------------------
David Eisner            | E-mail: [EMAIL PROTECTED] |
CALCE EPSC              | Phone:  301-405-5341       |
University of Maryland  | Fax:    301-314-9269       |
-----------------------------------------------------

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