Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Pixel Color Test
#1
Marcus,

I am still confused in regards to "how" the pixel() command works.

Are you able to explain the output produced? (see attached image)

   

Regards

J
Logic is the beginning of wisdom.
Reply
#2
This is an unofficial answer ... 
(unofficial = might be incomplete or even confusing .... lol ....)

pixel(x,y) returns the color at position (x, y) as an array [r, g, b, a]

Code:
'pixel(x,y) returns the color at position (x, y) as an array [r, g, b, a]
getcolor=pixel(150,150)
wln getcolor
wln
write "RGBA "
for i = 0 to 3
    write getcolor[i]+" "
next

   
click the image to zoom in
Reply
#3
Ah... this is where my confusion kicks in... over the many years of using multiple forms of Basic, the commands for testing a colour at x,y usual produces a single integer value. If memory serves correctly, N6 handled integer values using "pixeli(x,y)"

So, as N7 currently stands, if I want to check the colour of a pixel, I will need to check all R, G, B and A values of pixel(x,y)? or am I still confused... Would it not be simpler to add pixeli() command to N7?
Logic is the beginning of wisdom.
Reply
#4
(04-12-2024, 10:54 AM)johnno56 Wrote: Ah... this is where my confusion kicks in... over the many years of using multiple forms of Basic, the commands for testing a colour at x,y usual produces a single integer value. If memory serves correctly, N6 handled integer values using "pixeli(x,y)"

So, as N7 currently stands, if I want to check the colour of a pixel, I will need to check all R, G, B and A values of pixel(x,y)? or am I still confused... Would it not be simpler to add pixeli() command to N7?

The problem is that n7 has no integer type, all numbers are 64 bit doubles (floating point). A 64 bit double can correctly represent any signed 32 bit integer. But what you need when storing an RGBA value is a 32 bit UNSIGNED integer with a much larger (positive) range. Can a double handle that, or ... does it even matter if it's just used for a pixeli function? I'm not sure. Do we also want to be able to simulate bit operators? Would that work? I'm not sure Smile

I'll give it a shot anyhow Smile
Reply
#5
I released a new version with the 'pixeli' function and 'set colori' command. I didn't add any bitwise operators but provided some helper functions in the release post. Hope it helps!
Reply
#6
Cool... I am about to turn in for the evening... I will "take it out for a spin" in the morning... Your efforts are appreciated. Thank you.
Logic is the beginning of wisdom.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)