Commits

DLaicH committed 3804484 Draft

added documentation

  • Participants
  • Parent commits 1193ba2

Comments (0)

Files changed (1)

+Fork information
+----------------
+
+This fork adds a getPixel(x, y) method to the Canvas object. I created this out of my annoyance with the current method of obtaining pixel data, which is to create a full ImageData object and
+run setPixel() on that. This adds an incredible load if done frequently, such as in the draw loop, but for my purposes I really needed to test pixel data for each frame. The method I've devised
+does not create a significant framerate drop on my system, even when performed in every iteration of the draw loop.
+
+Canvas:getPixel
+---------------
+
+###Synopsis
+
+`r, g, b, a = Canvas:getPixel( x, y )`
+
+###Arguments
+
+[number][number] x
+> The position of the pixel on the x-axis.
+
+[number][number] y
+> The position of the pixel on the y-axis.
+
+###Returns
+
+[number][number] r
+> The red component (0-255).
+
+[number][number] g
+> The green component (0-255).
+
+[number][number] b
+> The blue component (0-255).
+
+[number][number] a
+> The alpha component (0-255).
+
+###See Also
+
+* [ImageData:getPixel](https://love2d.org/wiki/ImageData:getPixel)
+
+* [Canvas](https://love2d.org/wiki/Canvas)
+
+LÖVE
+----
+
 LÖVE is an *awesome* framework you can use to make 2D games in Lua. It's free, open-source, and works on Windows, Mac OS X and Linux.
 
 Documentation
 - mpg123
 - Vorbisfile
 
+[number]: https://love2d.org/wiki/number
 [site]: http://love2d.org
 [wiki]: http://love2d.org/wiki
 [forums]: http://love2d.org/forums