Article View: borland.public.jbuilder.java.swing
Article #8917Re: Rotate Image
From: JPBallet
Date: Tue, 27 Jun 2000 00:00
Date: Tue, 27 Jun 2000 00:00
39 lines
1597 bytes
1597 bytes
Sorry but this don't work with image. i hav a Debugraphics exception.
Steve Horsley a οΏ½crit dans le message <39586810.D1A762EE@cwcom.co.uk>...
>I have not done this with an image, but have done similar with text.
>Give it a try:
>
>public void paint(Graphics g) {
>
> // we need the extended graphics features, I think...
> Graphics2D g2 = (Graphics2D) g;
>
> // Assume I have an image that is 100 x 100
> // Move the origin to the middle of the picture
> // in reality, you will have to move to one corner, but I forget
>which
> g2.translate(50, 50);
>
> // rotate the drawing mechanism about the origin
> g2.rotate(Math.PI / 2);
>
> // draw the image
> g2.drawImage(myImage);
>
> // de-rotate and de-translate the paper
> g2.rotate(-Math.PI / 2);
> g2.translate(-50, -50);
>}
>
>Steve.
>
>JPBallet wrote:
>>
>> Hello,
>> who can help me?
>> i wish rotate (PI/2) an image (gif) into a JPanel application.
>> but all don't work very well.
>> Could you describe me step by step how can to do this?
>> Thank
>> JP Ballet.
Technical Details
Message-ID:
<8j9s77$ifp7@bornews.borland.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<8j9gmh$d9q13@bornews.borland.com> <39586810.D1A762EE@cwcom.co.uk>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII X-Google-Thread: 111d45,ef6b50d79cf9fa21 X-Google-Attributes: gid111d45,public From: "JPBallet" <jean-pierre.ballet@meteo.fr> Subject: Re: Rotate Image Date: 2000/06/27 Message-ID: <8j9s77$ifp7@bornews.borland.com> X-Deja-AN: 639487654 References: <8j9gmh$d9q13@bornews.borland.com> <39586810.D1A762EE@cwcom.co.uk> Organization: METEO-FRANCE X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 Newsgroups: borland.public.jbuilder.java.swing