Sha256: 4296339fb535acc04e7ea5d3976c98afd21213e1936e16beaee8d125c41cee82
Contents?: true
Size: 713 Bytes
Versions: 1
Compression:
Stored size: 713 Bytes
Contents
require 'chunky_png' require 'mittsu/extras/image' module Mittsu class ImageLoader attr_accessor :manager def initialize(manager = DefaultLoadingManager) @manager = manager end def load(url, flip: false, flop: false) chache_url = "#{url}?flip=#{flip}&flop=#{flop}" cached = Cache.get(chache_url) return cached unless cached.nil? png_image = ChunkyPNG::Image.from_file(url) png_image.flip_horizontally! if flip png_image.flip_vertically! if flop rgba_data = png_image.to_rgba_stream image = Image.new(png_image.width, png_image.height, rgba_data) Cache.add(url, image) @manager.item_start(url) image end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mittsu-0.1.6 | lib/mittsu/loaders/image_loader.rb |