If I run the following commands to create a new bitmap and copy into it from a source bitmap:
bmp = Bitmap.new(rect.width, rect.height)
bmp.blt(0, 0, source, rect)
is there an easy way to tell if the new bitmap contains anything? In the case of a tileset that may only be partially filled, I don't want to continue processing if there were no tiles to copy from the source image.
I've done this, but it didn't work (didn't really expect it to, but had to eliminate the possibility):
return if bmp == Bitmap.new(rect.width, rect.height)
Is there any way other than checking every single pixel for a non-zero alpha?
Edit: I've done the check alpha of every pixel method, and it doesn't take nearly as long as I expected it would, so I don't need a quick answer to this, but I'm still going to leave it open to see if there's an easier/faster way, or a default Bitmap method that will save me having to write a 'check alpha of every pixel' if I ever want to do this again.
bmp = Bitmap.new(rect.width, rect.height)
bmp.blt(0, 0, source, rect)
is there an easy way to tell if the new bitmap contains anything? In the case of a tileset that may only be partially filled, I don't want to continue processing if there were no tiles to copy from the source image.
I've done this, but it didn't work (didn't really expect it to, but had to eliminate the possibility):
return if bmp == Bitmap.new(rect.width, rect.height)
Is there any way other than checking every single pixel for a non-zero alpha?
Edit: I've done the check alpha of every pixel method, and it doesn't take nearly as long as I expected it would, so I don't need a quick answer to this, but I'm still going to leave it open to see if there's an easier/faster way, or a default Bitmap method that will save me having to write a 'check alpha of every pixel' if I ever want to do this again.