Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Bitwise NOT, is this getting "opposite" colors???
#6
(11-19-2022, 04:42 AM)mnrvovrfc Wrote: Note: the array might be too big. I tried to use a string as was suggested in the Wiki but failed, increased it as much as 16 million. :O
The first time "XOR" is used, it's on black so it's just the same as "PSET".
The other time, a totally-white opaque block is drawn before the buffer overlays it, getting the same results as your rectangle.

Code: (Select All)
screen _newimage(600,400,32)

dim as _unsigned _byte r,g,b,r2,g2,b2
dim blk(1 to 400, 1 to 400) as long

again:
r = int(rnd*256)
g = int(rnd*256)
b = int(rnd*256)

r2 = not r
g2 = not g
b2 = not b

line (0, 0)-step(200, 200),_rgb32(r,g,b),BF
get (0, 0)-(199, 199), blk
line (300, 200)-step(200, 200),_rgb32(r2,g2,b2),BF
put (0, 200), blk, XOR
line(300, 0)-step(199, 199), _rgb32(255, 255, 255, 255), BF
put (300, 0), blk, XOR
end

Just tried it, and I see what is going on.

The RGB components of a color, NOT-TING each of them results in a color.

Taking that original color, if we XOR it with white, we get the same color as the NOT-TING.

So what's the resulting color?  Is it an opposite color?  A something-something color?

I'd like to know what we call what is going on, to go read the related color therory.
Reply


Messages In This Thread
RE: Bitwise NOT, is this getting "opposite" colors??? - by CharlieJV - 11-19-2022, 05:39 AM



Users browsing this thread: 1 Guest(s)