Re: Converting any NSImageRep to a 16 bits NSImageRep
Re: Converting any NSImageRep to a 16 bits NSImageRep
- Subject: Re: Converting any NSImageRep to a 16 bits NSImageRep
- From: Nicko van Someren <email@hidden>
- Date: Fri, 5 Aug 2005 15:33:36 +0100
On 5 Aug 2005, at 06:03, Arthur VIGAN wrote:
I am currently working on an image processing software, and I would
like to work with 16 bits NSImageReps. Is there a "good" or
prefered way to convert any NSImageRep to a 16 bits NSImageRep?
If you allocate an NSBitmapImageRep you can call -
initWithBitmapDataPlanes:... with a NULL pointer for the data
planes. In this case the documentation say:
"If planes is NULL or an array of NULL pointers, this method
allocates enough memory to hold the image described by the other
arguments. You can then obtain pointers to this memory (with the
getPixel:atX:y: or bitmapData method) and fill in the image data. In
this case, the allocated memory will belong to the object and will be
freed when it’s freed."
So you can specify whatever colour depth, pixel packing and other
parameters you want and then just lock the focus onto the new image
and draw whatever you like into the image. I'm not sure if you're
after 16 bits per pixel of 16 bits per plane (48bpp) but this should
let you do either.
Cheers,
Nicko
_______________________________________________
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