true means the pixel has an alpha of over 50%.mask = image.to_blob.unpack('L>*').map{|x| (x & 0xff) >= 0x80 }.join(' ')mask[x + y * image.width]. This is also a very inefficient way to store this information (one pointer to a Ruby object per pixel, plus whatever overhead an Array has), but I'll leave improving on it as an exercise for you. :Dget_pixel(x, y) method (along with several drawing methods and lots of other nifty image manipulation fun that you probably won't need) and test the transparency that way.require 'texplay'
class Gosu::Image
def solid? (x, y); (get_pixel(x, y) & 0xff) >= 0x80; end
endget_pixel(x, y) >> 24 & 0xff.
Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill