Sha256: ed965fac80bc2222def5f39fa4efdaa1b272075962fe693bca51398f0270ce59

Contents?: true

Size: 861 Bytes

Versions: 52

Compression:

Stored size: 861 Bytes

Contents

#! /usr/local/bin/ruby -w
require 'RMagick'

imgl = Magick::ImageList.new
imgl.new_image(390, 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(20,120, 95,20, 245,20, 320,120)

# Draw circles around endpoints
gc.fill_opacity(0)
gc.stroke('gray50').stroke_width(1)
gc.circle(20,120, 23, 123)
gc.circle(320,120, 323, 123)

# Draw filled circles around control points
gc.line(20,120, 95,20)
gc.line(320,120, 245,20)
gc.fill_opacity(1)
gc.fill('gray50')
gc.circle(95,20, 98,23)
gc.circle(245,20, 248,23)

# Annotate
gc.fill('black')
gc.stroke('transparent')
gc.text(29,120, "'20,120'")
gc.text(104,20,  "'95,20'")
gc.text(254,20,  "'245,20'")
gc.text(329,120, "'320,120'")

gc.draw(imgl)
imgl.border!(1,1, 'lightcyan2')

imgl.write('cbezier5.gif')
exit(0)

Version data entries

52 entries across 52 versions & 1 rubygems

Version Path
rmagick-2.0.0 doc/ex/cbezier5.rb
rmagick-2.2.2 doc/ex/cbezier5.rb
rmagick-2.3.0 doc/ex/cbezier5.rb
rmagick-2.5.2 doc/ex/cbezier5.rb
rmagick-2.4.0 doc/ex/cbezier5.rb
rmagick-2.5.0 doc/ex/cbezier5.rb
rmagick-2.5.1 doc/ex/cbezier5.rb
rmagick-2.6.0 doc/ex/cbezier5.rb
rmagick-2.8.0 doc/ex/cbezier5.rb
rmagick-2.7.2 doc/ex/cbezier5.rb
rmagick-2.7.1 doc/ex/cbezier5.rb
rmagick-2.7.0 doc/ex/cbezier5.rb