lib/rvg/misc.rb in rmagick-1.8.3 vs lib/rvg/misc.rb in rmagick-1.9.0

- old
+ new

@@ -1,6 +1,6 @@ -# $Id: misc.rb,v 1.5 2005/05/22 22:31:30 rmagick Exp $ +# $Id: misc.rb,v 1.8 2005/07/15 20:48:50 rmagick Exp $ # Copyright (C) 2005 Timothy P. Hunter class Magick::RVG # This is a standard deep_copy method that is used in most classes. # Thanks to Robert Klemme. @@ -93,12 +93,12 @@ text = '{'+text+'}' return text end # escape existing braces, surround with braces - text.gsub!(/([\{}])/) { |b| '\\' + b } - return '{' + @text + '}' + text.gsub!(/[}]/) { |b| '\\' + b } + return '{' + text + '}' end def glyph_metrics(glyph_orientation, glyph) glyph_metrics = @ctx.shadow.get_type_metrics(glyph) h = glyph_metrics.ascent - glyph_metrics.descent @@ -341,11 +341,11 @@ WRITING_MODE = %w{lr-tb lr rl-tb rl tb-rl tb} def initialize() @affine = Array.new - @affine << AffineMatrix.new(1, 0, 0, 1, 0, 0) + @affine << Magick::AffineMatrix.new(1, 0, 0, 1, 0, 0) @baseline_shift = Array.new @baseline_shift << :baseline @glyph_orientation_horizontal = Array.new @glyph_orientation_horizontal << 0 @glyph_orientation_vertical = Array.new @@ -524,23 +524,23 @@ public attr_reader :gc, :text_attrs def initialize() - @gc = Draw.new + @gc = Magick::Draw.new @shadow = Array.new - @shadow << Draw.new + @shadow << Magick::Draw.new @text_attrs = TextAttributes.new init_matrix() end def method_missing(methID, *args, &block) @gc.__send__(methID, *args, &block) end def affine(sx, rx, ry, sy, tx, ty) - sx, rx, ry, sy, tx, ty = RVG.convert_to_float(sx, rx, ry, sy, tx, ty) + sx, rx, ry, sy, tx, ty = Magick::RVG.convert_to_float(sx, rx, ry, sy, tx, ty) @gc.affine(sx, rx, ry, sy, tx, ty) @text_attrs.set_affine(sx, rx, ry, sy, tx, ty) nil end @@ -595,27 +595,27 @@ @shadow[-1].font_weight = weight nil end def glyph_orientation_horizontal(deg) - deg = RVG.convert_one_to_float(deg) + deg = Magick::RVG.convert_one_to_float(deg) @text_attrs.glyph_orientation_horizontal = (deg % 360) / 90 * 90 nil end def glyph_orientation_vertical(deg) - deg = RVG.convert_one_to_float(deg) + deg = Magick::RVG.convert_one_to_float(deg) @text_attrs.glyph_orientation_vertical = (deg % 360) / 90 * 90 nil end def inspect() @gc.inspect end def letter_spacing(value) - @text_attrs.letter_spacing = RVG.convert_one_to_float(value) + @text_attrs.letter_spacing = Magick::RVG.convert_one_to_float(value) nil end def push() @gc.push @@ -630,22 +630,22 @@ @text_attrs.pop nil end def rotate(degrees) - degrees = RVG.convert_one_to_float(degrees) + degrees = Magick::RVG.convert_one_to_float(degrees) @gc.rotate(degrees) @sx = Math.cos(GraphicContext.degrees_to_radians(degrees)) @rx = Math.sin(GraphicContext.degrees_to_radians(degrees)) @ry = -Math.sin(GraphicContext.degrees_to_radians(degrees)) @sy = Math.cos(GraphicContext.degrees_to_radians(degrees)) concat_matrix() nil end def scale(sx, sy) - sx, sy = RVG.convert_to_float(sx, sy) + sx, sy = Magick::RVG.convert_to_float(sx, sy) @gc.scale(sx, sy) @sx, @sy = sx, sy concat_matrix() nil end @@ -653,27 +653,27 @@ def shadow() @shadow.last end def skewX(degrees) - degrees = RVG.convert_one_to_float(degrees) + degrees = Magick::RVG.convert_one_to_float(degrees) @gc.skewX(degrees) @ry = Math.tan(GraphicContext.degrees_to_radians(degrees)) concat_matrix() nil end def skewY(degrees) - degrees = RVG.convert_one_to_float(degrees) + degrees = Magick::RVG.convert_one_to_float(degrees) @gc.skewY(degrees) @rx = Math.tan(GraphicContext.degrees_to_radians(degrees)) concat_matrix() nil end def stroke_width(width) - width = RVG.convert_one_to_float(width) + width = Magick::RVG.convert_one_to_float(width) @gc.stroke_width(width) @shadow[-1].stroke_width = width nil end @@ -704,18 +704,18 @@ @shadow[-1].decorate = decoration nil end def translate(tx, ty) - tx, ty = RVG.convert_to_float(tx, ty) + tx, ty = Magick::RVG.convert_to_float(tx, ty) @gc.translate(tx, ty) @tx, @ty = tx, ty concat_matrix() nil end def word_spacing(value) - @text_attrs.word_spacing = RVG.convert_one_to_float(value) + @text_attrs.word_spacing = Magick::RVG.convert_one_to_float(value) nil end def writing_mode(mode) @text_attrs.writing_mode = mode