Support

If you have a problem or need to report a bug please email : support@dsprobotics.com

There are 3 sections to this support area:

DOWNLOADS: access to product manuals, support files and drivers

HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects

USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here

NEW REGISTRATIONS - please contact us if you wish to register on the forum

Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright

Undocumented Ruby feature

For general discussion related FlowStone

Undocumented Ruby feature

Postby tulamide » 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.

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 ...)
"There lies the dog buried" (German saying translated literally)
tulamide
 
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: Undocumented Ruby feature

Postby Exo » Wed Dec 31, 2014 12:17 pm

Very cool, nice find :D

I think that must have been added recently and Malc forgot to put it on the change list.
Flowstone Guru. Blog and download site for Flowstone.
Best VST Plugins. Initial Audio.
Exo
 
Posts: 426
Joined: Wed Aug 04, 2010 8:58 pm
Location: UK

Re: Undocumented Ruby feature

Postby tulamide » Sat Jan 03, 2015 4:55 pm

Even more undocumented features:

Color object

setARGB
set any or all color channels using the same options as with .new (one number sets opaque grey shade, 2 numbers set alpha and grey, 4 numbers set argb)
Code: Select all
c = Color.new 255, 8, 16, 24
c.setARGB 128, 8, 16, 24


getARGB
get the color channel values as a four-element-array
Code: Select all
c = Color.new 255, 8, 16, 24
argb = c.getARGB
#returns [255, 8, 16, 24]
"There lies the dog buried" (German saying translated literally)
tulamide
 
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany


Return to General

Who is online

Users browsing this forum: No registered users and 79 guests