Alpha blend test
- Giorgio Garabello
- Gold Card
- Posts: 299
- Joined: Tue Jun 30, 2015 8:39 am
- Location: Turin, Italy
- Contact:
Alpha blend test
Hello everyone, these days I'm enjoying experimenting with alpha blend command, is really interesting.
I tried to apply different degrees of transparency on the various graphics commands but was not able to apply it to the PAPER command,
My aim is to be able to create a transparent window on which placing information.
Someone can help me?
I tried to apply different degrees of transparency on the various graphics commands but was not able to apply it to the PAPER command,
My aim is to be able to create a transparent window on which placing information.
Someone can help me?
Quantum Technology
http://www.hunggartorino.it/ql/language/en/
http://www.hunggartorino.it/ql/language/en/
- QLvsJAGUAR
- Gold Card
- Posts: 489
- Joined: Tue Feb 15, 2011 8:42 am
- Location: Lucerne, Switzerland
- Contact:
Re: Alpha blend test
I also experienced that PAPER (and CLS) is not affected/supported by ALPHA_BLEND.
Not sure if I understand what you wanna do, but here's a sample:
Save it as ABP_bas. Run it with EX ABP_bas.
Not sure if I understand what you wanna do, but here's a sample:
Code: Select all
100 REMark /-----------------------------------------------------------\
110 REMark | ABP_bas |
120 REMark | Purpose: Demos ALPHA_BLEND with BLOCK instead of PAPER |
150 REMark | Written and (c) by Urs Koenig |
160 REMark | v1.00 2016-11-04 Initial release |
170 REMark \-----------------------------------------------------------/
180 :
190 IF VER$<>"HBA" : STOP
200 IF VER$="HBA" : JOB_NAME "ALPHA_BLEND demo" : IF VER$(1)<"3.26" : STOP
220 CLOSE#0
230 OPEN#0,"CON_512x256a"&((SCR_XLIM-512)/2)&"x"&((SCR_YLIM-256)/2) : REMark Centred
250 ALPHA_BLEND 16
260 BLOCK 512,256,0,0,2 : REMark use BLOCK instead of PAPER and CLS
270 ALPHA_BLEND 255
280 INK 0 : OVER 1 : PRINT "Hello... Something great will happen to you!"
290 ALPHA_BLEND 128
300 PAUSE
310 STAT WIN1_
320 WSTAT WIN1_BOOT
410 PAUSE 100
420 QUIT
QL forever!
https://www.sinclairql.net/ or http://www.sinclairql.org/ - Go and get THE DISTRIBUTION & QL/E!
https://www.youtube.com/QLvsJAGUAR/community - Blog
https://www.youtube.com/QLvsJAGUAR - Dedicated QL videos
Sinclair, QL, ATARI, ST/TT/FALCON/JAGUAR, NUON, APPLE, NeXT, MiST & much more...
Videos, pictures & information
https://www.sinclairql.net/ or http://www.sinclairql.org/ - Go and get THE DISTRIBUTION & QL/E!
https://www.youtube.com/QLvsJAGUAR/community - Blog
https://www.youtube.com/QLvsJAGUAR - Dedicated QL videos
Sinclair, QL, ATARI, ST/TT/FALCON/JAGUAR, NUON, APPLE, NeXT, MiST & much more...
Videos, pictures & information
- Giorgio Garabello
- Gold Card
- Posts: 299
- Joined: Tue Jun 30, 2015 8:39 am
- Location: Turin, Italy
- Contact:
Re: Alpha blend test
I've already tried this solution.
It works. but if I have to change in the content of the written there 'a jam overlapping characters.
I also tried the solution and VSAV and WRES commands but this presents incompatiblità with the system, it can not 'be used at every opportunity.
Many thanks aniway
Giorgio
It works. but if I have to change in the content of the written there 'a jam overlapping characters.
I also tried the solution and VSAV and WRES commands but this presents incompatiblità with the system, it can not 'be used at every opportunity.
Many thanks aniway
Giorgio
Quantum Technology
http://www.hunggartorino.it/ql/language/en/
http://www.hunggartorino.it/ql/language/en/
Re: Alpha blend test
Not sure I fully understand what you want to do, but I think it's similar to what I needed to do when writing Q-Dock, having a transparent window onto which I could draw without a regular rectangular paper colour background.
There is a flag which can be used to allow a menu window to be drawn without background paper colour. Unfortunately, I'm away from home at the moment and don't have access to the necessary information, although I think it's in the QPTR Guide, the flag is called wda_clfg, possibly page 112. I remember that accessing it needs a convoluted series of pokes or CHAN_L commands, not something I can remember from memory (must upgrade!). A search for it on this forum shows up no matches, neither does it on my own site, so I can't help more than that at this stage until I get home to look for my notes.
There is a flag which can be used to allow a menu window to be drawn without background paper colour. Unfortunately, I'm away from home at the moment and don't have access to the necessary information, although I think it's in the QPTR Guide, the flag is called wda_clfg, possibly page 112. I remember that accessing it needs a convoluted series of pokes or CHAN_L commands, not something I can remember from memory (must upgrade!). A search for it on this forum shows up no matches, neither does it on my own site, so I can't help more than that at this stage until I get home to look for my notes.
--
All things QL - https://dilwyn.theqlforum.com
All things QL - https://dilwyn.theqlforum.com
- Giorgio Garabello
- Gold Card
- Posts: 299
- Joined: Tue Jun 30, 2015 8:39 am
- Location: Turin, Italy
- Contact:
Re: Alpha blend test
Do not worry, I have no hurry. I'm trying to build a transparent clock, but I have problems with refreshdilwyn wrote:Not sure I fully understand what you want to do, but I think it's similar to what I needed to do when writing Q-Dock, having a transparent window onto which I could draw without a regular rectangular paper colour background.
There is a flag which can be used to allow a menu window to be drawn without background paper colour. Unfortunately, I'm away from home at the moment and don't have access to the necessary information, although I think it's in the QPTR Guide, the flag is called wda_clfg, possibly page 112. I remember that accessing it needs a convoluted series of pokes or CHAN_L commands, not something I can remember from memory (must upgrade!). A search for it on this forum shows up no matches, neither does it on my own site, so I can't help more than that at this stage until I get home to look for my notes.
Quantum Technology
http://www.hunggartorino.it/ql/language/en/
http://www.hunggartorino.it/ql/language/en/
- QLvsJAGUAR
- Gold Card
- Posts: 489
- Joined: Tue Feb 15, 2011 8:42 am
- Location: Lucerne, Switzerland
- Contact:
Re: Alpha blend test
I was also playing with my QTop-Clocks program to make use of transparency. Here a work-in-progress screenshot of QL/E running three instances of QTop-Clocks (one as button, two as a “ROLEX” using ALPHA_BLEND).Giorgio Garabello wrote:Do not worry, I have no hurry. I'm trying to build a transparent clock, but I have problems with refresh
QL forever!
https://www.sinclairql.net/ or http://www.sinclairql.org/ - Go and get THE DISTRIBUTION & QL/E!
https://www.youtube.com/QLvsJAGUAR/community - Blog
https://www.youtube.com/QLvsJAGUAR - Dedicated QL videos
Sinclair, QL, ATARI, ST/TT/FALCON/JAGUAR, NUON, APPLE, NeXT, MiST & much more...
Videos, pictures & information
https://www.sinclairql.net/ or http://www.sinclairql.org/ - Go and get THE DISTRIBUTION & QL/E!
https://www.youtube.com/QLvsJAGUAR/community - Blog
https://www.youtube.com/QLvsJAGUAR - Dedicated QL videos
Sinclair, QL, ATARI, ST/TT/FALCON/JAGUAR, NUON, APPLE, NeXT, MiST & much more...
Videos, pictures & information
- Giorgio Garabello
- Gold Card
- Posts: 299
- Joined: Tue Jun 30, 2015 8:39 am
- Location: Turin, Italy
- Contact:
Re: Alpha blend test
good news for you..but this how can help me?QLvsJAGUAR wrote:I was also playing with my QTop-Clocks program to make use of transparency. Here a work-in-progress screenshot of QL/E running three instances of QTop-Clocks (one as button, two as a “ROLEX” using ALPHA_BLEND).Giorgio Garabello wrote:Do not worry, I have no hurry. I'm trying to build a transparent clock, but I have problems with refresh

