Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
_SETALPHA Question
#1
I seem to be having issues with _SETALPHA.

When I initially set a color to a transparency level with _SETALPHA I can't change it to another transparency level later on.

I'm certain I've done this in the past.

I've found a work-around using a temporary image but I'm sure this is not needed ... or is it? See my code below and please explain to me why the first block of code is not working. A bug? Brain-fart on my part?

Code: (Select All)
'|
'| Fade in a red box test
'|

DIM RedBox AS LONG
DIM TempBox AS LONG
DIM c AS INTEGER

SCREEN _NEWIMAGE(640, 480, 32)

RedBox = _NEWIMAGE(320, 240, 32)
_DEST RedBox
CLS , _RGB32(255, 0, 0)
_DEST 0

'c = 0 '                                       |
'DO '                                          | This block of code does not work?
'    CLS '                                     |
'    _LIMIT 30 '                               | The Wiki shows however this should be acceptable
'    _SETALPHA c, _RGB32(255, 0, 0), RedBox '  |
'    _PUTIMAGE (159, 119), RedBox '            |
'    _DISPLAY '                                |
'    c = c + 1 '                               |
'LOOP UNTIL c = 256 '                          |


c = 0 '                                       |
DO '                                          | This block of code does work.
    CLS '                                     |
    _LIMIT 30 '                               | Why do I need to copy the original RedBox to
    TempBox = _COPYIMAGE(RedBox) '            | to another image for every iteration of the loop?
    _SETALPHA c, _RGB32(255, 0, 0), TempBox ' |
    _PUTIMAGE (159, 119), TempBox '           |
    _DISPLAY '                                |
    _FREEIMAGE TempBox '                      |
    c = c + 1 '                               |
LOOP UNTIL c = 256 '                          |
New to QB64pe? Visit the QB64 tutorial to get started.
QB64 Tutorial
Reply


Messages In This Thread
_SETALPHA Question - by TerryRitchie - 09-29-2023, 04:08 AM
RE: _SETALPHA Question - by DSMan195276 - 09-29-2023, 04:21 AM
RE: _SETALPHA Question - by TerryRitchie - 09-29-2023, 04:33 AM
RE: _SETALPHA Question - by TerryRitchie - 09-29-2023, 05:01 AM
RE: _SETALPHA Question - by SMcNeill - 09-29-2023, 05:15 AM
RE: _SETALPHA Question - by TerryRitchie - 09-29-2023, 05:39 AM
RE: _SETALPHA Question - by SMcNeill - 09-29-2023, 07:19 AM
RE: _SETALPHA Question - by SMcNeill - 09-29-2023, 07:24 AM
RE: _SETALPHA Question - by DSMan195276 - 09-29-2023, 05:11 PM
RE: _SETALPHA Question - by TerryRitchie - 09-29-2023, 05:21 PM
RE: _SETALPHA Question - by TerryRitchie - 09-29-2023, 06:19 PM
RE: _SETALPHA Question - by SMcNeill - 09-29-2023, 06:41 PM
RE: _SETALPHA Question - by SMcNeill - 09-29-2023, 06:56 PM
RE: _SETALPHA Question - by TerryRitchie - 09-29-2023, 07:07 PM
RE: _SETALPHA Question - by TerryRitchie - 09-30-2023, 03:37 AM
RE: _SETALPHA Question - by SMcNeill - 09-30-2023, 11:19 AM
RE: _SETALPHA Question - by TerryRitchie - 09-30-2023, 02:00 PM



Users browsing this thread: 1 Guest(s)