Sha256: de8936f5296e4723f8d4f0bca797dc4a54e0b6847d32e3c0db5989b1187ee3e2

Contents?: true

Size: 494 Bytes

Versions: 2

Compression:

Stored size: 494 Bytes

Contents

module Cheers
  class Texture < ImageComponent
    
    IMAGES = %w( texture.png )
    
    attr_reader :color, :image
    
    def initialize(canvas, color_randomizer, element_randomizer = nil)
      super
      
      @image = IMAGES.sample random: element_randomizer
    end
    
    def apply
      texture = MiniMagick::Image.open(image_path(image))
      canvas.composite(texture) do |c|
        c.compose "Over"    # OverCompositeOp
        c.geometry "+0+0"
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cheers-0.0.4 lib/cheers/texture.rb
cheers-0.0.3 lib/cheers/texture.rb