Quantum Technology
http://www.hunggartorino.it/ql/language/en/
http://www.hunggartorino.it/ql/language/en/
- QLvsJAGUAR
- Gold Card
- Posts: 489
- Joined: Tue Feb 15, 2011 8:42 am
- Location: Lucerne, Switzerland
- Contact:
Re: Alpha blend test
Once I finish the update of QTop-Clocks, you can take it and integrate it into Black Phoenix.Giorgio Garabello wrote:good news for you..but this how can help me?
QL forever!
https://www.sinclairql.net/ or http://www.sinclairql.org/ - Go and get THE DISTRIBUTION & QL/E!
https://www.youtube.com/QLvsJAGUAR/community - Blog
https://www.youtube.com/QLvsJAGUAR - Dedicated QL videos
Sinclair, QL, ATARI, ST/TT/FALCON/JAGUAR, NUON, APPLE, NeXT, MiST & much more...
Videos, pictures & information
https://www.sinclairql.net/ or http://www.sinclairql.org/ - Go and get THE DISTRIBUTION & QL/E!
https://www.youtube.com/QLvsJAGUAR/community - Blog
https://www.youtube.com/QLvsJAGUAR - Dedicated QL videos
Sinclair, QL, ATARI, ST/TT/FALCON/JAGUAR, NUON, APPLE, NeXT, MiST & much more...
Videos, pictures & information
- Giorgio Garabello
- Gold Card
- Posts: 299
- Joined: Tue Jun 30, 2015 8:39 am
- Location: Turin, Italy
- Contact:
Re: Alpha blend test
my primary interest is to learn the technique..QLvsJAGUAR wrote:Once I finish the update of QTop-Clocks, you can take it and integrate it into Black Phoenix.Giorgio Garabello wrote:good news for you..but this how can help me?
Quantum Technology
http://www.hunggartorino.it/ql/language/en/
http://www.hunggartorino.it/ql/language/en/
- QLvsJAGUAR
- Gold Card
- Posts: 489
- Joined: Tue Feb 15, 2011 8:42 am
- Location: Lucerne, Switzerland
- Contact:
Re: Alpha blend test
I've extracted the relevant parts of the QTop-Clocks S*BASIC source code, tested it quickly under QPC2 and publish it here as a case study of how an analogue clock with transparency support can be programmed. Enjoy.Giorgio Garabello wrote:my primary interest is to learn the technique.
Code: Select all
100 REMark File: TCLOCKS_133_snippet_bas an extract from TCLOCKS_133_bas
110 :
120 REMark Distribution: Posted on theqlforum.com
130 REMark Contact details: ql@bluewin.ch sinclairql.net
140 :
150 REMark /-----------------------------------------------------------\
160 REMark | QTop-Clocks |
170 REMark | Purpose: Displays clocks |
180 REMark | Written and (c) 1989-2016 by Urs Koenig |
190 REMark | v1.33 2016-11-15 Added ALPHA_BLEND feature |
200 REMark \-----------------------------------------------------------/
210 :
220 REMark ********** INIT **********
230 :
240 DIM a$(64)
250 DIM time$(20)
260 DIM colour(3)
270 time$=""
280 colour(0)=0 : colour(1)=7 : colour(2)=4 : colour(3)=2
290 a%=0 : start%=1
300 alpha_blend%=160 : REMark V133 Added ALPHA_BLEND feature
310 :
320 a$="con_146x107a366x149"
330 :
340 REMark ********** MAIN **********
350 :
360 AnalogClock
370 STOP
380 :
390 REMark ********** CLOCKS **********
400 :
410 DEFine PROCedure Set_INK_as_PAPER
420 INK#3,colour(0)
430 END DEFine
440 :
450 DEFine PROCedure Set_INK
460 INK#3,colour(1)
470 END DEFine
480 :
490 REMark **************** A N A L O G - C L O C K ***********
500 :
510 DEFine PROCedure AnalogClock
520 REPeat loop%
530 OpenCON
540 hour1=-1 : minute1=-1 : second1=-1
550 FILL#3,1 : INK#3,colour(3) : CIRCLE#3,50,50,48 : INK#3,colour(2) : FILL#3,0
560 FOR minutex=0 TO 55 STEP 5
570 a=minutex/30*PI : REMark V104 Removed brackets around minutex
580 hourx=fGetPosX(47) : houry=fGetPosY(47)
590 hourx1=fGetPosX(43) : houry1=fGetPosY(43)
600 LINE#3,hourx,houry TO hourx1,houry1
610 END FOR minutex
620 FILL#3,1 : Set_INK_as_PAPER : CIRCLE#3,50,50,44 : FILL#3,0
630 Set_INK : CIRCLE#3,50,50,48 : CIRCLE#3,50,50,44
640 OVER#3,-1 : a%=0
650 REPeat loop1%
660 time$=DATE$ : hour=time$(13 TO 14) : minute=time$(16 TO 17)
670 second=time$(19 TO 20)
680 hour=hour+INT(minute/5)/12
690 IF hour<>hour1 THEN
700 INK#3,colour(3)
710 IF a% : DrawHourHand
720 hour1=hour
730 a=(hour-.15)/6*PI : hourx=fGetPosX(31) : houry=fGetPosY(31)
740 a=hour/6*PI : hourx1=fGetPosX(35) : houry1=fGetPosY(35)
750 a=(hour+.15)/6*PI : hourx2=fGetPosX(31) : houry2=fGetPosY(31)
760 DrawHourHand
770 END IF
780 IF minute<>minute1 THEN
790 INK#3,colour(2)
800 IF a% : DrawMinuteHand
810 minute1=minute
820 a=(minute-.4)/30*PI : minutex=fGetPosX(36) : minutey=fGetPosY(36)
830 a=minute/30*PI : minutex1=fGetPosX(40) : minutey1=fGetPosY(40)
840 a=(minute+.4)/30*PI : minutex2=fGetPosX(36) : minutey2=fGetPosY(36)
850 DrawMinuteHand
860 END IF
870 IF second<>second1 THEN
880 Set_INK
890 IF a% : DrawSecondHand
900 a=second/30*PI
910 second1=second : secondx=fGetPosX(43) : secondy=fGetPosY(43)
920 DrawSecondHand
930 END IF
940 a%=1
950 END REPeat loop1%
960 END REPeat loop%
970 END DEFine
980 :
990 DEFine PROCedure DrawHourHand
1000 FILL#3,1
1010 LINE#3,50,50 TO hourx,houry TO hourx1,houry1 TO hourx2,houry2 TO 50,50
1020 FILL#3,0
1030 END DEFine
1040 :
1050 DEFine PROCedure DrawMinuteHand
1060 FILL#3,1
1070 LINE#3,50,50 TO minutex,minutey TO minutex1,minutey1 TO minutex2,minutey2 TO 50,50
1080 FILL#3,0
1090 END DEFine
1100 :
1110 DEFine PROCedure DrawSecondHand
1120 LINE#3,50,50 TO secondx,secondy
1130 END DEFine
1140 :
1150 DEFine FuNction fGetPosX(par1)
1160 RETurn 50+par1*SIN(a)
1170 END DEFine
1180 :
1190 DEFine FuNction fGetPosY(par1)
1200 RETurn 50+par1*COS(a)
1210 END DEFine
1220 :
1230 REMark ********** MAIN ROUTINES **********
1240 :
1250 DEFine PROCedure OpenCON
1260 OPEN#3,a$
1270 INK#3,colour(1)
1280 IF alpha_blend%=0: PAPER#3,colour(0) : CLS#3
1290 IF alpha_blend%: ALPHA_BLEND#3,alpha_blend%
1300 END DEFine
1310 :
1320 REMark EOF (end-of-file)
Cheers,
Urs (in love with S*BASIC)
- Attachments
-
- TCLOCKS_133_snippet_bas.zip
- (1.57 KiB) Downloaded 125 times
Last edited by QLvsJAGUAR on Tue Nov 22, 2016 6:25 pm, edited 1 time in total.
QL forever!
https://www.sinclairql.net/ or http://www.sinclairql.org/ - Go and get THE DISTRIBUTION & QL/E!
https://www.youtube.com/QLvsJAGUAR/community - Blog
https://www.youtube.com/QLvsJAGUAR - Dedicated QL videos
Sinclair, QL, ATARI, ST/TT/FALCON/JAGUAR, NUON, APPLE, NeXT, MiST & much more...
Videos, pictures & information
https://www.sinclairql.net/ or http://www.sinclairql.org/ - Go and get THE DISTRIBUTION & QL/E!
https://www.youtube.com/QLvsJAGUAR/community - Blog
https://www.youtube.com/QLvsJAGUAR - Dedicated QL videos
Sinclair, QL, ATARI, ST/TT/FALCON/JAGUAR, NUON, APPLE, NeXT, MiST & much more...
Videos, pictures & information