Adding in alpha transparency to png
parent
131aa56e0a
commit
a91b3189fc
|
|
@ -1,10 +1,10 @@
|
||||||
module Squib
|
module Squib
|
||||||
class Deck
|
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)
|
range = rangeify(range)
|
||||||
file = fileify(file)
|
file = fileify(file)
|
||||||
range.each{ |i| @cards[i].png(file, x, y) }
|
range.each{ |i| @cards[i].png(file, x, y, alpha) }
|
||||||
end
|
end
|
||||||
|
|
||||||
def svg(range: :all, file: nil, x: 0, y: 0)
|
def svg(range: :all, file: nil, x: 0, y: 0)
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
module Squib
|
module Squib
|
||||||
class Card
|
class Card
|
||||||
|
|
||||||
def png(file, x, y)
|
def png(file, x, y, alpha)
|
||||||
cc = cairo_context
|
cc = cairo_context
|
||||||
png = Cairo::ImageSurface.from_png(file)
|
png = Cairo::ImageSurface.from_png(file)
|
||||||
cc.set_source(png, x, y)
|
cc.set_source(png, x, y)
|
||||||
cc.paint
|
cc.paint(alpha)
|
||||||
end
|
end
|
||||||
|
|
||||||
def svg(file, x, y)
|
def svg(file, x, y)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue