class Rabbit::Renderer::Print::Multiple

Public Class Methods

new(canvas) click to toggle source
Calls superclass method Rabbit::Renderer::Print::Base.new
# File lib/rabbit/renderer/print/multiple.rb, line 37
def initialize(canvas)
  @print = Print.new(canvas)
  super
end

Public Instance Methods

draw_arc(filled, x, y, w, h, a1, a2, color=nil, params={}) click to toggle source
# File lib/rabbit/renderer/print/multiple.rb, line 131
def draw_arc(filled, x, y, w, h, a1, a2, color=nil, params={})
  x, y = normalize(x, y)
  @print.draw_arc(filled, x, y, w, h, a1, a2, color, params)
end
draw_arc_by_radius(filled, x, y, r, a1, a2, color=nil, params={}) click to toggle source
# File lib/rabbit/renderer/print/multiple.rb, line 136
def draw_arc_by_radius(filled, x, y, r, a1, a2, color=nil, params={})
  x, y = normalize(x, y)
  @print.draw_arc_by_radius(filled, x, y, r, a1, a2, color, params)
end
draw_layout(layout, x, y, color=nil, params={}) click to toggle source
# File lib/rabbit/renderer/print/multiple.rb, line 141
def draw_layout(layout, x, y, color=nil, params={})
  x, y = normalize(x, y)
  @print.draw_layout(layout, x, y, color, params)
end
draw_line(x1, y1, x2, y2, color=nil, params={}) click to toggle source
# File lib/rabbit/renderer/print/multiple.rb, line 113
def draw_line(x1, y1, x2, y2, color=nil, params={})
  x1, y1 = normalize(x1, y1)
  x2, y2 = normalize(x2, y2)
  @print.draw_line(x1, y1, x2, y2, color, params)
end
draw_pixbuf(pixbuf, x, y, params={}) click to toggle source
# File lib/rabbit/renderer/print/multiple.rb, line 146
def draw_pixbuf(pixbuf, x, y, params={})
  x, y = normalize(x, y)
  @print.draw_pixbuf(pixbuf, x, y, params)
end
draw_poppler_page(handle, x, y, params={}) click to toggle source
# File lib/rabbit/renderer/print/multiple.rb, line 156
def draw_poppler_page(handle, x, y, params={})
  x, y = normalize(x, y)
  @print.draw_poppler_page(handle, x, y, params)
end
draw_rectangle(filled, x, y, w, h, color=nil, params={}) click to toggle source
# File lib/rabbit/renderer/print/multiple.rb, line 119
def draw_rectangle(filled, x, y, w, h, color=nil, params={})
  x, y = normalize(x, y)
  @print.draw_rectangle(filled, x, y, w, h, color, params)
end
draw_rounded_rectangle(filled, x, y, w, h, radius, color=nil, params={}) click to toggle source
# File lib/rabbit/renderer/print/multiple.rb, line 124
def draw_rounded_rectangle(filled, x, y, w, h, radius, color=nil,
                           params={})
  x, y = normalize(x, y)
  @print.draw_rounded_rectangle(filled, x, y, w, h, radius,
                                color, params)
end
draw_rsvg_handle(handle, x, y, params={}) click to toggle source
# File lib/rabbit/renderer/print/multiple.rb, line 151
def draw_rsvg_handle(handle, x, y, params={})
  x, y = normalize(x, y)
  @print.draw_rsvg_handle(handle, x, y, params)
end
draw_slide(slide, simulation) { || ... } click to toggle source
# File lib/rabbit/renderer/print/multiple.rb, line 91
def draw_slide(slide, simulation)
  @print.show_page = need_show_page?
  @print.internal_draw_slide(slide, simulation) do
    if simulation
      yield
    else
      @print.save_context do
        x, y = normalize(0, 0)
        @print.internal_clip_slide(x, y, width, height)
        @print.internal_draw_background(x, y, width, height)
        yield
        draw_rectangle(false, 0, 0, width, height, @black)
      end
    end
  end
end
height() click to toggle source
# File lib/rabbit/renderer/print/multiple.rb, line 46
def height
  @slide_height ||= @layout.slide_height
end
margin_bottom=(margin) click to toggle source
Calls superclass method
# File lib/rabbit/renderer/print/multiple.rb, line 85
def margin_bottom=(margin)
  super
  @print.margin_bottom = margin
end
margin_left=(margin) click to toggle source
Calls superclass method
# File lib/rabbit/renderer/print/multiple.rb, line 70
def margin_left=(margin)
  super
  @print.margin_left = margin
end
margin_right=(margin) click to toggle source
Calls superclass method
# File lib/rabbit/renderer/print/multiple.rb, line 75
def margin_right=(margin)
  super
  @print.margin_right = margin
end
margin_top=(margin) click to toggle source
Calls superclass method
# File lib/rabbit/renderer/print/multiple.rb, line 80
def margin_top=(margin)
  super
  @print.margin_top = margin
end
page_margin_bottom=(margin) click to toggle source
Calls superclass method
# File lib/rabbit/renderer/print/multiple.rb, line 65
def page_margin_bottom=(margin)
  super
  @print.page_margin_bottom = margin
end
page_margin_left=(margin) click to toggle source
Calls superclass method
# File lib/rabbit/renderer/print/multiple.rb, line 50
def page_margin_left=(margin)
  super
  @print.page_margin_left = margin
end
page_margin_right=(margin) click to toggle source
Calls superclass method
# File lib/rabbit/renderer/print/multiple.rb, line 55
def page_margin_right=(margin)
  super
  @print.page_margin_right = margin
end
page_margin_top=(margin) click to toggle source
Calls superclass method
# File lib/rabbit/renderer/print/multiple.rb, line 60
def page_margin_top=(margin)
  super
  @print.page_margin_top = margin
end
slides_per_page=(slides) click to toggle source
Calls superclass method
# File lib/rabbit/renderer/print/multiple.rb, line 108
def slides_per_page=(slides)
  super
  update_layout
end
width() click to toggle source
# File lib/rabbit/renderer/print/multiple.rb, line 42
def width
  @slide_width ||= @layout.slide_width
end

Private Instance Methods

init_color() click to toggle source
# File lib/rabbit/renderer/print/multiple.rb, line 167
def init_color
  @white = make_color("white")
  @black = make_color("black")
end
init_paper() click to toggle source
# File lib/rabbit/renderer/print/multiple.rb, line 162
def init_paper
  @print.paper_width = A4_WIDTH
  @print.paper_height = A4_HEIGHT
end
need_show_page?() click to toggle source
# File lib/rabbit/renderer/print/multiple.rb, line 196
def need_show_page?
  @canvas.last_slide? or ((current_index + 1) % @slides_per_page).zero?
end
normalize(x, y) click to toggle source
# File lib/rabbit/renderer/print/multiple.rb, line 192
def normalize(x, y)
  [nx(x), ny(y)]
end
normalize_x(x) click to toggle source
# File lib/rabbit/renderer/print/multiple.rb, line 182
def normalize_x(x)
  @layout.normalize_x(x)
end
Also aliased as: nx
normalize_y(y) click to toggle source
# File lib/rabbit/renderer/print/multiple.rb, line 187
def normalize_y(y)
  @layout.normalize_y(y)
end
Also aliased as: ny
nx(x)
Alias for: normalize_x
ny(y)
Alias for: normalize_y
update_layout() click to toggle source
# File lib/rabbit/renderer/print/multiple.rb, line 172
def update_layout
  if @slides_per_page
    @layout = LayoutBase.make_layout(self)
  else
    @layout = nil
  end
  @slide_width = nil
  @slide_height = nil
end