PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

Blitting Bitmaps and General Bitmap loading in GAPI

Hello, I have been dabbeling with Direct X for a while now. I had hashed out a game that is modled after "slippy" on the TI calculator for Windows PC's. I am trying to port this over to the PocketPC, but im at a loss as to exactly the best way i should load/blit the bitmaps.

Should I use the built in bitmap loading functions? Can the built in blit functions be used, or should I create my own blit function? I know there are good libraries out there, but Id like to experience writing this for myself.

Another thing I have a question about, whats the best way to do page flipping? I have a few ideas, but was wondering what you guys think would be best.

It will be released for free, I expect it only to take me a day or two once i get the actual drawing/page flipping code down.

P.S. If theres any projects out there that need a graphics artist, I may be your man.
my webpage is www.drcreations.net
Unless your game is extremely trivial, and does not require full-screen updates at 30 FPS, then you can use the standard Windows API to render your game. Otherwise there is too much overhead using the system calls, which will grind your game to a halt.

The alternative is to use the Game API. Basically all this does is give you direct access to the display buffer, which eliminates all the Windows CE overhead. Most all Pocket PC displays use RGB 565 encoding, which is where the RGB color value is stored in 16 bits (2 bytes) using 5 bits for red, 6 for green and 5 for blue. Thus bitwise operators, like "shift", "or" and "and" are required to manipulate the color values. Blitting consists simply of copying memory around. You can use memcpy if your buffers are in alignment, otherwise you copy shorts (16 bit integers) manually.

So, you can handle all this yourself, or you can use one of the free 3rd party programming APIs such as EasyCE (see Phantom's Forum), PocketFrog or GapiTools, to handle some of the dirty work for you. They make it easier to support multiple devices by handling some of the hardware-specific issues for you (for example, the iPaqs display is really sideways, with the origin being the bottom left of the screen). All three of those APIs' forums are hosted here at Pocket Matrix.

Dan East
One of the nicest way of loading images is to use the "imgdecmp.dll" DLL. Here is some of the reasons I find it nice:

- It supports multiple formats (BMP, GIF, JPG, ...)
- It is included with all PocketPCs in ROM, meaning that 1) It's working and 2) memory footprint to use it is almost zero.

Here is some pointers:

http://www.microsoft.com/mobile/develop ... aphics.asp

http://www.conduits.com/ce/dev/imgdecmp.htm
Thank you, I think I will look into that graphics library that you suggested. I am also looking into the GapiDraw, but I still prefer to understand how these things work instead of totally relying on other people to write this stuff for me. If you have any other ideas please post them, I enjoy any input on this subject that I can get.
One of the problem with IMGDECMP.DLL is that it returns you a handle to a windows bitmap (HBITMAP). This means that if you want to access the actual pixels, you have to use a DIB. From what I remember, IMGDECMP.DLL actually returns a DIB, but there is no way (that I know?) to access the pixels on Windows CE. So basically, you use IMGDECMP.DLL to retrieve a bitmap handle, you create a DIB, then blit the bitmap to your DIB using a device context.

If you want to know how it's done, then I suggest you take a look at my PocketFrog library. All the source code is available. The code to load images using IMGDECMP.DLL is in file "image.cpp".

http://frog.flipcode.com