Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Erasing (or making a section of an image transparent) based on a mask from image #2?
#11
Hmmm.... none of these examples are working. 

I think I found the problem -  it seems _BLEND isn't working on my PC? 

I went to the _DONTBLEND wiki page and tried the example, and the text disappears leaving only the yellow box whether I comment out "_DontBlend" (line 7) or not: 

Code: (Select All)
'From: https://qb64phoenix.com/qb64wiki/index.php/DONTBLEND
'Example 1: Use _DONTBLEND when you want the 32 bit screen surface
'to be opaque so that it covers up other backgrounds. CLS works too.

Screen _NewImage(1280, 720, 32)
'CLS
_DontBlend '<<< comment out to see the difference

Line (100, 100)-(500, 500), _RGB32(255, 255, 0), BF

b& = SaveBackground&

Print "This is just test junk"
Print
Print "Hit any key and the text should disappear, leaving us our pretty yellow box."
Sleep
RestoreBackground b&

End

Function SaveBackground&
    SaveBackground& = _CopyImage(0)
End Function

Sub RestoreBackground (Image As Long)
    _PutImage , Image, 0
End Sub

Here is another test I tried, again the text disappears for both _BLEND and _DONTBLEND: 

Code: (Select All)
'https://qb64phoenix.com/qb64wiki/index.php/DONTBLEND

Screen _NewImage(800, 600, 32)
Cls
Print "Test / demonstration of _Blend and _DontBlend in QB64PE"
Print
Print "Press any key to begin...": Sleep: _KeyClear

Screen _NewImage(800, 600, 32)
Cls
_DontBlend
Line (100, 100)-(500, 500), _RGB32(255, 255, 0), BF
b& = SaveBackground&
Print "Part 1: _DontBlend"
Print
Print "Hit any key and this text should disappear,"
Print "leaving us our pretty yellow box.": Sleep: _KeyClear
RestoreBackground b&
Locate 33, 1: Print "Press any key for demonstration of _Blend";: Sleep: _KeyClear

Screen _NewImage(800, 600, 32)
Cls
_Blend ' this is on by default
Line (100, 100)-(500, 500), _RGB32(255, 255, 0), BF
b& = SaveBackground&
Print "Part 2: _Blend"
Print
Print "Hit any key and this text should remain.": Sleep: _KeyClear
RestoreBackground b&
Locate 33, 1: Print "Test complete. Press any key to exit.";: Sleep: _KeyClear

' CLEAN UP
If b& < -1 Or b& > 0 Then _FreeImage b&

End

Function SaveBackground&
    SaveBackground& = _CopyImage(0)
End Function

Sub RestoreBackground (Image As Long)
    _PutImage , Image, 0
End Sub

I'm still on QB64PE 4.0.0 - is there a _BLEND / _DONTBLEND bug in this version that I didn't get the memo for? 

[Image: qb64pe-ver-4-0-0.png]
Reply


Messages In This Thread
RE: Erasing (or making a section of an image transparent) based on a mask from image #2? - by madscijr - 04-14-2025, 02:35 PM



Users browsing this thread: 2 Guest(s)