"Douglas Handy" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > My first choice would have been to use WinCreateBitmapWindow() and pass it the > bitmap type pointer, because then it creates the window with the same depth as > the bitmap. But it doesn't accept a compressed bitmap, so defeats my purpose. > > WinCreateOffScreenWindow() creates a window in the current depth, which for a > non-color device won't be what I need either. So how do I go about creating a > color window to contain the bitmap (on a non-color device)?
1. Use BmpGetBitDepth() to get the depth of the 'Tbmp' resource. 2. Use BmpCreate to create a new bitmap on the dynamic heap with the width, height, and depth parameters you need. 3. Use WinCreateBitmapWindow() on this new bitmap to turn it into a window you can draw into. 4. Set the new window as the draw window and draw the 'Tbmp' resource into it. This will automatically uncompress the 'Tbmp' resource. 5. Use WinGetPixel() on the new window to access individual pixel color information. > I am still curious though why BmpCompress() is giving me a parameter error when > I attempt to decompress a bitmap moved to the dynamic heap. So am I, but I've found that bitmap handling in PalmOS is kind of a tempermental beast not easily placated. On a side note, if you plan to access the bitmap pixels directly without using the WinGetPixel() API call, you will need to do things a little differently. In pre-OS5 versions of PalmOS it was no problem to simply do a BmpGetBits() on the bitmap to get the location of the actual pixel data and use pointer arithmetic to access individual pixels much faster than WinGetPixel(). This will not work in OS5 due to the fact that a bitmap created with BmpCreate lives behind the PACE layer, and using this method will give you unpredictable results. To get around this, you will have to create your new bitmap manually using the examples given in the knowledge base article I referenced in a previous reply. This way the bitmap will live in front of the PACE layer and you can access the pixel information directly. Hope this helps! -Robert -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
