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

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, #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, #post_terminal, #pre_terminal, #print, #printable?, #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) ⇒ Offscreen

Returns a new instance of Offscreen.



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

def initialize(canvas)
  super(canvas)
  @filename = nil
  @pango_context = nil
end

Instance Attribute Details

#filenameObject

Returns the value of attribute filename.



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

def filename
  @filename
end

#pango_contextObject

Returns the value of attribute pango_context.



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

def pango_context
  @pango_context
end

Instance Method Details

#create_pango_contextObject



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

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

#heightObject



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

def height
  @base_height
end

#index_mode_offObject



63
64
# File 'lib/rabbit/renderer/offscreen.rb', line 63

def index_mode_off
end

#index_mode_onObject



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

def index_mode_on
end

#make_layout(text) ⇒ Object



72
73
74
75
76
77
78
# File 'lib/rabbit/renderer/offscreen.rb', line 72

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



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

def post_apply_theme
end

#post_move(old_index, index) ⇒ Object



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

def post_move(old_index, index)
end

#post_move_in_slide(old_index, index) ⇒ Object



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

def post_move_in_slide(old_index, index)
end

#post_parseObject



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

def post_parse
end

#post_to_pixbuf(canceled) ⇒ Object



109
110
# File 'lib/rabbit/renderer/offscreen.rb', line 109

def post_to_pixbuf(canceled)
end

#post_toggle_index_modeObject



69
70
# File 'lib/rabbit/renderer/offscreen.rb', line 69

def post_toggle_index_mode
end

#pre_parseObject



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

def pre_parse
end

#pre_to_pixbuf(slide_size) ⇒ Object



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

def pre_to_pixbuf(slide_size)
end

#pre_toggle_index_modeObject



66
67
# File 'lib/rabbit/renderer/offscreen.rb', line 66

def pre_toggle_index_mode
end

#to_pixbuf(slide) ⇒ Object



80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/rabbit/renderer/offscreen.rb', line 80

def to_pixbuf(slide)
  pixbuf = nil
  ::Cairo::ImageSurface.new(@base_width, @base_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



104
105
106
107
# File 'lib/rabbit/renderer/offscreen.rb', line 104

def to_pixbufing(i)
  Utils.process_pending_events
  true
end

#widthObject



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

def width
  @base_width
end