using Shockbolt's tiles

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Tibarius
    Swordsman
    • Jun 2011
    • 429

    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!
  • backwardsEric
    Knight
    • Aug 2019
    • 527

    #2
    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().

    Comment

    Working...
    😀
    😂
    🥰
    😘
    🤢
    😎
    😞
    😡
    👍
    👎