Class: Squib::Graphics::SaveSpruePNG
- Defined in:
- lib/squib/graphics/save_sprue.rb
Overview
Templated sheet renderer in PNG format.
Instance Method Summary collapse
-
#draw_final_page(cc) ⇒ Object
The last page always gets written out for PNGs because they are separate files and don’t get “flushed” automatically.
- #draw_page(cc) ⇒ Object
- #full_filename ⇒ Object
- #init_cc ⇒ Object
Methods inherited from SaveSprue
Constructor Details
This class inherits a constructor from Squib::Graphics::SaveSprue
Instance Method Details
#draw_final_page(cc) ⇒ Object
The last page always gets written out for PNGs because they are separate files and don’t get “flushed” automatically. See bug #320.
221 222 223 224 |
# File 'lib/squib/graphics/save_sprue.rb', line 221 def draw_final_page(cc) draw_page cc cc.target.finish end |
#draw_page(cc) ⇒ Object
211 212 213 214 215 216 217 |
# 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 ⇒ Object
226 227 228 |
# File 'lib/squib/graphics/save_sprue.rb', line 226 def full_filename @sheet_args.full_filename @page_number end |
#init_cc ⇒ Object
205 206 207 208 209 |
# 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 |