Browse Source

Use cairo context wrapper for fill colors on marketing

Actually deliver what I promised

Fixes #71
dev
Andy Meneely 11 years ago
parent
commit
0154b13e68
  1. 6
      lib/squib/graphics/hand.rb
  2. 7
      lib/squib/graphics/showcase.rb

6
lib/squib/graphics/hand.rb

@ -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)

7
lib/squib/graphics/showcase.rb

@ -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|

Loading…
Cancel
Save