PICO-8 Wiki
No edit summary
Tags: Visual edit apiedit
(links)
Tag: Source edit
 
(3 intermediate revisions by the same user not shown)
Line 8: Line 8:
   
 
It will read from the buffer even if the buffer has not yet been copied to the display.
 
It will read from the buffer even if the buffer has not yet been copied to the display.
  +
  +
It will return 0 (black) if given coordinates outside the range (0-127,0-127).
   
 
== Examples ==
 
== Examples ==
  +
<syntaxhighlight lang="lua">
<pre>
 
 
pset(10, 10, 7) -- sets (10, 10) to white
 
pset(10, 10, 7) -- sets (10, 10) to white
 
print(pget(10, 10), 0, 112, 7) -- prints 7
 
print(pget(10, 10), 0, 112, 7) -- prints 7
Line 18: Line 20:
   
 
flip() -- displays the red (8) pixel and the messages
 
flip() -- displays the red (8) pixel and the messages
  +
</syntaxhighlight>
</pre>
 
   
 
== See also ==
 
== See also ==
   
 
* [[Graphics]]
 
* [[Graphics]]
* [[Pset|pset]]
+
* <code>[[Mget|mget()]]</code>
  +
* <code>[[Mset|mset()]]</code>
  +
* <code>[[Pset|pset()]]</code>
  +
* <code>[[Sget|sget()]]</code>
  +
* <code>[[Sset|sset()]]</code>
 
[[Category:Reference]]
 
[[Category:Reference]]
 
[[Category:API]]
 
[[Category:API]]

Latest revision as of 23:12, 12 March 2021

pget( x, y )
Gets the color value of a pixel at the given coordinates.
x
The x coordinate.

y
The y coordinate.

The pget() function reads the color value of a pixel from the graphics buffer.

It will read from the buffer even if the buffer has not yet been copied to the display.

It will return 0 (black) if given coordinates outside the range (0-127,0-127).

Examples[]

pset(10, 10, 7)                 -- sets (10, 10) to white
print(pget(10, 10), 0, 112, 7)  -- prints 7

pset(10, 10, 8)                 -- sets (10, 10) to red
print(pget(10, 10), 0, 120, 7)  -- prints 8

flip()  -- displays the red (8) pixel and the messages

See also[]