Sha256: c401c088c5cef7ce570cf23e964421e411c6da0ae460b54302545e4addcb17cb

Contents?: true

Size: 1.39 KB

Versions: 13

Compression:

Stored size: 1.39 KB

Contents

require 'rvg/rvg'

rvg = Magick::RVG.new(400, 120) do |canvas|
  canvas.desc = 'Example Skew - Show effects of skewX and skewY'
  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

  # Establisha new coordinate system whose origin is at (30,30)
  # in the initial coord. system and which is skewed in X by 30 degrees.
  canvas.g.translate(30,30) do |grp|
    grp.skewX(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
      grp.text(0, 0, 'ABC (skewX)').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,30)
  # in the initial coord. system and which is skewed in Y by 30 degrees.
  canvas.g.translate(200,30) do |grp|
    grp.skewY(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
      grp.text(0, 0, 'ABC (skewY)').styles(:font_size=>20, :fill=>'blue', :font_family=>'Verdana', :font_weight=>'normal', :font_style=>'normal')
    end
  end
end

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

Version data entries

13 entries across 13 versions & 3 rubygems

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