Page 1 of 2
Rectangle & Ellipse Module in Ruby
Posted: Wed Aug 21, 2013 8:50 pm
by chackl
Hello!
Today a was making some GUI in ruby and as a "Lession" i did a port of the old Rectangle & Ellipse Modules from Synthmaker V3 / FlowStone V2

- rect&ell.png (112.4 KiB) Viewed 34696 times
As you see i also did properties for config
What is new is the Hatch-Brush.
If you have any ideas for updates/upgrades please write here

Base-Module - Free4Use in any Project.
For all Ruby nerds - please take a look how i did port all variables from te properties to the main module - maybe there is a better solution - if someone could do that

Best Regards
Re: Rectangle & Ellipse Module in Ruby
Posted: Wed Aug 21, 2013 9:15 pm
by Jay
very nice m8! cheers for these they will come in really handy! more please!

Best Regards
Re: Rectangle & Ellipse Module in Ruby
Posted: Thu Aug 22, 2013 6:27 am
by RJHollins
Very nice modules and coding chackl !
Thanks for sharing your work. These are items needed for most any project.
Thanks again !!

Re: Rectangle & Ellipse Module in Ruby
Posted: Thu Aug 22, 2013 7:54 am
by billv
Very handy at the moment...Thanks for sharing.
Cheers.
Re: Rectangle & Ellipse Module in Ruby
Posted: Thu Aug 22, 2013 11:11 am
by trogluddite
Hi chackl - nice stuff, bringing some of the new Ruby graphics options to a simple module.
Here's my version of the "options hasher". The @vals data is stored using the saveState/loadState methods, so there's no need for the 'input scanner, so there are far fewer events and triggers kicking about...
PS) Ruby instance variables (NOT local variables) can always be read, even before they are declared - returning nil if undefined. And there is a shorthand method for testing nils, ".nil?"
So...
...can be simply written as...
The "
||=" that's used in my code is also very handy in situations like this. It's usually known as "OR-equals" - if the variable is undefined, nil or false, it gets assigned the right hand value, otherwise the old value is kept. Just take care if the variable is holding a boolean (true/false) value, though, as 'false' would be overwritten!
Re: Rectangle & Ellipse Module in Ruby
Posted: Thu Aug 22, 2013 12:01 pm
by chackl
Thanks for the example i'll update it within the next version

And thanks for the little ruby lesson

- I've just began to understand ruby and i'm now experimenting with custom objects and classes.
Thank you

Re: Rectangle & Ellipse Module in Ruby
Posted: Thu Oct 31, 2013 5:18 am
by billv
@chackl..... may have a little bug...
if change fill style to 'solid'
.no color changes possible.... no hatching either... ??..
Re: Rectangle & Ellipse Module in Ruby
Posted: Thu Oct 31, 2013 5:36 am
by nix
love the hatching brushes mr. Hackl
is it possible somehow to define the size of the hatches?
Re: Rectangle & Ellipse Module in Ruby
Posted: Tue Nov 05, 2013 1:20 pm
by chackl
nix wrote:love the hatching brushes mr. Hackl
is it possible somehow to define the size of the hatches?
Thanks

Well i did not find anything - if someone finds a metode i can add it

Re: Rectangle & Ellipse Module in Ruby
Posted: Tue Nov 05, 2013 1:22 pm
by chackl
billv wrote:@chackl..... may have a little bug...
if change fill style to 'solid'
.no color changes possible.... no hatching either... ??..
Well a hatch allways needs 2 colors

So Hatch is an addition to solid/Linear/Radial.