55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
# File 'lib/squib/dsl/text_embed.rb', line 55
def png(opts = {})
warn_if_unexpected opts
key = Args::EmbedKey.new.validate_key(opts[:key])
range = Args. opts, deck
paint = Args. opts, deck
box = Args. opts, deck, { width: :native, height: :native }
adjust = Args::EmbedAdjust.new.load!(opts, expand_by: deck.size, layout: deck.layout, dpi: deck.dpi)
trans = Args. opts, deck
ifile = Args. opts, deck
rule = { type: :png, file: ifile, box: box, paint: paint, trans: trans, adjust: adjust }
rule[:draw] = Proc.new do |card, x, y, scale|
i = card.index
b = box[i]
b.x, b.y = x, y
b.width = b.width * scale if b.width.is_a? Numeric
b.height = b.height * scale if b.height.is_a? Numeric
Dir.chdir(deck.img_dir) do
card.png(ifile[i].file, b, paint[i], trans[i])
end
end
@rules[key] = rule
end
|