• 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
Re: NSImage from Palm Bitmap?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Prev by Date: Re: general questions (another noob)
  • Next by Date: Re: Techniques for thread communication
  • Previous by thread: Re: NSImage from Palm Bitmap?
  • Next by thread: Dragging to select rectangle
  • Index(es):
    • Date
    • Thread