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

Artefacts when using AlphaBltFast


Artefacts when using AlphaBltFast

Postby efortier » Jul 10, 2002 @ 12:42am

I'm using an alpha bitmap to blit some button on a screen, and I'm getting a strange artefact. To test it, I created this bitmap:

http://www.techlogic.ca/aw/Button_EndTurn2.png

You will see the magenta doodle I made in the upper-right corner.

And here is the result, when using alpha blending, with no opacity:

http://www.techlogic.ca/aw/res.png

I resized the image to 8x its size so that we clearly see the artefact. I didn't touch the colors.

Granted, the artefact is not very heavy, but it still is an artefact, and is apparent sometimes.

I use AlphaBltFast, and no blitting flags with not structure.

Is this normal? Shouldn't this artefact be invisible since the bottom part of the source image (the alpha channel) contains RGB(0,0,0) at that location?

Thanks!
User avatar
efortier
pm Insider
 
Posts: 373
Joined: May 15, 2002 @ 10:32pm


Postby Johan » Jul 10, 2002 @ 12:57am

Thanks for this one as well.. Will look into it immediately.
User avatar
Johan
pm Member
 
Posts: 1843
Joined: Jan 12, 2002 @ 12:38pm
Location: Sweden


Postby Johan » Jul 10, 2002 @ 1:02pm

Hi,

I did not get the result you got. I got a perfect alpha blend to a black background using the source image Button_EndTurn2.png.

Somehow ALL RGB values in your source image were raised by 24 steps. You can easily check this if you look at the green button color in the res.png, which differs from the source image (also check my result below).

I would say that this is 99% a result from the built-in Gamma correction in LibPNG (which also apparantly adjusts the black level). When decoding the source image, LibPNG felt your monitor wasn't bright enough and increased the level of the image... This also raised the black level, which means that the alpha background now was gray and the pink scrap was copied as well. The error should not be visible on a PocketPC.

You can compare the different results below:

Image
res.png (the incorrect result)

Image
myres.png (my result)

What OS was used to render the res.png image? What graphic card?

The fun part is that I have disabled gamma in libpng. So it should not be active...

Thanks,
Johan
User avatar
Johan
pm Member
 
Posts: 1843
Joined: Jan 12, 2002 @ 12:38pm
Location: Sweden


Postby efortier » Jul 10, 2002 @ 11:16pm

Gheez.

So, it's possible that it produce artefacts on a PC, but none on a PocketPC?

Does this mean that we never have control on what the PNG decompressor does to an image (on the PC)?

I'm working on Windows 2000 Pro SP2, with an MSI GeForce 3 Ti 200.

You are right that squinting or not, I can't see any artefact on my iPaq.

Thanks for helping. Live and learn!

Eric
User avatar
efortier
pm Insider
 
Posts: 373
Joined: May 15, 2002 @ 10:32pm


Postby Johan » Jul 10, 2002 @ 11:49pm

Hi,

I have gone through the code again and am certain this issue is related to LibPNG. It will not be visible on handheld devices because PocketPCs and Smartphones use their own built-in IMGDECMP.DLL routines. I use a high-level read mechanism introduced with later builds of libpng that is probably not as tested as the rest of the library.

A new version of LibPNG was released two days ago that fixes many memory leaks, and judging from their wonderful code standard I bet we will see numerous fixes to their library during the next couple of months... Hopefully one of them will fix this issue as well.

/Johan
User avatar
Johan
pm Member
 
Posts: 1843
Joined: Jan 12, 2002 @ 12:38pm
Location: Sweden


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

cron