File: polyline.rb

package info (click to toggle)
ruby-rmagick 6.0.1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 8,232 kB
  • sloc: cpp: 19,563; ruby: 17,147; sh: 88; javascript: 36; makefile: 13
file content (23 lines) | stat: -rw-r--r-- 567 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
require 'rmagick'

imgl = Magick::ImageList.new
imgl.new_image(300, 100, Magick::HatchFill.new('white', 'lightcyan2'))

points = [
  12, 93.75, 37, 93.75, 37, 81.25, 62, 81.25,
  62, 93.75, 87, 93.75, 87, 62, 112, 62, 112, 93.75,
  137, 93.75, 137, 43.75, 162, 43.75, 162, 93.75,
  187, 93.75, 187, 25,    212, 25,    212, 93.75, 237, 93.75,
  237, 6.25,  262, 6.25,  262, 93.75, 287, 93.75
]

gc = Magick::Draw.new
gc.stroke('blue').stroke_width(3)
gc.fill_opacity(0)
gc.polyline(*points)

gc.draw(imgl)

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

imgl.write('polyline.gif')