Re: NSImage from Palm Bitmap?
Re: NSImage from Palm Bitmap?
- Subject: Re: NSImage from Palm Bitmap?
- From: Florent Pillet <email@hidden>
- Date: Mon, 8 Sep 2003 10:43:18 +0200
Dave,
I have this conversion implemented in the PalmServices framework which
is part of the Palm constructor I'm developping. You can checkout the
code from
http://osx-palm-tools.sourceforge.net
And if you want to participate, don't hesitate. PalmServices is the
back-end to the constructor, I think I will make the front-end open
source too.
Florent.
On lundi, sep 1, 2003, at 01:23 Europe/Paris, Dave Riggle wrote:
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.
--
Florent Pillet, Code Segment email@hidden
Developer tools and end-user products for Palm OS & Mac OS X
ICQ: 117292463
http://perso.wanadoo.fr/fpillet
_______________________________________________
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.