Sha256: 07fdb0b6999c99aba4675bd7b4dc1d51b15fe41f5d5b4ac007a176152244d6ac

Contents?: true

Size: 1.51 KB

Versions: 15

Compression:

Stored size: 1.51 KB

Contents

require 'rvg/rvg'

rvg = Magick::RVG.new(400, 120) do |canvas|
    canvas.desc = 'Example RotateScale - Rotate and scale transforms'
    canvas.background_fill = 'white'
    canvas.g.styles(:fill=>'none', :stroke=>'black', :stroke_width=>3) do |grp|
        # Draw the axes of the original coordinate system
        grp.line(0, 1.5, 400, 1.5)
        grp.line(1.5, 0, 1.5, 120)
    end
    # Establish a new coordinate system whose origin is at (50,30)
    # in the original coord. system and which is rotated by 30 degrees.
    canvas.g.translate(50,30) do |grp|
        grp.g.rotate(30) do |grp2|
            grp2.g.styles(:fill=>'none',:stroke=>'red',:stroke_width=>3) do |grp3|
                grp3.line(0, 0, 50, 0)
                grp3.line(0, 0, 0, 50)
            end
            grp2.text(0, 0, "ABC (rotate)").styles(:font_size=>20, :fill=>'blue', :font_family=>'Verdana', :font_weight=>'normal', :font_style=>'normal')
        end
    end

    # Establish a new coordinate system whose origin is at (200,40)
    # in the original coord. systm and which is scaled by 1.5
    canvas.g.translate(200,40) do |grp|
        grp.g.scale(1.5) do |grp2|
            grp2.g.styles(:fill=>'none',:stroke=>'red',:stroke_width=>3) do |grp3|
                grp3.line(0, 0, 50, 0)
                grp3.line(0, 0, 0, 50)
            end
            grp2.text(0, 0, "ABC (scale)").styles(:font_size=>20, :fill=>'blue', :font_family=>'Verdana', :font_weight=>'normal', :font_style=>'normal')
        end
    end
end

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

Version data entries

15 entries across 15 versions & 2 rubygems

Version Path
rmagick-2.13.4 doc/ex/RotateScale.rb
rmagick-2.13.3 doc/ex/RotateScale.rb
rmagick-2.13.3.rc1 doc/ex/RotateScale.rb
rmagick-2.13.2 doc/ex/RotateScale.rb
rdp-rmagick-0.0.0 doc/ex/RotateScale.rb
rmagick-2.13.1 doc/ex/RotateScale.rb
rmagick-2.12.2 doc/ex/RotateScale.rb
rmagick-2.12.1 doc/ex/RotateScale.rb
rmagick-2.12.0 doc/ex/RotateScale.rb
rmagick-2.11.1 doc/ex/RotateScale.rb
rmagick-2.10.0 doc/ex/RotateScale.rb
rmagick-2.11.0 doc/ex/RotateScale.rb
rmagick-2.9.2 doc/ex/RotateScale.rb
rmagick-2.9.0 doc/ex/RotateScale.rb
rmagick-2.9.1 doc/ex/RotateScale.rb