Sha256: 23971030bdc79f575d27d243be114a0901d858d6268d7476011b14e8f76fa226

Contents?: true

Size: 776 Bytes

Versions: 2

Compression:

Stored size: 776 Bytes

Contents

begin
  require 'oily_png'
rescue LoadError
  require 'chunky_png'
end

module Compass
  module SassExtensions
    module Sprites
      class ChunkyPngEngine < Compass::SassExtensions::Sprites::Engine

        def construct_sprite
          @canvas = ChunkyPNG::Image.new(width, height, ChunkyPNG::Color::TRANSPARENT)
          images.each do |image|
            input_png  = ChunkyPNG::Image.from_file(image.file)
            canvas.replace! input_png, image.left, image.top
          end
        end    
        
        def save(filename)
          if canvas.nil?
            construct_sprite
          end
          
          canvas.save(filename,  Compass.configuration.chunky_png_options)
        end
        
      end
    end
  end
end  

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
compass-sourcemaps-0.12.3.sourcemaps.a4836f1 lib/compass/sass_extensions/sprites/engines/chunky_png_engine.rb
compass-sourcemaps-0.12.2.sourcemaps.57a186c lib/compass/sass_extensions/sprites/engines/chunky_png_engine.rb