Rails MiniMagick中的不符合图形原语定义“line”。绘制文本有效,但行没有

时间:2014-05-26 16:11:07

标签: ruby-on-rails imagemagick minimagick

您好我有以下代码:

front_piece = MiniMagick::Image.open("public/#{@asset.file_name.url}")
front_piece.crop("450x441+50+0")
front_piece.combine_options do |c|
c.alpha "set"
c.virtual_pixel "transparent"
c.distort :Perspective, '0,0,100,0,500,0,350,50,500,441,350,341,0,441,100,441'
c.fill "white"
c.draw "text 25,100 'My Text'"
c.draw "line '10,10 20,20'"
end

绘制文本行工作正常,但绘制线会抛出错误:不符合绘图原始定义`line'

我已尝试使用以下其他语法,但仍然无法正常工作..

c.draw "line '10,10,20,20'"
c.draw "line,10,10,20,20"
c.draw "line 10,10 20,20"

我无法像矩形等那样得到其他绘画工作..但我只关心线

1 个答案:

答案 0 :(得分:0)

要绘制线条,您应该使用:

c.draw "line 10,10 20,20"