Class: Rabbit::Renderer::Printer
- Inherits:
-
Object
- Object
- Rabbit::Renderer::Printer
show all
- Includes:
- Base, Engine::Cairo
- Defined in:
- lib/rabbit/renderer/printer.rb
Constant Summary
collapse
- A4_WIDTH =
596
- A4_HEIGHT =
842
Constants included
from DirtyCount
DirtyCount::TOO_DIRTY
Constants included
from GetText
GetText::DOMAIN
Instance Attribute Summary collapse
#background, #foreground
Attributes included from Base
#adjustment_x, #adjustment_y, #base_height, #base_width, #draw_scaled_image, #gl_quaternion, #gl_scale, #graffiti_color, #graffiti_line_width, #margin_bottom, #margin_left, #margin_right, #margin_top, #page_margin_bottom, #page_margin_left, #page_margin_right, #page_margin_top, #paper_height, #paper_width, #progress_background, #progress_foreground, #slides_per_page, #x_dpi, #y_dpi
Instance Method Summary
collapse
#alpha_available?, #background_image=, #draw_arc, #draw_arc_by_radius, #draw_layout, #draw_line, #draw_lines, #draw_link, #draw_pixbuf, #draw_polygon, #draw_poppler_page, #draw_rectangle, #draw_rounded_rectangle, #draw_rsvg_handle, #finish_context, #finish_renderer, #init_context, #init_renderer, #make_layout, #reflect_context, #restore_context, #rotate_context, #save_context, #scale_context, #set_font_resolution, #set_source_pixbuf, #shear_context, #to_gdk_rgb, #translate_context
Methods included from Kernel
#draw_circle, #draw_circle_by_radius, #draw_cone, #draw_cube, #draw_dodecahedron, #draw_flag, #draw_flag_layout, #draw_icosahedron, #draw_octahedron, #draw_rectangle_flag, #draw_sphere, #draw_teapot, #draw_tetrahedron, #draw_torus, #draw_triangle_flag, #flag_size, #gl_call_list, #gl_compile, #gl_supported?, #make_color, #new_list_id, #reflect_context, #restore_context, #rotate_context, #save_context, #scale_context, #shear_context, #translate_context, #z_far, #z_view
Methods included from Base
#add_gesture_action, #blackouting?, #can_undo_graffiti?, #change_graffiti_color, #clean, #clean_if_dirty, #clear_slide, #clear_theme, #confirm, #connect_key, #disconnect_key, #display?, #each_slide_pixbuf, #expand_hole, #font_families, #gl_available?, #graffiti_mode?, #have_graffiti?, #hiding?, #narrow_hole, #offscreen_canvas, #post_init_gui, #post_terminal, #pre_terminal, #print, #redraw, #reset_adjustment, #search_slide, #searching?, #setup_event, #stop_slide_search, #toggle_blackout, #toggle_info_window, #toggle_spotlight, #toggle_whiteout, #whiteouting?
Methods included from DirtyCount
#bit_dirty, #dirty, #dirty?, #dirty_count_clean, #very_dirty
Methods included from GetText
included
Constructor Details
#initialize(canvas) ⇒ Printer
Returns a new instance of Printer.
36
37
38
39
40
41
42
|
# File 'lib/rabbit/renderer/printer.rb', line 36
def initialize(canvas)
super
@filename = nil
init_paper
init_color
update_layout
end
|
Instance Attribute Details
#filename ⇒ Object
80
81
82
|
# File 'lib/rabbit/renderer/printer.rb', line 80
def filename
@filename || default_filename
end
|
Instance Method Details
#clip_slide(x, y, w, h) ⇒ Object
142
143
144
145
146
|
# File 'lib/rabbit/renderer/printer.rb', line 142
def clip_slide(x, y, w, h)
x, y = from_screen(x, y)
@context.rectangle(x, y, w, h)
@context.clip
end
|
#draw_background(x, y, w, h) ⇒ Object
148
149
150
|
# File 'lib/rabbit/renderer/printer.rb', line 148
def draw_background(x, y, w, h)
draw_rectangle(true, x, y, w, h, @background)
end
|
#draw_slide(slide, simulation) ⇒ Object
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
|
# File 'lib/rabbit/renderer/printer.rb', line 108
def draw_slide(slide, simulation)
if simulation
yield
else
slide_width = @layout.slide_width
slide_height = @layout.slide_height
size = Size.new(@base_width,
@base_height,
slide_width,
slide_height,
@base_width.to_f / @base_height.to_f)
x = @layout.normalize_x(0)
y = @layout.normalize_y(0)
save_context do
translate_context(x, y)
clip_slide(0, 0, slide_width, slide_height)
draw_background(0, 0, slide_width, slide_height)
scale_context(*size.logical_scale)
translate_context(size.logical_margin_left,
size.logical_margin_top)
yield
if @slides_per_page > 1
draw_rectangle(false,
0,
0,
size.logical_width,
size.logical_height,
@black)
end
end
@context.show_page if need_show_page?
end
end
|
#height ⇒ Object
48
49
50
|
# File 'lib/rabbit/renderer/printer.rb', line 48
def height
@base_height
end
|
#page_height ⇒ Object
56
57
58
|
# File 'lib/rabbit/renderer/printer.rb', line 56
def page_height
@page_height - page_margin_top - page_margin_bottom
end
|
#page_width ⇒ Object
52
53
54
|
# File 'lib/rabbit/renderer/printer.rb', line 52
def page_width
@page_width - page_margin_left - page_margin_right
end
|
#paper_height=(value) ⇒ Object
65
66
67
68
|
# File 'lib/rabbit/renderer/printer.rb', line 65
def paper_height=(value)
super
init_paper
end
|
#paper_width=(value) ⇒ Object
60
61
62
63
|
# File 'lib/rabbit/renderer/printer.rb', line 60
def paper_width=(value)
super
init_paper
end
|
#post_apply_theme ⇒ Object
99
100
|
# File 'lib/rabbit/renderer/printer.rb', line 99
def post_apply_theme
end
|
#post_move(old_index, index) ⇒ Object
102
103
|
# File 'lib/rabbit/renderer/printer.rb', line 102
def post_move(old_index, index)
end
|
#post_move_in_slide(old_index, index) ⇒ Object
105
106
|
# File 'lib/rabbit/renderer/printer.rb', line 105
def post_move_in_slide(old_index, index)
end
|
#post_parse ⇒ Object
96
97
|
# File 'lib/rabbit/renderer/printer.rb', line 96
def post_parse
end
|
#post_print(canceled) ⇒ Object
88
89
90
91
|
# File 'lib/rabbit/renderer/printer.rb', line 88
def post_print(canceled)
return if canceled
@context.target.finish
end
|
#pre_parse ⇒ Object
93
94
|
# File 'lib/rabbit/renderer/printer.rb', line 93
def pre_parse
end
|
#pre_print(slide_size) ⇒ Object
84
85
86
|
# File 'lib/rabbit/renderer/printer.rb', line 84
def pre_print(slide_size)
init_context(create_context)
end
|
#printable? ⇒ Boolean
76
77
78
|
# File 'lib/rabbit/renderer/printer.rb', line 76
def printable?
true
end
|
#slides_per_page=(slides) ⇒ Object
70
71
72
73
74
|
# File 'lib/rabbit/renderer/printer.rb', line 70
def slides_per_page=(slides)
super
init_paper
update_layout
end
|
#width ⇒ Object
44
45
46
|
# File 'lib/rabbit/renderer/printer.rb', line 44
def width
@base_width
end
|