I am fairly certain that one can create a transparent window in Sbasic on SMSQ/E.I have searched this forum and various manuals
but found no answer to the question; How does one create a transparent window?
Can anyone answer this question?
Transparent windows
Re: Transparent windows
Assuming I'm understanding what you want to achieve, the closest I can think of is when drawing menus in the EE. There is a flag in the window attributes data, called wda_clfg in QPTR documentation, which you'll need to look up in the QPTR guide for details (just search the PDF for wda_clfg, or it's on page 112 of my old paper copy).
In brief, wda_clfg is a flag byte telling the system not to clear the window background if the most significant bit of wda_clfg is 1, or clear it normally if 0 when drawing a menu, default is zero. Background can still get overwritten and acquire a background if other programs overlap etc etc and PE decides it needs the save the whole window area and later restore it, so it's not a silver bullet solution.
When using Easyptr, make sure you set/clear the flag bit before drawing the menu (use MSETUP instead of MDRAW, POKE the flag, then MDRAW or patch the menu file itself first if it's always to be used with "no draw")
I used it in my Q-Dock so that I could generate the non-rectangular dock shape without a window background. You can access it in a slightly roundabout way by looking into Easyptr menus, for example, by a little bit of BASIC like this (from notes I kept at the time) by looking at the byte at offset 8 from where MWDEF(#channel) points to:
As I implied above, it's not a perfect solution by any means.
I don't think you can achieve a fully transparent window under vanilla QDOS (I want to know if anyone knows better).
EDIT: Forgot to write that it can be partially achieved in your own programs in a much simpler way by opening a window channel, draw a border to see where the window is, then print text using OVER 1 so as not to draw any PAPER. Of course using CLS will fill the background. This little example might not work with PE (pointer environment), I haven't checked, PE may confuse matters when it saves/resores overlapping windows. Under QDOS, I *think* border colour can be transparent with a colour 128, so you can have a border area, without colour.
In case I've not quite understood what you want to do, you might also want to look at the ALPHA_BLEND which allows from 0 to 100% transparency when drawing with BLOCK, CIRCLE, LINE etc. It's implemented in fairly recent SBASICs.
There is also the WM_MOVEALPHA in SBASIC for moving windows around with transparency effect, in case that gives you ideas. If you have the knowledge to do so, it might be an idea to look up these sorts of things within SMSQ/E sources to see how they work and get ideas. Even a duffer like me has been known to do that from time to time, sometimes successfully!
Perhaps if you could give us a few more details on exactly what you want to do, someone may be able to come up with some more appropriate ideas.
In brief, wda_clfg is a flag byte telling the system not to clear the window background if the most significant bit of wda_clfg is 1, or clear it normally if 0 when drawing a menu, default is zero. Background can still get overwritten and acquire a background if other programs overlap etc etc and PE decides it needs the save the whole window area and later restore it, so it's not a silver bullet solution.
When using Easyptr, make sure you set/clear the flag bit before drawing the menu (use MSETUP instead of MDRAW, POKE the flag, then MDRAW or patch the menu file itself first if it's always to be used with "no draw")
I used it in my Q-Dock so that I could generate the non-rectangular dock shape without a window background. You can access it in a slightly roundabout way by looking into Easyptr menus, for example, by a little bit of BASIC like this (from notes I kept at the time) by looking at the byte at offset 8 from where MWDEF(#channel) points to:
Code: Select all
MAIN WINDOW
(wd_nnn include scaling info)
ws_work ws_wdef
| |
adr = PEEK_L(MWDEF(#0)+4)
wd_xsize = PEEK_W(adr+0)
wd_ysize = PEEK_W(adr+2)
wd_xorg = PEEK_W(adr+4)
wd_yorg = PEEK_W(adr+6)
clearflag = PEEK(adr+8) <- MSB 0 to clear, 1 to NOT clear
shadow = PEEK(adr+9)
borderwidth = PEEK_W(adr+10)
bordercolour = PEEK_W(adr+12)
papercolour = PEEK_W(adr+14)
sprite = PEEK_W(adr+16)
REM loose item attributes follow at +18 (QPTR manual page 112)
To PATCH wda_clfg manually in a menu, POKE base+36,128 or 0 as required, or:
OPEN #3,filename_men : BPUT #3\36,128 : CLOSE #3
I don't think you can achieve a fully transparent window under vanilla QDOS (I want to know if anyone knows better).
EDIT: Forgot to write that it can be partially achieved in your own programs in a much simpler way by opening a window channel, draw a border to see where the window is, then print text using OVER 1 so as not to draw any PAPER. Of course using CLS will fill the background. This little example might not work with PE (pointer environment), I haven't checked, PE may confuse matters when it saves/resores overlapping windows. Under QDOS, I *think* border colour can be transparent with a colour 128, so you can have a border area, without colour.
Code: Select all
OPEN #3,CON_256x128a128x64
BORDER #3,1,255
OVER #3,1
PRINT #3,'Hello world'
There is also the WM_MOVEALPHA in SBASIC for moving windows around with transparency effect, in case that gives you ideas. If you have the knowledge to do so, it might be an idea to look up these sorts of things within SMSQ/E sources to see how they work and get ideas. Even a duffer like me has been known to do that from time to time, sometimes successfully!
Perhaps if you could give us a few more details on exactly what you want to do, someone may be able to come up with some more appropriate ideas.
--
All things QL - https://dilwyn.theqlforum.com
All things QL - https://dilwyn.theqlforum.com
-
- Aurora
- Posts: 898
- Joined: Mon Nov 24, 2014 2:03 pm
Re: Transparent windows
Hi guys,
Yes, it all depends on your exact needs in the program.
You can overlay transparent shapes by filling them around their Outsides, leaving the underlying background unchanged. This is like drawing your own 'borders', quite easy with rectangles, but fussier to achieve with circles, as you have to fill outside ARCs. (I used the latter technique to produce the Cave2_bas design), see below. Steve.
Yes, it all depends on your exact needs in the program.
You can overlay transparent shapes by filling them around their Outsides, leaving the underlying background unchanged. This is like drawing your own 'borders', quite easy with rectangles, but fussier to achieve with circles, as you have to fill outside ARCs. (I used the latter technique to produce the Cave2_bas design), see below. Steve.
Re: Transparent windows
To create a transparent window just dont use CLS!Tinyfpga wrote: Mon Jan 06, 2025 3:07 pm I am fairly certain that one can create a transparent window in Sbasic on SMSQ/E.I have searched this forum and various manuals
but found no answer to the question; How does one create a transparent window?
Can anyone answer this question?
The demo below should be EXecuted in high colour SMSQ/E, but the principle holds good for QL colours and Qdos. (Except, of course, they dont support high colour, ALPHA_BLEND, line number-less code and a whole bunch of other goodies.)
Code: Select all
wsx% = 140: wsy% = 100
ch = FOPEN("con_")
WINDOW#ch; wsx%, wsy%, 200, 20
BORDER#ch; 2, 255
PRINT#ch; ' A transparent window!'
PRINT#ch; ' Press a key '
PAUSE#ch
ALPHA_BLEND#ch; 128
BLOCK#ch; wsx% - 8, wsy% - 4, 0, 0, 0
ALPHA_BLEND#ch; -1
PRINT#ch\\ ' An opaque window! '
PAUSE#ch
Per
I love long walks, especially when they are taken by people who annoy me.
- Fred Allen
I love long walks, especially when they are taken by people who annoy me.
- Fred Allen
Re: Transparent windows
The kind of transparency I was thinking of was part of the Black Phoenix distribution as Follows:-
I think the answer to my question lies in the posts found above. I will try pjw's code later on.Re: Transparent windows
Or like this.
What I would like to do is to have the program permanently transparent.
I have tried pjw's code but it does not ,as yet, produce the effect I want.
I have cheated here because I have achieved the effect I want, by screen shooting the window whilst moving it.What I would like to do is to have the program permanently transparent.
I have tried pjw's code but it does not ,as yet, produce the effect I want.
-
- Aurora
- Posts: 898
- Joined: Mon Nov 24, 2014 2:03 pm
Re: Transparent windows
Hi Tinyfpga,
The examples you show are not so much transparent, as translucid. You also seem to have been using a very high definition screen ?
To achieve a translucid effect, one would need to develop new sorts of colour stipples, (using Over 1 ?).
Normally, stipples are combinations of colours, (including black), but for your needs, some colour 'bits' would have to be not shown. This can be done, but requires 'texture fills', such as that of TALENT, for both paper and ink..... and the output is slow, unless written ,say, in C.
I might have a try over the next few days, but only in SMSQ/E and SBasic. - Steve.
The examples you show are not so much transparent, as translucid. You also seem to have been using a very high definition screen ?
To achieve a translucid effect, one would need to develop new sorts of colour stipples, (using Over 1 ?).
Normally, stipples are combinations of colours, (including black), but for your needs, some colour 'bits' would have to be not shown. This can be done, but requires 'texture fills', such as that of TALENT, for both paper and ink..... and the output is slow, unless written ,say, in C.
I might have a try over the next few days, but only in SMSQ/E and SBasic. - Steve.
-
- Aurora
- Posts: 898
- Joined: Mon Nov 24, 2014 2:03 pm
Re: Transparent windows
Hi again,
Here is the example of translucidity achieved in SBasic... by not using the red stipple colour. Steve.
(Using 512x256 screen in QPC2).
Here is the example of translucidity achieved in SBasic... by not using the red stipple colour. Steve.
(Using 512x256 screen in QPC2).