Class: Squib::Graphics::SaveSpruePDF
Overview
Templated sheet renderer in PDF format.
Instance Method Summary
collapse
Methods inherited from SaveSprue
#initialize, #render_sheet
Instance Method Details
#draw_final_page(cc) ⇒ Object
193
194
195
196
|
# File 'lib/squib/graphics/save_sprue.rb', line 193
def draw_final_page(cc)
cc.target.finish
end
|
#draw_page(cc) ⇒ Object
186
187
188
189
190
191
|
# File 'lib/squib/graphics/save_sprue.rb', line 186
def draw_page(cc)
cc.show_page
cc.set_source_color(:white) cc.paint
cc
end
|
#full_filename ⇒ Object
198
199
200
|
# File 'lib/squib/graphics/save_sprue.rb', line 198
def full_filename
@sheet_args.full_filename
end
|
#init_cc ⇒ Object
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
|
# File 'lib/squib/graphics/save_sprue.rb', line 160
def init_cc
ratio = 72.0 / @deck.dpi
slots = @tmpl.cards
per_sheet = slots.size
surface = if per_sheet == 1
Cairo::PDFSurface.new(
full_filename,
(@tmpl.sheet_width - 2 * @sheet_args.trim) * ratio,
(@tmpl.sheet_height - 2 *@sheet_args.trim) * ratio
)
else
Cairo::PDFSurface.new(
full_filename,
@tmpl.sheet_width * ratio,
@tmpl.sheet_height * ratio
)
end
cc = CairoContextWrapper.new(Cairo::Context.new(surface))
cc.scale(72.0 / @deck.dpi, 72.0 / @deck.dpi) cc
end
|