Or could it be this? imageData = imageDataBase + (j*bytesPerRow); That works fine for 24 bit images.
Thanks, Donald "Donald C. Kirker" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Awesome! Just what I needed to help me with 8-bit bitmaps (and maybe lower). > > Right now I am using the color table that is in the bitmap (I need to add > mapping support though if the bitmap does not have a color table). > > I am using this to lookup the index on the table and output it: > grey = (*imageData++); > if (gotIndex) { > r = colors[grey].r >> 3; > g = colors[grey].g >> 2; > b = colors[grey].b >> 3; > *winData++ = (r<<11) + (g<<5) + b; > } else { > *winData++ = grey; > } > > It gets all of the correct mappings, but the first half of the image is a > big black chunk (but the second half is the full image sqeezed into the > second half of the destination. Does this half to do with the conversion > above, or some alignment? > > Thanks, > Donald > > "David Birdsall" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > 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/
