Sha256: d9769407afe707987ab4898b561a7424725d0a7cf0287b90f5b3a376ad0edf41

Contents?: true

Size: 943 Bytes

Versions: 9

Compression:

Stored size: 943 Bytes

Contents

module Bioshogi
  module CoverImage
    concern :BottomTextMethods do
      class_methods do
        def default_params
          super.merge({
              :bottom_text           => nil,
              :bottom_text_pointsize => 48,
              :bottom_text_margin    => 12,
              :bottom_text_gravity   => Magick::SouthGravity,
            })
        end
      end

      private

      def bottom_text_render
        if bottom_text
          gc = Magick::Draw.new
          gc.font      = params[:font_regular].to_s
          gc.fill      = params[:font_color]
          gc.pointsize = params[:bottom_text_pointsize]
          gc.gravity   = params[:bottom_text_gravity]
          margin       = params[:bottom_text_margin]
          gc.annotate(@canvas_layer, 0, 0, margin, margin, bottom_text)
        end
      end

      def bottom_text
        @bottom_text ||= text_normalize(params[:bottom_text])
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
bioshogi-0.0.15 lib/bioshogi/cover_image/bottom_text_methods.rb
bioshogi-0.0.14 lib/bioshogi/cover_image/bottom_text_methods.rb
bioshogi-0.0.10 lib/bioshogi/cover_image/bottom_text_methods.rb
bioshogi-0.0.9 lib/bioshogi/cover_image/bottom_text_methods.rb
bioshogi-0.0.8 lib/bioshogi/cover_image/bottom_text_methods.rb
bioshogi-0.0.7 lib/bioshogi/cover_image/bottom_text_methods.rb
bioshogi-0.0.5 lib/bioshogi/cover_image/bottom_text_methods.rb
bioshogi-0.0.4 lib/bioshogi/cover_image/bottom_text_methods.rb
bioshogi-0.0.3 lib/bioshogi/cover_image/bottom_text_methods.rb