From a91b3189fcd95f6ac7354ffd1266ee4b90f075fd Mon Sep 17 00:00:00 2001 From: Andy Meneely Date: Fri, 18 Jul 2014 15:36:58 -0400 Subject: [PATCH] Adding in alpha transparency to png --- lib/squib/api/image.rb | 4 ++-- lib/squib/graphics/image.rb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/squib/api/image.rb b/lib/squib/api/image.rb index 98a171b..368e86b 100644 --- a/lib/squib/api/image.rb +++ b/lib/squib/api/image.rb @@ -1,10 +1,10 @@ module Squib class Deck - def png(range: :all, file: nil, x: 0, y: 0) + def png(range: :all, file: nil, x: 0, y: 0, alpha: 1.0) range = rangeify(range) file = fileify(file) - range.each{ |i| @cards[i].png(file, x, y) } + range.each{ |i| @cards[i].png(file, x, y, alpha) } end def svg(range: :all, file: nil, x: 0, y: 0) diff --git a/lib/squib/graphics/image.rb b/lib/squib/graphics/image.rb index 7efaf98..8741727 100644 --- a/lib/squib/graphics/image.rb +++ b/lib/squib/graphics/image.rb @@ -1,11 +1,11 @@ module Squib class Card - def png(file, x, y) + def png(file, x, y, alpha) cc = cairo_context png = Cairo::ImageSurface.from_png(file) cc.set_source(png, x, y) - cc.paint + cc.paint(alpha) end def svg(file, x, y)