Use cairo context wrapper for fill colors on marketing

Actually deliver what I promised

Fixes #71
dev
Andy Meneely 2015-05-19 16:49:13 -04:00
parent a86974d5b8
commit 0154b13e68
2 changed files with 9 additions and 4 deletions

View File

@ -1,3 +1,5 @@
require 'squib/graphics/cairo_context_wrapper'
module Squib
class Deck
@ -29,8 +31,8 @@ module Squib
end
end
x, y, w, h = cxt.target.ink_extents # I love Ruby assignment ;)
png_cxt = Cairo::Context.new(Cairo::ImageSurface.new(w + 2*margin, h + 2*margin))
png_cxt.set_source_color(fill_color)
png_cxt = Squib::Graphics::CairoContextWrapper.new(Cairo::Context.new(Cairo::ImageSurface.new(w + 2*margin, h + 2*margin)))
png_cxt.set_source_squibcolor(fill_color)
png_cxt.paint
png_cxt.translate(-x + margin, -y + margin)
png_cxt.set_source(cxt.target)

View File

@ -1,3 +1,5 @@
require 'squib/graphics/cairo_context_wrapper'
module Squib
class Deck
@ -16,8 +18,9 @@ module Squib
out_width = range.size * ((@width - 2*trim) * scale * offset) + 2*margin
out_height = reflect_offset + (1.0 + reflect_percent) * (@height - 2*trim) + 2*margin
out_cc = Cairo::Context.new(Cairo::ImageSurface.new(out_width, out_height))
out_cc.set_source_color(fill_color)
out_cc.paint
wrapper = Squib::Graphics::CairoContextWrapper.new(out_cc)
wrapper.set_source_squibcolor(fill_color)
wrapper.paint
cards = range.collect { |i| @cards[i] }
cards.each_with_index do |card, i|