Re: Interleaved (interwoven) raw images
Re: Interleaved (interwoven) raw images
- Subject: Re: Interleaved (interwoven) raw images
- From: Bertrand Mansion <email@hidden>
- Date: Thu, 16 Aug 2001 20:40:35 +0200
Thank you Raphael but it didn't work.
>
unsigned char *bd = /* points to the first 24 bits pixel */;
What do you mean by 'points to the first 24 bits pixel' ?
I have declared bd like this :
unsigned char *bd;
bd = (void*)calloc(pixWide * pixHigh * pixelBytes,
sizeof(unsigned char));
Then, I fill an NSData object (imageData) with a file content like this:
imageData = [NSData dataWithContentsOfFile:pathTosource];
[imageData getBytes:bd];
>
_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];
What is _tiedRep compared to rep ?
Other than that, I use exactly the same arguments for this method in my own
code and it still displays 9 small grey images instead of a big colored one.
When I use a non-interwoven image instead, it works just fine. According to
me, NSBitmapImageRep can handle planar data if we provide it the good data
in &db. Which I don't think I am doing...
>
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.
Excuse my ignorance but what is a 'char **' ?
Thanks
Bertrand
>
On Thursday, August 16, 2001, at 07:15 PM, Bertrand Mansion wrote:
>
>
> 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 ?