class Squib::Graphics::SaveSpruePNG

Templated sheet renderer in PNG format.

Public Instance Methods

draw_final_page(cc) click to toggle source

The last page always gets written out for PNGs because they are separate files and don’t get “flushed” automatically. See bug #320.

# File lib/squib/graphics/save_sprue.rb, line 221
def draw_final_page(cc)
  draw_page cc
  cc.target.finish
end
draw_page(cc) click to toggle source
# File lib/squib/graphics/save_sprue.rb, line 211
def draw_page(cc)
  cc.target.write_to_png(full_filename)
  init_cc
  cc.set_source_color(:white) # white backdrop TODO make option
  cc.paint
  cc
end
full_filename() click to toggle source
# File lib/squib/graphics/save_sprue.rb, line 226
def full_filename
  @sheet_args.full_filename @page_number
end
init_cc() click to toggle source
# File lib/squib/graphics/save_sprue.rb, line 205
def init_cc
  surface = Cairo::ImageSurface.new @tmpl.sheet_width, @tmpl.sheet_height
  CairoContextWrapper.new(Cairo::Context.new(surface))
  # Cairo::Context.new(surface)
end