Added Canvas:getPixel(x, y). (pull request #17)

This commit is contained in:
rude
2012-10-17 21:33:10 -04:00
parent 4e2c424cd1
commit ba4cf6204d
4 changed files with 37 additions and 0 deletions
+12
View File
@@ -458,6 +458,18 @@ love::image::ImageData *Canvas::getImageData(love::image::Image *image)
return img;
}
void Canvas::getPixel(unsigned char* pixel_rgba, int x, int y)
{
strategy->bindFBO( fbo );
glReadPixels(x, height - y, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, pixel_rgba);
if (current)
strategy->bindFBO( current->fbo );
else
strategy->bindFBO( 0 );
}
void Canvas::setFilter(const Image::Filter &f)
{
bindTexture(img);