lib/rvg/rvg.rb in rmagick-5.5.0 vs lib/rvg/rvg.rb in rmagick-6.0.0

- old
+ new

@@ -39,12 +39,10 @@ require 'rvg/pathdata' require 'rvg/clippath' require 'rvg/paint' require 'rvg/units' -require 'pp' if ENV['debug_rvg'] - # RVG is the main class in this library. All graphic elements # must be contained within an RVG object. module Magick class RVG include Stylable @@ -106,11 +104,11 @@ canvas end if ENV['debug_prim'] def print_gc(gc) - primitives = gc.inspect.split(/\n/) + primitives = gc.inspect.split("\n") indent = 0 primitives.each do |cmd| indent -= 1 if cmd['pop '] print((' ' * indent), cmd, "\n") indent += 1 if cmd['push '] @@ -170,21 +168,21 @@ # Sets the canvas background color. Either a Magick::Pixel or a color name. # The default fill is "none", that is, transparent black. def background_fill=(color) warn 'background_fill= has no effect in nested RVG objects' if @nested - if !color.is_a?(Magick::Pixel) + if color.is_a?(Magick::Pixel) + @background_fill = color + else begin @background_fill = Magick::Pixel.from_color(color) rescue Magick::ImageMagickError raise ArgumentError, "unknown color `#{color}'" rescue TypeError raise TypeError, "cannot convert #{color.class} into Pixel" rescue StandardError raise ArgumentError, "argument must be a color name or a Pixel (got #{color.class})" end - else - @background_fill = color end end # Opacity of the background fill color, a number between 0.0 (transparent) and # 1.0 (opaque). The default is 1.0 when the background_fill= attribute has been set.