mirror of
https://github.com/love2d/love.git
synced 2026-08-16 16:20:42 +02:00
Added Canvas:getPixel(x, y). (pull request #17)
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user