Sha256: fcb190a6daa210d273c115fd7697835cad6833c90040e6c64f196acfa6b1b881
Contents?: true
Size: 749 Bytes
Versions: 4
Compression:
Stored size: 749 Bytes
Contents
require 'rmagick' module RailsSprite module Library module RMagick VALID_EXTENSIONS = [:png, :jpg, :jpeg, :gif, :ico] def self.load(filename) image = Magick::Image.read(filename)[0] { :image => image, :width => image.columns, :height => image.rows } end def self.create(filename, images, width, height) target = Magick::Image.new(width, height) target.opacity = Magick::QuantumRange images.each do |image| target.composite!(image[:image], image[:x], image[:y], Magick::SrcOverCompositeOp) end target.write(filename) end end # module RMagick end # module Library end # module SpriteFactory
Version data entries
4 entries across 4 versions & 1 rubygems