Re: Interleaved (interwoven) raw images
Re: Interleaved (interwoven) raw images
- Subject: Re: Interleaved (interwoven) raw images
- From: Raphael Sebbe <email@hidden>
- Date: Thu, 16 Aug 2001 20:00:40 +0200
Well, you don't absolutely need to convert your image to planar data.
NSBitmapImageRep can handle interleaved representations :
unsigned char *bd = /* points to the first 24 bits pixel */;
_tiedRep = rep = [[NSBitmapImageRep alloc]
initWithBitmapDataPlanes:&bd
pixelsWide:width pixelsHigh:height bitsPerSample:8
samplesPerPixel:3
hasAlpha:NO isPlanar:NO
colorSpaceName:NSCalibratedRGBColorSpace
bytesPerRow:width*3 bitsPerPixel:24];
Remark : be careful with the first arg -> it is a char **, so that it
can handle planar data... For non-planar data, pass it the *address* of
the pointer to the first pixel.
Raphael
On Thursday, August 16, 2001, at 07:15 PM, Bertrand Mansion wrote:
Hi,
I am trying to display an image from a file. This image is in raw
format,
RGB, 3 channels, no Alpha. I managed to display it using
NSBitmapImageRep
initWithPlanes but the result is strange : it comes as 9 grey images
instead
of just one. I have identified that this is because the raw data are
interleaved (or interwoven). I know I need to set isPlanar to YES and
WithPlanes to an array.
As I am new to C, I have no idea on how to put these data into 3
different
planes. I suppose I need to create an array and parse the content of my
NSData into 3 different pointers in this array. But how do we do it ?
If someone could only give me an example, it would be great as I am the
kind
of people who learn better with examples... ;-)
Thank you
Bertrand Mansion
Mamasam
_______________________________________________
cocoa-dev mailing list
email@hidden
http://www.lists.apple.com/mailman/listinfo/cocoa-dev