Re: Crop an image in memory
Re: Crop an image in memory
- Subject: Re: Crop an image in memory
- From: Greg Titus <email@hidden>
- Date: Fri, 3 Jan 2003 18:55:24 -0800
On Friday, January 3, 2003, at 10:34 AM, Giovanni Donelli wrote:
Happy new years Gurus!
I have an NSImage suppose 200x200px when I set its size to 40x40px in
memory the image has the same size in fact I can resize it again and
get back the original quality...
How do I really RESIZE the image so that the memory is also freed ???
I guess there's a flag somewhere to set...
Actually, no, you'll have to make a new image and composite the
existing image into it, like so:
NSImage *newImage;
newImage = [[NSImage alloc] initWithSize:NSMakeSize(40, 40)];
[newImage lockFocus];
[oldImage compositeToPoint:NSZeroPoint fromRect:NSMakeRect(0, 0, 200,
200) operation:NSCompositeCopy];
[newImage unlockFocus];
Then you can get rid of the old image, if desired.
Hope this helps,
- Greg
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.