8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/compass-rmagick-engine.rb', line 8
def construct_sprite
@canvas = Magick::Image.new(width, height) {
self.background_color = 'none'
}
@canvas.format = 'PNG24'
images.each do |image|
input_png = Magick::Image.read(image.file).first
if image.repeat == "no-repeat"
@canvas = composite_images(@canvas, input_png, image.left, image.top)
else
x = image.left - (image.left / image.width).ceil * image.width
while x < width do
@canvas = composite_images(@canvas, input_png, x, image.top)
x += image.width
end
end
end
@canvas
end
|