|
Re: why a translate method is used twice? [message #639040 is a reply to message #639038] |
Mon, 15 November 2010 01:02 |
Ed Merks Messages: 33142 Registered: July 2009 |
Senior Member |
|
|
Tom,
Comments below.
tom wrote:
> GC gc = e.gc;
> gc.setAdvanced(true);
>
> Bounds b = image.getBounds();
>
> Transform transform = new Transform(display);
> // The rotation point is the center of the image
> transform.translate(50 + b.width/2, 50 + b.height/2);
> // Rotate
> transform.rotate(45);
> // Back to the orginal coordinate system
> transform.translate(-50 - b.width/2, -50 - b.height/2);
> gc.setTransform(transform);
> gc.drawImage(image, 50, 50);
> transform.dispose();
>
> above the code, a translate method is used twice . why is it used twice??
Think of how differently a rotation would behave for a circle if that
circle where at the origin (nothing would change) verses if it's not at
the origin (it would actually rotate around the original).
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.03568 seconds