• 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
Releasing question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Follow-Ups:
    • Re: Releasing question
      • From: "M. Uli Kusterer" <email@hidden>
  • Prev by Date: Re: CFRunLoop usage
  • Next by Date: OT Re: Responder problem [flagsChanged cmd keyUp solved]
  • Previous by thread: Re: NSString from Palm text?
  • Next by thread: Re: Releasing question
  • Index(es):
    • Date
    • Thread