gl_tex_info
to read out the pixels in an image using OpenGL, but that's exactly what Image#to_blob
is doing for you, except that you need an extension to make use of gl_tex_info
(the opengl
gem).Image#[]
method I've linked to is the exact equivalent of the Löve2D function you've mentioned. But if you need a way to read out an individual image's pixels _under the mouse cursor_, you also need to know where each image has been drawn. You can't take a screenshot of the window and read individual pixels from that (at least not without extensions).@country_image[(mouse_x - @image_left).to_i, (mouse_y - @image_top).to_i]
. If pixel[3].ord != 0
, the pixel is not transparent.Image#[]
with some bounds checking in the old post I've linked to above. Also, :retro
only sets a few OpenGL parameters that change how the image is rendered when it is stretched or rotated, it does not affect the image's pixel data.)
> Also, :retro only sets a few OpenGL parameters that change how the image is rendered when it is stretched or rotated, it does not affect the image's pixel data.
enable_undocumented_retrofication
was a only temporary hack while I was working on the :retro
flag, which is the new way of doing things: Image.new("filename.png", retro: true)
Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill