File: initial_coords.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 (22 lines) | stat: -rw-r--r-- 691 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
require 'rvg/rvg'

rvg = Magick::RVG.new(300, 100) do |canvas|
  canvas.desc = "Example - SVG's initial coordinate system"
  canvas.background_fill = 'white'
  canvas.g.styles(fill: 'none', stroke: 'black', stroke_width: 3) do |grp|
    grp.line(0, 1.5, 300, 1.5)
    grp.line(1.5, 0, 1.5, 100)
  end
  canvas.g.styles(fill: 'red', stroke: 'none') do |grp|
    grp.rect(3, 3)
    grp.rect(3, 3, 297, 0)
    grp.rect(3, 3,   0, 97)
  end
  canvas.g.styles(font_size: 14, font_family: 'Verdana', font_weight: 'normal', font_style: 'normal') do |grp|
    grp.text(10, 20, '(0,0)')
    grp.text(240, 20, '(300,0)')
    grp.text(10, 90, '(0,100)')
  end
end

rvg.draw.write('initial_coords.gif')