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

GD bit depth


GD bit depth

Postby gersen » May 14, 2003 @ 9:52am

I'm writing a game for ppc, for now I'm using my own graph lib that was a derived version of my own lib for series60 (nokia 7650, 3650 etc). However I want to use GD for ppc mainly for his high ppc compatibility and probably better performance (with 2.01 release that support multiple pixel write :wink:). I use my own image loader and I make some conversion on the loading process. How can I get the bit depth currently used by GD? On my lib I convert on my loader the depth image (always 16 bit) on 16 (no conversion), 15 or 12 bit to support current depth screen.

Thanks.
User avatar
gersen
pm Member
 
Posts: 147
Joined: Oct 19, 2002 @ 8:40am
Location: Italy


Postby Johan » May 14, 2003 @ 10:21am

Hi Thomas,

The easiest way is to:

(1) Load the header of your image go get the width and height
(2) Create a new CGapiSurface of that width and height
(3) Lock the surface to get exclusive access (CGapiSurface::GetBuffer)
(3) CGapiSurface::GetBuffer returns a STRUCT with surface information. Check the pixel format as buffer.dwPixelFormat:
case GDPIXELFORMAT_555: Surface is 15-bit x555
case GDPIXELFORMAT_565: Surface is 16-bit 565
(4) Copy your image to the surface
(5) Release the buffer with CGapiSurface::ReleaseBuffer
User avatar
Johan
pm Member
 
Posts: 1843
Joined: Jan 12, 2002 @ 12:38pm
Location: Sweden


Postby gersen » May 14, 2003 @ 10:35am

Thanks for your quick answer Johan! :)
User avatar
gersen
pm Member
 
Posts: 147
Joined: Oct 19, 2002 @ 8:40am
Location: Italy


Return to GapiDraw


Sort


Forum Description

The Cross-platform Graphics SDK for Palms, Pocket PCs, Symbian Devices, and Stationary PCs.

Moderators:

sponge, Johan

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