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
Filled circle with circular gradient in ruby
19 posts
• Page 1 of 2 • 1, 2
Filled circle with circular gradient in ruby
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.
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
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: 657
- Joined: Sun Jul 11, 2010 7:21 am
Re: Filled circle with circular gradient in ruby
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
You've become a real pro at Ruby!
"There lies the dog buried" (German saying translated literally)
- tulamide
- Posts: 2687
- Joined: Sat Jun 21, 2014 2:48 pm
- Location: Germany
Re: Filled circle with circular gradient in ruby
tulamide wrote: You've become a real pro at Ruby!
Haha, nah im still far from that
- adamszabo
- Posts: 657
- Joined: Sun Jul 11, 2010 7:21 am
Re: Filled circle with circular gradient in ruby
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 866 times
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
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
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.
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: 2687
- Joined: Sat Jun 21, 2014 2:48 pm
- Location: Germany
Re: Filled circle with circular gradient in ruby
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.
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
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: 2687
- Joined: Sat Jun 21, 2014 2:48 pm
- Location: Germany
Re: Filled circle with circular gradient in ruby
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
-
Spogg - Posts: 3323
- Joined: Thu Nov 20, 2014 4:24 pm
- Location: Birmingham, England
Re: Filled circle with circular gradient in ruby
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.
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.
Feel free to donate. Thank you for your contribution.
- tester
- Posts: 1786
- Joined: Wed Jan 18, 2012 10:52 pm
- Location: Poland, internet
19 posts
• Page 1 of 2 • 1, 2
Who is online
Users browsing this forum: No registered users and 26 guests