Re: BitMap data format and autorelease
Re: BitMap data format and autorelease
- Subject: Re: BitMap data format and autorelease
- From: Trygve Inda <email@hidden>
- Date: Wed, 12 Mar 2008 19:01:13 +0000
- Thread-topic: BitMap data format and autorelease
> Then you definitely want to create your own NSBitmapImageRep — the
> init method will give you total control over the pixel format. Then
> you can lockFocus and draw whatever you want into it.
So I have created this:
imageRep = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL
pixelsWide:width
pixelsHigh:height
bitsPerSample:8
samplesPerPixel:4
hasAlpha:YES
isPlanar:NO
colorSpaceName:NSDeviceRGBColorSpace
bitmapFormat:NSAlphaFirstBitmapFormat
bytesPerRow:width * 4
bitsPerPixel:32];
baseAddr = [imageRep bitmapData];
So I have a pixel buffer... Now I need to:
(1) draw an NSImage into this bitmap... Without making a copy of the data
because after the image is drawn on my bitmap I will do a bunch of direct
pixel manipulation on it (from baseAddr), then I need to
(2) draw some semi-opaque text over the bitmap and finally
(3) save it as a new jpg.
Any help is appreciated... I am coming from a Gworld/QuickDraw background so
this is all a lot to absorb!
Thanks,
Trygve
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden