Author Topic: Question about images with an alpha channel  (Read 2266 times)

Offline AndyH

  • Dr. Type
  • ****
  • Posts: 383
    • View Profile
    • http://www.ovine.net/
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?

Offline Schranz0r

  • Premium User :)
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 5111
  • O Rly?
    • View Profile
Question about images with an alpha channel
« Reply #1 on: 2008-Mar-29 »
All correct ;)
Alphamode 0 is No Alpha !
I <3 DGArray's :D

PC:
AMD Ryzen 7 1700 @3.9GHz, 16GB HyperX Fury 3000MHz Ram, ASUS ROG GTX 1060 STRIX 6GB, Windows 10 Pro 64Bit, MSi Tomahawk B350 Mainboard

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10815
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
Question about images with an alpha channel
« Reply #2 on: 2008-Mar-31 »
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.