discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Please help with image rotation and scaling.


From: Alexander Malmberg
Subject: Re: Please help with image rotation and scaling.
Date: Mon, 19 May 2003 18:32:36 +0200

Tima Vaisburd wrote:
> 
> Hello everybody,
> 
> I'm learning Objective C and gnustep.
> 
> I could not figure out how can I rotate an image in gnustep.
> 
> As far as I can get, Apple documentation suggects using
> NSAffineTransform and -drawAtPoint: fromRect: operation: fraction
> inside -drawRect method of the view, like this:

In OpenStep, the NSImage methods do not handle any non-identity
transformations since they work by drawing to off-screen windows and
compositing from them. To draw a rotated image, get a non-cached image
representation for it (probably the only one) and use [NSImageRep
-drawInRect:].

[snip]
>     [_image lockFocus];
...
>     [_image unlockFocus];

Note that these mean that you're drawing _to_ the image, which probably
isn't what you want.
[snip]

> Also, what is the correct way to scale the image?

Scale the ctm ([drawXform scaleXBy: yBy:]), or pass in a suitable rect
to -drawInRect:.

- Alexander Malmberg




reply via email to

[Prev in Thread] Current Thread [Next in Thread]