Re: [Q] Convert PixMapHandle to NSBitmapImageRep
Re: [Q] Convert PixMapHandle to NSBitmapImageRep
- Subject: Re: [Q] Convert PixMapHandle to NSBitmapImageRep
- From: Quincey Morris <email@hidden>
- Date: Tue, 24 Mar 2009 15:04:07 -0700
On Mar 24, 2009, at 14:48, Eric Gorr wrote:
While I should be able to use:
- (id)initWithBitmapDataPlanes:(unsigned char **)planes pixelsWide:
(NSInteger)widthpixelsHigh:(NSInteger)height bitsPerSample:
(NSInteger)bps samplesPerPixel:(NSInteger)spphasAlpha:(BOOL)alpha
isPlanar:(BOOL)isPlanar colorSpaceName:(NSString
*)colorSpaceNamebitmapFormat:(NSBitmapFormat)bitmapFormat
bytesPerRow:(NSInteger)rowBytesbitsPerPixel:(NSInteger)pixelBits
and pass in the appropriate values from my PixMapHandle, I was
hoping that
PixMapHandle previewPixMap = GetGWorldPixMap( previewGWorld );
LockPixels( previewPixMap );
[NSBitmapImageRep imageRepWithData:[NSData
dataWithBytes:*previewPixMap
length:GetHandleSize( (Handle)previewPixMap )]];
UnlockPixels( previewPixMap );
would have worked, but it doesn't (wasn't really expecting it to).
Before I went ahead and use the init method, I wanted to find it if
there was something simple that I was missing.
Yes. 'imageRepWithData' is expects the data to be an image in a known
format (TIFF, JPEG, PNG, PICT, etc). All you have is a pixel array, so
of course you're going to have to specify the pixel format and all the
other stuff in the 'init...' method.
_______________________________________________
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