Log In  

ZX Spectrum allowed enabling XOR pixel operation for drawing routines and text. Some interesting interference patterns could be achieved this way.

Cart [#58709#] | Code | 2018-11-03 | License: CC4-BY-NC-SA | Embed

P#58710 2018-11-03 06:11 ( Edited 2018-11-03 19:40)

:: dw817

As drawing XOR was important to me, I wrote a routine to cover this in PAINT. (WIP)

-- simple xor line ------------
-- from the lab⧗of dw817 -----

-- draw xline point to point --
function pline(a,b,c,d)
local px,py=c-a,d-b
local ax,ay=abs(px),abs(py)
  if ax>ay then
    py/=ax px=sgn(px)
  else
    px/=ay py=sgn(py)
  end
  repeat
    pset(a,b,15-pget(a,b))
    a+=px b+=py
  until abs(a-c)<1 and abs(b-d)<1
end--pline(.....)

--- main code --------------->>

cls()

circfill(64,64,48,3)

for i=.5,127,1.5 do
  pline(i,0,127-i,127)
  pline(0,i,127,127-i)
  flip()
end
P#58719 2018-11-03 12:19 ( Edited 2018-11-03 16:24)

Hi dw817. You're right: BXOR(I,15) and 15-I give same results on integers from 0 to 15. My code applies XOR between color being written and color already on screen. This works well on monochrome screen (1bpp) but gives weird results with 4bpp. I'm also working on a paint program, a colouring book for kids. Good luck with yours! ;)

P#58720 2018-11-03 14:59 ( Edited 2018-11-03 18:59)
:: dw817

Coloring book for kids ? In Pico ? I would definitely like to see that, or rather my 9yo niece would. :D

And yes, good luck to you too !

P#58721 2018-11-03 15:40 ( Edited 2018-11-03 19:40)

[Please log in to post a comment]

About | Contact | Updates | Terms of Use
Follow Lexaloffle:        
Generated 2019-08-24 03:15 | 0.041s | 2097k | Q:26