NSImage from Palm Bitmap?
NSImage from Palm Bitmap?
- Subject: NSImage from Palm Bitmap?
- From: Dave Riggle <email@hidden>
- Date: Sun, 31 Aug 2003 16:23:36 -0700
Anybody know how to create an NSImage from a Palm Bitmap? I tried the
following, but it doesn't work.
NSImage *PalmBitmapToNSImage(NSData *palmBmp)
{
PalmBitmapTypeV2_16 *bmp = (PalmBitmapTypeV2_16 *) [palmBmp bytes];
unsigned char *bits = (unsigned char *) bmp +
sizeof(PalmBitmapTypeV2_16);
NSImage* image;
NSBitmapImageRep *bitmap;
bitmap = [[NSBitmapImageRep alloc]
initWithBitmapDataPlanes: &bits
pixelsWide: bmp->width pixelsHigh: bmp->height
bitsPerSample: 5 samplesPerPixel: 3
hasAlpha: NO isPlanar: NO
colorSpaceName: NSCalibratedRGBColorSpace
bytesPerRow: bmp->rowBytes bitsPerPixel:
bmp->pixelSize];
image = [[NSImage alloc] initWithSize:NSMakeSize(bmp->width,
bmp->height)];
[image addRepresentation:bitmap];
[bitmap release];
return image;
}
The Palm bitmap I want to load is in 16 bit RGB565 format.
Dave
_______________________________________________
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.