Sha256: 50fd04bb5de47ea676a23c814a9f9ef3aaef44e165dd925e5b87f9ae272be457

Contents?: true

Size: 1.09 KB

Versions: 6

Compression:

Stored size: 1.09 KB

Contents

# frozen_string_literal: true

module Magick
  class Draw
    # Additional method to scale annotation text since Draw.scale doesn't.
    def annotate_scaled(img, width, height, x, y, text, scale)
      scaled_width = (width * scale) >= 1 ? (width * scale) : 1
      scaled_height = (height * scale) >= 1 ? (height * scale) : 1

      annotate(img,
               scaled_width, scaled_height,
               x * scale, y * scale,
               text.gsub('%', '%%'))
    end

    remove_method :stroke_opacity
    def stroke_opacity(_opacity)
      raise '#stroke_opacity method has different behavior between RMagick and RMagick4J. Should not use this method.'
    end

    if defined? JRUBY_VERSION
      # FIXME(uwe):  We should NOT need to implement this method.
      #              Remove this method as soon as RMagick4J Issue #16 is fixed.
      #              https://github.com/Serabe/RMagick4J/issues/16
      def fill=(fill)
        fill = { white: '#FFFFFF' }[fill.to_sym] || fill
        @draw.fill = Magick4J.ColorDatabase.query_default(fill)
        self
      end
      # EMXIF
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
gruff-0.11.0 lib/gruff/patch/rmagick.rb
gruff-0.11.0-java lib/gruff/patch/rmagick.rb
gruff-0.10.0 lib/gruff/patch/rmagick.rb
gruff-0.10.0-java lib/gruff/patch/rmagick.rb
gruff-0.9.0 lib/gruff/patch/rmagick.rb
gruff-0.9.0-java lib/gruff/patch/rmagick.rb