Sha256: 085825bd6210a8d3009123f1e751d98dddd3f6320c2920561a8b3aef628ee2a1

Contents?: true

Size: 932 Bytes

Versions: 13

Compression:

Stored size: 932 Bytes

Contents

#!/usr/bin/env ruby -w
require 'rmagick'

imgl = Magick::ImageList.new
imgl.new_image(470, 150, Magick::HatchFill.new('white','lightcyan2'))
gc = Magick::Draw.new

# Draw Bezier curve
gc.stroke('red')
gc.stroke_width(3)
gc.fill_opacity(0)
gc.bezier(25,125, 100,25, 400,25, 325,125)

# Draw circles around end points
gc.fill_opacity(0)
gc.stroke('gray50').stroke_width(1)
gc.circle(25,125, 28, 128)
gc.circle(325,125, 328, 123)

# Draw filled circles around control points
gc.line(25,125, 100,25)
gc.line(325,125, 400,25)
gc.fill_opacity(1)
gc.fill('gray50')
gc.circle(100,25, 103,28)
gc.circle(400,25, 403,28)

# Annotate
gc.font_weight(Magick::NormalWeight)
gc.font_style(Magick::NormalStyle)
gc.fill('black')
gc.stroke('transparent')
gc.text(34,125, "'25,125'")
gc.text(107,25, "'100,25'")
gc.text(335,125, "'325,125'")
gc.text(405,25, "'400,25'")

gc.draw(imgl)
imgl.border!(1,1, 'lightcyan2')
imgl.write('cbezier2.gif')
exit(0)

Version data entries

13 entries across 13 versions & 3 rubygems

Version Path
rmagick-windows-2.16.5 doc/ex/cbezier2.rb
rmagick-windows-2.16.4 doc/ex/cbezier2.rb
rmagick-windows-2.16.3 doc/ex/cbezier2.rb
rmagick-windows-2.16.2 doc/ex/cbezier2.rb
rmagick-windows-2.16.1 doc/ex/cbezier2.rb
mdg-1.0.1 vendor/bundle/ruby/2.3.0/gems/rmagick-2.16.0/doc/ex/cbezier2.rb
rmagick-2.16.0 doc/ex/cbezier2.rb
rmagick-2.15.4 doc/ex/cbezier2.rb
rmagick-2.15.3 doc/ex/cbezier2.rb
rmagick-2.15.2 doc/ex/cbezier2.rb
rmagick-2.15.1 doc/ex/cbezier2.rb
rmagick-2.15.0 doc/ex/cbezier2.rb
rmagick-2.14.0 doc/ex/cbezier2.rb