Releasing question
Releasing question
- Subject: Releasing question
- From: Damien Pacaud <email@hidden>
- Date: Thu, 9 Oct 2003 11:45:11 +0200
hi,
I am not sure about this one...
I allocate an unsigned char * for the size of an image.
Then i pass the adress of this pointer to NSBitmapImageRep via
initWithBitmapDataPlanes:
then, I allocate an NSImage and add the previousely created
representation to it.
My question is : since NSBitmapImageRep does'nt copy the data contained
in the unsigned char * , is this memory zone freed when I release the
imageRep or when I release the Image ?
or is is just not freed ?
Thanks for any answer ;)
here is the code :
NSBitmapImageRep *imageRep;
imageRep = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:
&mImagePixels
pixelsWide:
mImageWidth
pixelsHigh:
mImageHeight
bitsPerSample:
mImageBitsPerChannel
samplesPerPixel:
mImageBytesPerPixel
hasAlpha:
NO //we don't curently support nor need the ALPHA channel
isPlanar:
NO
colorSpaceName:
NSCalibratedWhiteColorSpace //colorspace for Grayscale
bytesPerRow:
mImageWidth * mImageBytesPerPixel
bitsPerPixel:
mImageBitsPerPixel];
NSImage* returnedImage = [[NSImage alloc]
initWithSize:NSMakeSize(mImageWidth, mImageHeight)]; //allocation of
the image to be returned
[returnedImage addRepresentation:imageRep];
[imageRep release];
Regards
Damien Pacaud
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.