Chinmaya,

You can roll your own BMP reading function(s) using the file format given here:

http://astronomy.swin.edu.au/~pbourke/dataformats/bmp/
http://www.javaworld.com/javatips/jw-javatip43_p.html

You'll have to convert 24-bit images to Palm OS's hi-colour (565) format to 
take each byte as a percentage of 0x3f (6 bits) or 0x1f (5 bits) and bit shift, 
like R = (((RGB >> 16) & 0xff) * 0x1f >> 8) and you may also have to map 8-bit 
BMP palettes to Palm's system palette (or some other palette) by calculating 
each colour's relative difference using a colour distance function given below:

http://www.compuphase.com/cmetric.htm

I think you can get the system palette using the function WinPalette. It says 
in the Palm OS developer docs: "You can attach a custom color table to a 
bitmap, and if you do, the bitmap is drawn using that color table. However, 
this is a performance drain." So palette mapping speeds things up a bit.

To speed up the colour mapping when you load an 8-bit image, you can create an 
index-lookup table, to map the BMP's palette indexes to indexes pointing to the 
closest matching colours in the target palette, using that colour distance 
function.

It's then a case of setting the data for the Palm Bitmap, using 
BmpGetBits(BitmapType*), casting the void* to UInt8* or UInt16* depending on 
the colour depth and setting the values.

A word of warning; if you attempt to use WinGetBitmap with 
WinCreateOffscreenWindow and nativeFormat, you may find your 565 data won't be 
in RGB format! I had a go on a Treo Sim and found it was in BGR (I think this 
is platform/device-specific)

Hope that helps you. It's a start at least, if nothing else.

Regards,
David

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Chinmaya
Sent: 20 January 2006 07:17
To: Palm Developer Forum
Subject: Bitmap format


Hi All Developers,

I have a lot of basic queries on PalmOS, as I want to know a lot on it.Palm 
developers please help me and tell me the best answers to my questions , so 
that my basic fundas on Palm will be clear. 
I will send queries one by one in Palm Forum site.

1. I have a question on BMP format, 
i.e.
"What's difference between Windows bitmap and  Palmos bitmap?"
If both are same then OK.
As I know, both are not same(Bcoz, palmos bmp size is different from windows 
bmp format.).
If both differ,then how palm converts the window bmp to a palm bmp ?

Thanks in Advance!.............
Regards,
Chinmaya
(India)


-- 
For information on using the PalmSource Developer Forums, or to unsubscribe, 
please see http://www.palmos.com/dev/support/forums/

-- 
For information on using the PalmSource Developer Forums, or to unsubscribe, 
please see http://www.palmos.com/dev/support/forums/

Reply via email to