Re: NSBitmapImageRep from file
Re: NSBitmapImageRep from file
- Subject: Re: NSBitmapImageRep from file
- From: Tommaso Pecorella <email@hidden>
- Date: Mon, 7 Jan 2002 00:10:30 +0100
At 13:36 -0800 6-01-2002, Matt Judy wrote:
Tommaso Pecorella wrote:
Hi, I have a problem.
I need to initialize a NSBitmapImageRep with the contents of a
(generic) image file.
Why not just use NSBitmapImageRep's initWithData: instead of
initWithBitmapDataPlanes:pixelsWide:pixelsHigh:bitsPerSample:samplesPerPixel:hasAlpha:isPlanar:colorSpaceName:bytesPerRow:bitsPerPixel:
... and then create your image from the image rep, instead of the
other way around.
NSImage *myimage;
[myImage addRepresentation:fooBitmapImageRep]
--Matt Judy
I should admit that the Apple docs are a little bit obscure to me.
My problem is that I _need_ a bitmap representation with that specs,
because I need to use the pixel colors to make a filtering effect. So
my code assume that the rgb values are in a given order and the alpha
channel isn't around. Moreover I need to scale the picture to a given
size (that may be different from the original one, even in h/w ratio).
In the NSImage, however, I can't assume any stucture... and I am a
newbie with representations.
Abusing of your courtesy, let me see if I am in the right way.
If I have a NSImage and a NSBitmapImageRep, I can add the
NSBitmapImageRep to the NSImage with the addRepresentation method and
this (magically) fills the NSBitmapImageRep data with the NSImage
image ?
If that's true, WHY Apple didn't say it in the help docs ?
Best regards, Tommaso ;-{))
--
--------------------------------------------------------------------------
Ing. Tommaso Pecorella
snail-mail: e-mail :
via del Pergolino 8/a
mailto:email@hidden
50139 Firenze - ITALY
RSA Key fingerprint = 232A D084 AD2F 7815 3D44 AFF0 AA52 A3AA
--------------------------------------------------------------------------