Angband Forums

Angband Forums (http://angband.oook.cz/forum/index.php)
-   Development (http://angband.oook.cz/forum/forumdisplay.php?f=10)
-   -   using Shockbolt's tiles (http://angband.oook.cz/forum/showthread.php?t=10393)

Tibarius November 12, 2020 03:06

using Shockbolt's tiles
 
Testing graphics with shockbolt's tiles.
Using the 64x64.png tile file i try to copy them into a screen device using
C++ with bloodshed IDE (not sure which compiler is used right now) on a Windows 10 machine.

I am using the Win32 GDI API BitBlt function to copy a source bitmap into
a screen destination.

Works fine so far. Just the graphics in the .png file have white background pixel (FF FF FF). Is there an easy way to copy a 64x64 pixel extract into a destination screen bitmap but have the white pixels in the source getting ignored?

I tried ... filling destination bitmap with WHITE pixels and then use BitBlt with the copy mode of SRCINVERT ... doing an exclusive or operation.

And indeed this turns all white pixels into black (empty) pixels. But also the color codes are inverted and the graphics turn into "shadows".

Anyone have an good idea? Please reply, thanks!

backwardsEric November 12, 2020 07:00

The Shockbolt tiles have an alpha channel for transparency information. If you look at the code in Angband's main-win.c, you'll see that the RGB components are multiplied by the alpha channel when the tile set is loaded in init_graphics(). That will convert the fully transparent parts, i.e. the white background, to black. When the premultiplied tiles are rendered to the screen in Term_pict_win_alpha(), the destination is first cleared, the tile used as the background is rendered with BitBlt() using SRCCOPY as the operation, and then, if there is an object or creature to rendered on top of the background, that is done with AlphaBlend().


All times are GMT +1. The time now is 23:44.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, vBulletin Solutions Inc.