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

Filled circle with circular gradient in ruby

For general discussion related FlowStone

Filled circle with circular gradient in ruby

Postby tester » Sat Dec 30, 2017 11:49 am

Could someone post how to draw a circle/ellipse in ruby, that is filled with circular gradient? (one color in the center, other color outside). I'm confused a bit with the manual - it speaks on multipoint/coordinate gradients for polygons; I just need a simple ruby replacement for circle drawing prims.
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
tester
 
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

Re: Filled circle with circular gradient in ruby

Postby adamszabo » Sat Dec 30, 2017 12:11 pm

try this:

Code: Select all
def draw v

c1 = Color.new 0,35,247
c2 = Color.new 210,34,67

r = [2,2,12,12]
p = GraphicsPath.new
p.addEllipse r
b = PathGradientBrush.new p

b.setSurroundColors [c1]
b.setCenterColor c2
b.setCenterPoint 8,8
b.setBlend [[0,0],[1,1],[1,1]]

v.drawEllipse b,r
end
adamszabo
 
Posts: 667
Joined: Sun Jul 11, 2010 7:21 am

Re: Filled circle with circular gradient in ruby

Postby tulamide » Sat Dec 30, 2017 1:19 pm

adamszabo wrote:try this:

Code: Select all
def draw v

c1 = Color.new 0,35,247
c2 = Color.new 210,34,67

r = [2,2,12,12]
p = GraphicsPath.new
p.addEllipse r
b = PathGradientBrush.new p

b.setSurroundColors [c1]
b.setCenterColor c2
b.setCenterPoint 8,8
b.setBlend [[0,0],[1,1],[1,1]]

v.drawEllipse b,r
end

:o You've become a real pro at Ruby!
"There lies the dog buried" (German saying translated literally)
tulamide
 
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: Filled circle with circular gradient in ruby

Postby adamszabo » Sat Dec 30, 2017 2:02 pm

tulamide wrote: :o You've become a real pro at Ruby!


Haha, nah im still far from that :D
adamszabo
 
Posts: 667
Joined: Sun Jul 11, 2010 7:21 am

Re: Filled circle with circular gradient in ruby

Postby tester » Sun Dec 31, 2017 11:34 am

Hey Adam, basically I need to integrate it into something like this. the csiz is diameter (2r). Center should have one color, and outer - second color.
Attachments
drawingdots.fsm
(635 Bytes) Downloaded 890 times
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
tester
 
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

Re: Filled circle with circular gradient in ruby

Postby tulamide » Sun Dec 31, 2017 12:53 pm

You mean the equivalent of the prims "Ellipse" and "Filled Ellipse"?

Just use a pen for outlines with :drawEllipse
and a brush for fills with :drawEllipse

Flowstone user guide, page 158+ for more information.
"There lies the dog buried" (German saying translated literally)
tulamide
 
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: Filled circle with circular gradient in ruby

Postby tester » Sun Dec 31, 2017 10:38 pm

tulamide - may I ask you to not participate in topics, in which I'm OP? Thank you.
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
tester
 
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

Re: Filled circle with circular gradient in ruby

Postby tulamide » Sun Dec 31, 2017 11:24 pm

tester - of course you may ask. What I do or not do is not up to you, but I'm glad you show your animosity, for whatever reason. You're welcome!
"There lies the dog buried" (German saying translated literally)
tulamide
 
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: Filled circle with circular gradient in ruby

Postby Spogg » Mon Jan 01, 2018 11:13 am

tester wrote:tulamide - may I ask you to not participate in topics, in which I'm OP? Thank you.


Speaking as a moderator I don’t think it’s acceptable to bar anyone from responding to a topic. A member posting here always has the option of not responding to a comment, for any reason.

If a post is considered to be unacceptable, for any reason whatsoever, please report it, with a reason, and a moderator will review the content.

In this particular instance I can’t judge the technical aspect of tulamide’s post but it may be useful to others following the subject.

As I’ve come to say lately, let’s keep it sweet guys!

Cheers

Spogg
User avatar
Spogg
 
Posts: 3358
Joined: Thu Nov 20, 2014 4:24 pm
Location: Birmingham, England

Re: Filled circle with circular gradient in ruby

Postby tester » Mon Jan 01, 2018 2:16 pm

Spogg, as a moderator - should you interfere at this point? Tricky question, isn't it?

Let say, that my motivation is a non-strict parallel to someone else who was recently pretty active on the forum.

I bet this thread is dead now.
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
tester
 
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

Next

Return to General

Who is online

Users browsing this forum: No registered users and 54 guests