Graphics transforms
- From: "visionset" <spam@xxxxxxxxxxxx>
- Date: Mon, 19 Mar 2007 18:45:00 GMT
I'm drawing a Rectangle somewhere on a Graphics object over an image and
rotating it some degrees about its centre.
I now want to use that rectangle to describe the part of the image I want to
grab.
To grab it I'm stuffing it in a BufferedImage by drawing on its Graphics
like so:
// rect is a Shape
// origin is the min x & min y of the rectangle
Point centre = rect.getCentre();
g2.rotate(-rect.getTheta(), centre.x, centre.y);
Point orig = rect.getOrigin();
g2.translate(-orig.x, -orig.y);
g2.setClip(rect);
renderTiles(g2);
The rotation works fine. But I can't figure out the translation to get it
back to 0,0
Any clues folks?
TIA
--
Mike W
.
- Follow-Ups:
- Re: Graphics transforms
- From: Daniel Pitts
- Re: Graphics transforms
- Prev by Date: Automatically resize font when component size changes?
- Next by Date: Re: Automatically resize font when component size changes?
- Previous by thread: Automatically resize font when component size changes?
- Next by thread: Re: Graphics transforms
- Index(es):
Relevant Pages
|
Loading