Go Back   Angband Forums > Angband > Development

Thread Tools Display Modes
Old November 12, 2020, 04:06   #1
Tibarius's Avatar
Join Date: Jun 2011
Location: Germany
Age: 53
Posts: 429
Tibarius is an unknown quantity at this point
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!
Blondes are more fun!
Tibarius is offline   Reply With Quote
Old November 12, 2020, 08:00   #2
Join Date: Aug 2019
Posts: 339
backwardsEric is on a distinguished road
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().
backwardsEric is offline   Reply With Quote

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Shockbolt tiles for 4.2.1 Nick Vanilla 13 May 25, 2020 20:35
Shockbolt tiles half Development 4 June 19, 2012 08:54
Shockbolt Tiles Malatar v4 7 April 21, 2012 17:19
Shockbolt's tiles now in 3.4-dev! Magnate Development 27 January 9, 2012 09:52
Shockbolt's tiles now in v4 Magnate v4 14 December 31, 2011 18:59

All times are GMT +1. The time now is 01:12.

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