Undocumented Ruby feature
Posted: Wed Dec 31, 2014 12:03 pm
Just a quick visit to tell you about a Ruby feature I discovered while working on the sprite font engine.
This mimics the green Bitmap prim. It creates a bitmap and fills it with the image found at the given path. If no image is found, nil is returned. Just take care to never use an empty string, it will crash Flowstone immediatly. Wrong strings, like "abc" are ok, nil will be returned then. You can of course use a variable for the path string.
After having created a bitmap this way, all functionality described in the manual is valid for this one as well (.width, .height, .widthPixels, .heightPixels ...)
Code: Select all
# myimage = Bitmap.new "the path"
myimage = Bitmap.new "C:\image.png"This mimics the green Bitmap prim. It creates a bitmap and fills it with the image found at the given path. If no image is found, nil is returned. Just take care to never use an empty string, it will crash Flowstone immediatly. Wrong strings, like "abc" are ok, nil will be returned then. You can of course use a variable for the path string.
After having created a bitmap this way, all functionality described in the manual is valid for this one as well (.width, .height, .widthPixels, .heightPixels ...)