This site is no longer active and is available for archival purposes only. Registration and login is disabled.

Blitting Bitmaps and General Bitmap loading in GAPI


Blitting Bitmaps and General Bitmap loading in GAPI

Postby DillRye » Apr 25, 2002 @ 7:37am

User avatar
DillRye
pm Insider
 
Posts: 477
Joined: Apr 25, 2002 @ 7:28am
Location: Iowa State University of Eng


Postby Dan East » Apr 25, 2002 @ 1:47pm

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
User avatar
Dan East
Site Admin
 
Posts: 5264
Joined: Jan 25, 2001 @ 5:19pm
Location: Virginia, USA


Postby Kzinti » Apr 25, 2002 @ 9:47pm

Kzinti
pm Member
 
Posts: 3238
Joined: Jan 13, 2002 @ 5:23am


Postby DillRye » Apr 25, 2002 @ 10:30pm

User avatar
DillRye
pm Insider
 
Posts: 477
Joined: Apr 25, 2002 @ 7:28am
Location: Iowa State University of Eng


Postby Kzinti » Apr 26, 2002 @ 2:28am

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
Kzinti
pm Member
 
Posts: 3238
Joined: Jan 13, 2002 @ 5:23am


Return to Windows Mobile


Sort


Forum Description

A discussion forum for mobile device developers on the Windows Mobile platform. Any platform specific topics are welcome.

Moderators:

Dan East, sponge, Digby, David Horn, Kevin Gelso, RICoder

Forum permissions

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

cron