Friday, 24 July 2009

16k Colours with QPTR

My version of QPTR is 0.13. I have never ceased to be amazed at the resilience of this extension in the face of developments in SuperBasic and then SBASIC.

The Qliberator directive to incorporate this extension is $$asmb="location"_QPTR,0,172

I acquired the value of 172 by trial and error. It is published nowhere in any manual.



Anyway here is how to add 16k colours to the WMAN structures set up from SBASIC through QPTR. I had no idea of how simple this was until I came across an article by Geoff Wicks in QLToday in 2006, volume 10 issue 4 January to March, page 17. The article was entitled "Eleven Lines of BASIC". Nothing to do with QPTR but everything to do with the indexing of the colour built into smsq/e.

What Geoff says is this for colour index values:
0 - 255 QL colours
256 - 511 Palette colours
512 - 767 System colours (do not use!)-GWicks(sic) (Duh!)-me
768 - 1023 Shades of grey
Combine this minuscule snippet of information with the structure of the system palettes and what you get is add 512 to the index value of the system palette colour you want to use in QPTR window definitions and low and behold you have accessed the current system theme. System palettes/colours are described in QLToday volume 8 issue 2 May/June 2003 page 47.

Why was this not immediately obvious to plodders like me or how did Geoff get hold of this information so clearly and why did he not put it into context. Apply your own conspiracy theory.

Sorry no picture this time. Next time I will supply some examples of how to use this information.

No comments:

Post a Comment