Re: affine transformation of bitmap images
Re: affine transformation of bitmap images
- Subject: Re: affine transformation of bitmap images
- From: "Sean McBride" <email@hidden>
- Date: Thu, 24 Feb 2005 15:50:16 -0500
- Organization: Rogue Research
On 2005-02-16 15:28, Ricky Sharp said:
>> I have a bitmap image (a jpeg) and need to translate, rotate, and scale
>> it. I'm not so much interested in displaying the result onscreen
>> (except
>> for debugging). I've read up on NSImage and NSAffineTransform and it
>> seems to me that they are geared for display onscreen. What I'd really
>> like is to provide an NSBitmapImageRep and a transform matrix and get
>> back a new NSBitmapImageRep. Will I need to draw into some kind of
>> offscreen graphics context to do this? or use vImage?
>
>Just create an NSImage, lock focus on it, and draw. The transforms
>will be applied to the current context which will be the NSImage. At
>the end, unlock focus and then extract its representation.
I am just revisiting this issue. It seems that your suggestion does not
quite work. :( I create an NSImage, lock focus on it, concat the
transform matrix, and draw. The result is 'good' in the sense that I get
the image I want, and it displays correctly onscreen, but 'bad' because I
am unable to get the pixels themselves.
The problem is that after drawing into the new image, I call [newImg
representations] and there is only 1 representation and it's an
NSCachedImageRep, which does not respond to -bitmapData.
Any other ideas?
Again, I have an NSBitmapImageRep and an NSAffineTransform, and I want an
NSBitmapImageRep of the post-transformed image.
Thanks!
--
____________________________________________________________
Sean McBride, B. Eng email@hidden
Rogue Research www.rogue-research.com
Mac Software Developer Montréal, Québec, Canada
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden