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

Ruby Dropshadow Tool

For general discussion related FlowStone

Ruby Dropshadow Tool

Postby adamszabo » Sat Mar 06, 2021 1:54 pm

Here is a tool for creating dropshadows for your shapes, instead of using photoshop. You can dynamically change it any way you like. I used it in my projects, I thought I'd share it with you all. Feel free to improve it ;)
Attachments
adam_ruby_dropshadow_tool_306.fsm
(17.79 KiB) Downloaded 854 times
adamszabo
 
Posts: 657
Joined: Sun Jul 11, 2010 7:21 am

Re: Ruby Dropshadow Tool

Postby Spogg » Sat Mar 06, 2021 4:31 pm

Very impressive Adam! :shock:

Thank you for sharing!
User avatar
Spogg
 
Posts: 3323
Joined: Thu Nov 20, 2014 4:24 pm
Location: Birmingham, England

Re: Ruby Dropshadow Tool

Postby RJHollins » Sat Mar 06, 2021 6:24 pm

Nice !

Thank you for sharing Adam 8-)
RJHollins
 
Posts: 1568
Joined: Thu Mar 08, 2012 7:58 pm

Re: Ruby Dropshadow Tool

Postby tulamide » Sat Mar 06, 2021 8:53 pm

I feel like a father seeing his son going to college! I even have a tear in my eyes.

There are other ways to do it, and probably ways that are quicker, but this is a solid approach to the topic and I just love seeing it done by Adam! Good job!
"There lies the dog buried" (German saying translated literally)
tulamide
 
Posts: 2687
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: Ruby Dropshadow Tool

Postby adamszabo » Sun Mar 07, 2021 5:26 pm

Thanks guys, Im glad you like it ;)

tulamide wrote:There are other ways to do it, and probably ways that are quicker


I would love to see a faster way for learning purposes :ugeek:
adamszabo
 
Posts: 657
Joined: Sun Jul 11, 2010 7:21 am

Re: Ruby Dropshadow Tool

Postby kortezzzz » Tue Mar 09, 2021 2:15 pm

Thank you a lot, Adam. that's a great share 8-)

Am I wrong or this method can be used not only with Ruby own drawn shapes but also with png images?...
User avatar
kortezzzz
 
Posts: 763
Joined: Tue Mar 19, 2013 4:21 pm

Re: Ruby Dropshadow Tool

Postby adamszabo » Tue Mar 09, 2021 2:19 pm

kortezzzz wrote:Thank you a lot, Adam. that's a great share 8-)

Am I wrong or this method can be used not only with Ruby own drawn shapes but also with png images?...


hmm I am not sure, I havent tried it, but I guess it could be possible to draw png images over each other and it can change its opacity to create the shadow effect.
adamszabo
 
Posts: 657
Joined: Sun Jul 11, 2010 7:21 am

Re: Ruby Dropshadow Tool

Postby kortezzzz » Tue Mar 09, 2021 4:10 pm

adamszabo wrote:I guess it could be possible to draw png images over each other and it can change its opacity to create the shadow effect.


Interesting idea :idea:
So what's actually needed is a Ruby command that may darken the second duplicated image. Guess maybe one of our experts here knows if something like that is achieveable?
User avatar
kortezzzz
 
Posts: 763
Joined: Tue Mar 19, 2013 4:21 pm

Re: Ruby Dropshadow Tool

Postby tulamide » Tue Mar 09, 2021 8:57 pm

kortezzzz wrote:
adamszabo wrote:I guess it could be possible to draw png images over each other and it can change its opacity to create the shadow effect.


Interesting idea :idea:
So what's actually needed is a Ruby command that may darken the second duplicated image. Guess maybe one of our experts here knows if something like that is achieveable?

No. But you can pre-edit your images to a darkened version and use that.
"There lies the dog buried" (German saying translated literally)
tulamide
 
Posts: 2687
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: Ruby Dropshadow Tool

Postby tulamide » Tue Mar 09, 2021 9:04 pm

adamszabo wrote:I would love to see a faster way for learning purposes :ugeek:

Here you are. Note, that it is just a prototype. Lots of knobs to play with and lots of code to explore (mostly helper methods). The core is using GDI+ to calculate everything, so it's as fast as it gets. One exception is the shadow_transform() method. Unfortunately Flowstone doesn't provide access to the results of matrix manipulations (like translate) and so I had to do all the calculations manually to have access to the results. It's not much though (but if there are any takers to optimize my rather straight-forward math, go for it).
Attachments
drop_shadow.fsm
(87.59 KiB) Downloaded 845 times
"There lies the dog buried" (German saying translated literally)
tulamide
 
Posts: 2687
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Next

Return to General

Who is online

Users browsing this forum: No registered users and 28 guests