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

PNG support


PNG support

Postby Viking » Dec 18, 2002 @ 8:12pm

Viking
pm Member
 
Posts: 23
Joined: Nov 1, 2002 @ 11:12pm
Location: Intactics Co.


Postby adde » Dec 19, 2002 @ 4:29am

Well, I guess Kzinti should answer this one, but until he does, I'll try my best.

PF:s LoadImage function uses the IMGDECMP.DLL supplied by IE5 on PPC to decode either a .BMP, .GIF, .JPG, .PNG or .XBM image into an intermediate 24 bit bitmap. This bitmap is used to create a Surface object and then it's memory is deallocated. LoadImage returns a pointer to the Surface it created (which needs to be deleted before exiting PF).

Because BMP doesn't support transparency, then neither transparent GIF:s nor alpha-channel PNG:s will be transparent in PF.

To get transparent behaviour out of PF, you save your images in a non transparent format having a special color for the transparent pixels. Remember the palette index of this color and then use Surface::SetColorMask(palette_index) to make the Surface transparent. To disable transparency of a Surface, use palete_index=-1 (this is the default color mask).

Sounds simple doesn't it. But there is a catch. The palette index has to be in regards to the standard palette used by the system. And this can be more or less hard to find out. I mostly use black as the transparent color since it always has index 0 and it has worked so far. And if you need black (#000000) in your image, then use a slightly (you will not notice the difference) brighter black (#030303) since it will get its own palette index (I think).
User avatar
adde
pm Member
 
Posts: 152
Joined: Oct 9, 2002 @ 1:42pm
Location: Stockholm / Sweden


Postby Kzinti » Dec 20, 2002 @ 4:03am

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


Postby Kzinti » Dec 20, 2002 @ 4:06am

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


Postby adde » Dec 21, 2002 @ 5:38am

OK!!! Thanks Kzinti for clearing this up. When I didn't find a palette I just asumed it used the standard palette, but this actually makes much more sense.
User avatar
adde
pm Member
 
Posts: 152
Joined: Oct 9, 2002 @ 1:42pm
Location: Stockholm / Sweden


Memory overflow when using HUGE images...

Postby Viking » Dec 21, 2002 @ 9:53pm

Viking
pm Member
 
Posts: 23
Joined: Nov 1, 2002 @ 11:12pm
Location: Intactics Co.


Return to PocketFrog & PocketHAL


Sort


Forum Description

SDKs for fast and robust device-independent access to Pocket PC display hardware.

Moderators:

sponge, Kzinti

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