• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Interleaved (interwoven) raw images
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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 ?


  • Follow-Ups:
    • Re: Interleaved (interwoven) raw images
      • From: Raphael Sebbe <email@hidden>
  • Prev by Date: Re: Online C++ resources?
  • Next by Date: a simple program
  • Previous by thread: Re: Interleaved (interwoven) raw images
  • Next by thread: Re: Interleaved (interwoven) raw images
  • Index(es):
    • Date
    • Thread