Question about images with an alpha channel

Previous topic - Next topic

AndyH

Here's the image:




and here's some code:

Code (glbasic) Select
SETSCREEN 640,480,0
LIMITFPS 60

BLACKSCREEN

LOADSPRITE "achannel.png",0

WHILE TRUE
LOCAL x,y,a,b

IF KEY(2) THEN ALPHAMODE -1
IF KEY(3) THEN ALPHAMODE 1

DRAWRECT 105,105,100,10, RGB(0,0,255)

MOUSESTATE x,y,a,b
DRAWSPRITE 0, x,y

DRAWSPRITE 0,100,100

SHOWSCREEN

WEND
By default, the alpha channel on the red circle is ignored.  If shows a solid circle.  Hold 1 on the keyboard to apply the alphamode of -1 and the alpha channel works.  Is this correct or should alphamode 0 also work?

Schranz0r

All correct ;)
Alphamode 0 is No Alpha !
I <3 DGArray's :D

PC:
AMD Ryzen 7 3800X 16@4.5GHz, 16GB Corsair Vengeance LPX DDR4-3200 RAM, ASUS Dual GeForce RTX™ 3060 OC Edition 12GB GDDR6, Windows 11 Pro 64Bit, MSi Tomahawk B350 Mainboard

Kitty Hello

Right Alphamode 0 just uses all alpha above 0.5 as transparent. If you want it blended, use ALPHAMODE -1
For a glow effect ALPHAMODE -.7 or something. Or even +.5.