Sha256: 6c7210500a020f30b0236ee731d46514c39220e6d8baa5f65609a31fdb76d9f3

Contents?: true

Size: 987 Bytes

Versions: 10

Compression:

Stored size: 987 Bytes

Contents

# frozen_string_literal: true

# @private
module Magick
  # @private
  module GruffAnnotate
    refine Draw do
      # 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

      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)
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
gruff-0.19.0 lib/gruff/patch/rmagick.rb
gruff-0.19.0-java lib/gruff/patch/rmagick.rb
gruff-0.18.0-java lib/gruff/patch/rmagick.rb
gruff-0.18.0 lib/gruff/patch/rmagick.rb
gruff-0.17.0-java lib/gruff/patch/rmagick.rb
gruff-0.17.0 lib/gruff/patch/rmagick.rb
gruff-0.16.0 lib/gruff/patch/rmagick.rb
gruff-0.16.0-java lib/gruff/patch/rmagick.rb
gruff-0.15.0-java lib/gruff/patch/rmagick.rb
gruff-0.15.0 lib/gruff/patch/rmagick.rb