
How can I get a pixel color?
How can I get a pixel color?
Is there a way to get the color of a pixel at a given location in Basic? It seems I have to use some PEEKs for this, right? I hope somebody solved this problem long ago. However I can't still find any trace of this solution.
So I am seeking for some help here. A lot of thanks in advance.

Re: How can I get a pixel color?
Your best bet is probably DIY Toolkit, series "G" - This has SuperBASIC extensions for fast pixel plot and line drawing, as well as a function PIXEL% to do exactly what you want (http://www.dilwyn.me.uk/tk/ , under "DIY")
ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
Re: How can I get a pixel color?
While DIY TK's PIXEL% works on "Black Box QLs" in MODE4 and 8, Per's RPIX extensions work on High-colour displays (GD2) MODE 32 and 33 (I think it also works in 8-bit palette mode, but am not 100% sure). The OP didn't say what he needs, so I guess both might be of relevance.
ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
Re: How can I get a pixel color?
Is there an 8 bit palette on any QL style machine? I was just aware of the fixed 8 bit Aurora mode.tofro wrote:(I think it also works in 8-bit palette mode, but am not 100% sure).
-
- Font of All Knowledge
- Posts: 4738
- Joined: Mon Dec 20, 2010 11:40 am
- Location: Sunny Runcorn, Cheshire, UK
Re: How can I get a pixel color?
Hi,
8 bit colours? Is this 2^8 or 256 colours?
QL Mode 4 is 4 colours, 2^2 or 2 bit
QL Mode 8 is 8 colours, 2^3 or 3 bit
I wish there were 256 colours on a QL without SMSQ/E.
The Q68 can do 512x256 Mode 33
8 bit colours? Is this 2^8 or 256 colours?
QL Mode 4 is 4 colours, 2^2 or 2 bit
QL Mode 8 is 8 colours, 2^3 or 3 bit
I wish there were 256 colours on a QL without SMSQ/E.
The Q68 can do 512x256 Mode 33
Regards,
Derek
Derek
Re: How can I get a pixel color?
SMSQ/E features a palette of 256 colours which can be referenced with an 8-bit value.Peter wrote:Is there an 8 bit palette on any QL style machine? I was just aware of the fixed 8 bit Aurora mode.tofro wrote:(I think it also works in 8-bit palette mode, but am not 100% sure).
WM_PAPER & WM_INK can set these colours with values $200 to $2FF.
The obscure GD2 sprite modes 3(1-bit), 7(2-bit), 15(4-bit) & 31(8-bit) also use this palette.
The PALETTE_8 command allows changing these colours with new 24-bit RGB values.
Also the standard QL palette of 8 colours can be changed with PALETTE_QL under SMSQ/E.
The 8-bit Aurora mode 16 is a true RGB colour with 3 bits for G and 2 for R & B each, the last bit is a combined R & B bit.
BSJR
Re: How can I get a pixel color?
And both QPC2 and SMSQmulator can be fired up in Aurora-compatible mode 16.BSJR wrote:<>The 8-bit Aurora mode 16 is a true RGB colour with 3 bits for G and 2 for R & B each, the last bit is a combined R & B bit. <>
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: How can I get a pixel color?
Oops. This should of course be $100 to $1FF, the $200 range are the 15-bit system palette colours definable by QCoCo.BSJR wrote:...WM_PAPER & WM_INK can set these colours with values $200 to $2FF...
BSJR
Re: How can I get a pixel color?
Thanks but I wanted not to use any Basic expansion. So I had to find another way. My project is to convert an Amstrad CPC Basic program to other platforms. The last results are here.
I have to confess that the QL conversion has so far been the most difficult task because of peculiarities of the FOR-operator implementation in SuperBasic and the absence of a means to get the color of a pixel.
I have to confess that the QL conversion has so far been the most difficult task because of peculiarities of the FOR-operator implementation in SuperBasic and the absence of a means to get the color of a pixel.