lib/squib/graphics/save_sprue.rb in squib-0.15.3 vs lib/squib/graphics/save_sprue.rb in squib-0.16.0.pre.preview1

- old
+ new

@@ -3,11 +3,11 @@ # Helper class to generate templated sheet. class SaveSprue def initialize(deck, tmpl, sheet_args) @deck = deck @tmpl = tmpl - @page_number = 1 + @page_number = 0 @sheet_args = sheet_args # might be Args::Sheet or Args::SaveBatch @overlay_lines = @tmpl.crop_lines.select do |line| line['overlay_on_cards'] end end @@ -37,11 +37,11 @@ @sheet_args.trim, @sheet_args.trim_radius bar.increment end draw_overlay_above_cards cc - cc.target.finish + draw_final_page cc # See bug #320 end end protected @@ -188,10 +188,15 @@ cc.set_source_color(:white) # white backdrop TODO make option cc.paint cc end + def draw_final_page(cc) + # PDF doesn't need to create a last page. See bug #320 + cc.target.finish + end + def full_filename @sheet_args.full_filename end end @@ -207,9 +212,16 @@ cc.target.write_to_png(full_filename) init_cc cc.set_source_color(:white) # white backdrop TODO make option cc.paint cc + end + + # The last page always gets written out for PNGs because they are separate + # files and don't get "flushed" automatically. See bug #320. + def draw_final_page(cc) + draw_page cc + cc.target.finish end def full_filename @sheet_args.full_filename @page_number end