Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
_Clearcolor and _setalpha day request
#1
Hi

I go through _Clearcolor and _Setalpha keywords starting from this thread _Clearcolor _Setalpha and transparency and I got more informations about these two QB64pe keywords, but I find some informations uncomplete so I ask, if there is a large interest of community members,  a more detailed informations.
For my interest for now I'm stuck on how define the range of colors to work on with _Setalpha, in the syntax I can read
Quote:range of color values color1& TO colour2& to set the transparency
moreover please I request to ajust the 3rd example of wiki page of _Clearcolor

1 it is better clear the screen with a color to be more evident the transparency of background of image loaded
2 it need to add _CLEARCOLOR  clr~&, NewImage1& after setting alphachannel to keep transparent the background previously made so

here the wikicode with the above corrections
Code: (Select All)

mainscreen = _NewImage(640, 480, 32) ' Main Screen (viewable)
Screen mainscreen
_ScreenMove _Middle
Image1& = _LoadImage("qb64_trans.png") '<<<<<< any image with one background color to clear

If Image1& < -1 Then 'check loaded image handle value before using!
    _Source Image1&
    clr~& = Point(0, 0) 'get background color from image source
    _ClearColor clr~&, Image1& 'clear background color of loaded image
    NewImage1& = _NewImage(_Width(Image1&), _Height(Image1&), 32) 'new image page
    _PutImage , Image1&, NewImage1& 'put image without background color on new page
    _FreeImage Image1& 'free loaded image from memory
End If
_Dest mainscreen:

a& = 0: d = 1
Do
    _Limit 10 'regulate speed of fades
    Cls
    a& = a& + d
    If a& = 255 Then d = -d 'reverse fade
    _SetAlpha a&, , NewImage1& 'sets alpha level of all colors to fade image page in/out
_ClearColor clr~&, NewImage1& 'clear background color of loaded image 
_PutImage (0, 342), NewImage1&
    Locate 1, 1: Print "Alpha: "; a&
    _Display
Loop Until a& = 0
End

Thanks for so beautyful keywords... more technical informations come time by time from developers' team to users like me

Long live to QB64pe!
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  request for printing patterns with for loops tutorial fistfullofnails 24 4,233 08-19-2025, 08:09 PM
Last Post: bplus

Forum Jump:


Users browsing this thread: 1 Guest(s)