You can do something like this:
AffineTransform savedTransform = g.getTransform();
g.transform(_transform);
if (_ellipse != null) {
g.paint(_ellipse);
}
g.setTransform(savedTransform);
where _transform is local to each particular
ellipse.
JohnR
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Hugo A.
Garcia
Sent: Wednesday, February 10, 1999 3:35 PM
To: Vincent J Hardy
Cc: [EMAIL PROTECTED]
Subject: Re: [java2d] Affine Transform and Shapes on JPanel
yeah, i tried this and ran into a casting error. wrong appoach from my
end. i will try again.
Lets say I am drawing
multiple Ellipses. Only one is selected with the mouse and moved. I
thought I could apply an AffineTransform to only that shape but changing
the Grhapics2D tranfrom changes all the ellipses. I
would like to be able to switch from one AffineTransform to another as I
render each ellipse. I tried using setTranslate and then setIdentity, not.
I think my problem is that I haven't figured out how to not touch the
AffineTransform that is attached to the Graphics2D instance so that it
will not move everything on the panel.
On Wed, 10 Feb 1999, Vincent J Hardy wrote:
> Hugo,
>
> May be you can use AffineTransform.createTransformedShape. However, this
will
> create a Shape object for each Shape and Transform combination. Depending
on the
> number of Shapes and transforms you have, it may or may not be a good
idea.
>
> V.
>
> "Hugo A. Garcia" wrote:
>
> > Hello
> >
> > I would like to render multiple shapes on a JPanel and apply different
> > Affinetransform to each one without affecting the Graphics2D context.
> >
> > -H
> >
> >
============================================================================
===
> > Hugo A. Garcia
> > Object Chemistry
> > New York
> >
============================================================================
===
> >
> > =====================================================================
> > To subscribe/unsubscribe, send mail to [EMAIL PROTECTED]
> > Java 2D Home Page: http://java.sun.com/products/java-media/2D/
>
> --
> +-----------------------------------------------------------+
> | Vincent Hardy [EMAIL PROTECTED] |
> | Java Architect Java Solution Center |
> | 650-470-2063 Menlo Park |
> +-----------------------------------------------------------+
>
>
>
============================================================================
===
Hugo A. Garcia
Object Chemistry
New York
============================================================================
===
=====================================================================
To subscribe/unsubscribe, send mail to [EMAIL PROTECTED]
Java 2D Home Page: http://java.sun.com/products/java-media/2D/
=====================================================================
To subscribe/unsubscribe, send mail to [EMAIL PROTECTED]
Java 2D Home Page: http://java.sun.com/products/java-media/2D/