Class: Rabbit::Renderer::Offscreen

Inherits:
Object
  • Object
show all
Includes:
Base, Engine::Cairo
Defined in:
lib/rabbit/renderer/offscreen.rb

Constant Summary

Constants included from DirtyCount

DirtyCount::TOO_DIRTY

Constants included from GetText

GetText::DOMAIN

Instance Attribute Summary collapse

Attributes included from Engine::Cairo

#background, #foreground

Attributes included from Base

#adjustment_x, #adjustment_y, #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

Methods included from Engine::Cairo

#alpha_available?, #background_image=, #draw_arc, #draw_arc_by_radius, #draw_background, #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, #prepare_renderer, #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_background, #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_slide, #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, #print, #printable?, #redraw, #reset_adjustment, #search_slide, #searching?, #setup_event, #stop_slide_search, #to_attrs, #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, width = nil, height = nil) ⇒ Offscreen

Returns a new instance of Offscreen.



30
31
32
33
34
35
# File 'lib/rabbit/renderer/offscreen.rb', line 30

def initialize(canvas, width=nil, height=nil)
  super(canvas)
  @width = width
  @height = height
  @pango_context = nil
end

Instance Attribute Details

#heightObject

Returns the value of attribute height.



28
29
30
# File 'lib/rabbit/renderer/offscreen.rb', line 28

def height
  @height
end

#pango_contextObject

Returns the value of attribute pango_context.



28
29
30
# File 'lib/rabbit/renderer/offscreen.rb', line 28

def pango_context
  @pango_context
end

#widthObject

Returns the value of attribute width.



28
29
30
# File 'lib/rabbit/renderer/offscreen.rb', line 28

def width
  @width
end

Instance Method Details

#create_pango_contextObject



87
88
89
90
91
# File 'lib/rabbit/renderer/offscreen.rb', line 87

def create_pango_context
  context = Gtk::Invisible.new.create_pango_context
  set_font_resolution(context)
  context
end

#index_mode_offObject



55
56
# File 'lib/rabbit/renderer/offscreen.rb', line 55

def index_mode_off
end

#index_mode_onObject



52
53
# File 'lib/rabbit/renderer/offscreen.rb', line 52

def index_mode_on
end

#make_layout(text) ⇒ Object



64
65
66
67
68
69
70
# File 'lib/rabbit/renderer/offscreen.rb', line 64

def make_layout(text)
  attrs, text = Pango.parse_markup(text)
  layout = Pango::Layout.new(create_pango_context)
  layout.text = text
  layout.set_attributes(attrs)
  layout
end

#post_apply_themeObject



37
38
# File 'lib/rabbit/renderer/offscreen.rb', line 37

def post_apply_theme
end

#post_move(old_index, index) ⇒ Object



40
41
# File 'lib/rabbit/renderer/offscreen.rb', line 40

def post_move(old_index, index)
end

#post_move_in_slide(old_index, index) ⇒ Object



43
44
# File 'lib/rabbit/renderer/offscreen.rb', line 43

def post_move_in_slide(old_index, index)
end

#post_parseObject



49
50
# File 'lib/rabbit/renderer/offscreen.rb', line 49

def post_parse
end

#post_to_pixbuf(canceled) ⇒ Object



101
102
# File 'lib/rabbit/renderer/offscreen.rb', line 101

def post_to_pixbuf(canceled)
end

#post_toggle_index_modeObject



61
62
# File 'lib/rabbit/renderer/offscreen.rb', line 61

def post_toggle_index_mode
end

#pre_parseObject



46
47
# File 'lib/rabbit/renderer/offscreen.rb', line 46

def pre_parse
end

#pre_to_pixbuf(slide_size) ⇒ Object



93
94
# File 'lib/rabbit/renderer/offscreen.rb', line 93

def pre_to_pixbuf(slide_size)
end

#pre_toggle_index_modeObject



58
59
# File 'lib/rabbit/renderer/offscreen.rb', line 58

def pre_toggle_index_mode
end

#to_pixbuf(slide) ⇒ Object



72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/rabbit/renderer/offscreen.rb', line 72

def to_pixbuf(slide)
  pixbuf = nil
  ::Cairo::ImageSurface.new(@width, @height) do |surface|
    context = ::Cairo::Context.new(surface)
    init_context(context)
    slide.draw(@canvas)
    png = StringIO.new
    surface.write_to_png(png)
    loader = ImageDataLoader.new(png.string)
    pixbuf = loader.load
    finish_context
  end
  pixbuf
end

#to_pixbufing(i) ⇒ Object



96
97
98
99
# File 'lib/rabbit/renderer/offscreen.rb', line 96

def to_pixbufing(i)
  Utils.process_pending_events
  true
end