module Rabbit::Renderer::Kernel
Public Instance Methods
draw_background(slide)
click to toggle source
# File lib/rabbit/renderer/kernel.rb, line 53 def draw_background(slide) draw_rectangle(true, 0, 0, width, height, @background) end
draw_circle(filled, x, y, w, h, color=nil, params={})
click to toggle source
# File lib/rabbit/renderer/kernel.rb, line 57 def draw_circle(filled, x, y, w, h, color=nil, params={}) draw_arc(filled, x, y, w, h, 0, 360, color, params) end
draw_circle_by_radius(filled, x, y, r, color=nil, params={})
click to toggle source
# File lib/rabbit/renderer/kernel.rb, line 61 def draw_circle_by_radius(filled, x, y, r, color=nil, params={}) draw_arc_by_radius(filled, x, y, r, 0, 360, color, params) end
draw_cone(filled, x, y, z, base, height, slices, stacks, color=nil)
click to toggle source
# File lib/rabbit/renderer/kernel.rb, line 184 def draw_cone(filled, x, y, z, base, height, slices, stacks, color=nil) not_support_method("draw_cone") end
draw_cube(filled, x, y, z, size, color=nil)
click to toggle source
# File lib/rabbit/renderer/kernel.rb, line 176 def draw_cube(filled, x, y, z, size, color=nil) not_support_method("draw_cube") end
draw_dodecahedron(filled, x, y, z, color=nil)
click to toggle source
# File lib/rabbit/renderer/kernel.rb, line 201 def draw_dodecahedron(filled, x, y, z, color=nil) not_support_method("draw_dodecahedron") end
draw_flag(x, y, pole_height, params)
click to toggle source
# File lib/rabbit/renderer/kernel.rb, line 65 def draw_flag(x, y, pole_height, params) if params["flag_type"] == "triangle" draw_triangle_flag(x, y, pole_height, params) else draw_rectangle_flag(x, y, pole_height, params) end end
draw_flag_layout(layout, x, y, pole_width, flag_width, text_height, flag_height)
click to toggle source
# File lib/rabbit/renderer/kernel.rb, line 159 def draw_flag_layout(layout, x, y, pole_width, flag_width, text_height, flag_height) base_x = x + pole_width layout.width = flag_width * Pango::SCALE layout.alignment = Pango::Layout::ALIGN_CENTER base_y = y if text_height < flag_height base_y += (flag_height - text_height) / 2 end draw_layout(layout, base_x, base_y) end
draw_icosahedron(filled, x, y, z, color=nil)
click to toggle source
# File lib/rabbit/renderer/kernel.rb, line 205 def draw_icosahedron(filled, x, y, z, color=nil) not_support_method("draw_icosahedron") end
draw_octahedron(filled, x, y, z, color=nil)
click to toggle source
# File lib/rabbit/renderer/kernel.rb, line 197 def draw_octahedron(filled, x, y, z, color=nil) not_support_method("draw_octahedron") end
draw_rectangle_flag(x, y, pole_height, params)
click to toggle source
# File lib/rabbit/renderer/kernel.rb, line 120 def draw_rectangle_flag(x, y, pole_height, params) params = setup_flag_params(pole_height, 1.3, params) layout = params["layout"] text_width = params["text_width"] text_height = params["text_height"] pole_width = params["pole_width"] pole_color = params["pole_color"] flag_height = params["flag_height"] flag_width = params["flag_width"] flag_color = params["flag_color"] flag_frame_width = params["flag_frame_width"] flag_frame_color = params["flag_frame_color"] draw_rectangle(true, x, y, pole_width, pole_height, pole_color) base_x = x + pole_width draw_rectangle(true, base_x, y, flag_width, flag_height, flag_frame_color) draw_rectangle(true, base_x, y + flag_frame_width, flag_width - flag_frame_width, flag_height - 2 * flag_frame_width, flag_color) if layout args = [ layout, x, y, pole_width, flag_width - 2 * flag_frame_width, text_height, flag_height, ] draw_flag_layout(*args) end end
draw_slide(slide, simulation) { || ... }
click to toggle source
# File lib/rabbit/renderer/kernel.rb, line 43 def draw_slide(slide, simulation) unless simulation save_context draw_background(slide) end yield ensure restore_context unless simulation end
draw_sphere(filled, x, y, z, radius, slices, stacks, color=nil)
click to toggle source
# File lib/rabbit/renderer/kernel.rb, line 180 def draw_sphere(filled, x, y, z, radius, slices, stacks, color=nil) not_support_method("draw_sphere") end
draw_teapot(filled, x, y, z, scale, color=nil)
click to toggle source
# File lib/rabbit/renderer/kernel.rb, line 209 def draw_teapot(filled, x, y, z, scale, color=nil) not_support_method("draw_teapot") end
draw_tetrahedron(filled, x, y, z, color=nil)
click to toggle source
# File lib/rabbit/renderer/kernel.rb, line 193 def draw_tetrahedron(filled, x, y, z, color=nil) not_support_method("draw_tetrahedron") end
draw_torus(filled, x, y, z, inner_radius, outer_radius, n_sides, rings, color=nil)
click to toggle source
# File lib/rabbit/renderer/kernel.rb, line 188 def draw_torus(filled, x, y, z, inner_radius, outer_radius, n_sides, rings, color=nil) not_support_method("draw_torus") end
draw_triangle_flag(x, y, pole_height, params)
click to toggle source
# File lib/rabbit/renderer/kernel.rb, line 73 def draw_triangle_flag(x, y, pole_height, params) params = setup_flag_params(pole_height, 1.5, params) layout = params["layout"] text_width = params["text_width"] text_height = params["text_height"] pole_width = params["pole_width"] pole_color = params["pole_color"] flag_height = params["flag_height"] flag_width = params["flag_width"] flag_color = params["flag_color"] flag_frame_width = params["flag_frame_width"] flag_frame_color = params["flag_frame_color"] draw_rectangle(true, x, y, pole_width, pole_height, pole_color) base_x = x + pole_width draw_polygon(true, [ [base_x, y], [base_x + flag_width, y + flag_height / 2], [base_x, y + flag_height], ], flag_frame_color) draw_polygon(true, [ [base_x, y + flag_frame_width], [ base_x + flag_width - 2 * flag_frame_width, y + flag_height / 2 ], [ base_x, y + flag_height - flag_frame_width ], ], flag_color) if layout args = [ layout, x, y, pole_width, flag_width * 0.8, text_height, flag_height, ] draw_flag_layout(*args) end end
flag_size(pole_height, params)
click to toggle source
# File lib/rabbit/renderer/kernel.rb, line 171 def flag_size(pole_height, params) params = setup_flag_params(pole_height, 1.5, params) [params["pole_width"] + params["flag_width"], pole_height] end
gl_call_list(id, x, y, z, color=nil)
click to toggle source
# File lib/rabbit/renderer/kernel.rb, line 217 def gl_call_list(id, x, y, z, color=nil) not_support_method("gl_call_list") end
gl_compile(id)
click to toggle source
# File lib/rabbit/renderer/kernel.rb, line 213 def gl_compile(id) not_support_method("gl_compile") end
gl_supported?()
click to toggle source
# File lib/rabbit/renderer/kernel.rb, line 221 def gl_supported? false end
make_color(color)
click to toggle source
# File lib/rabbit/renderer/kernel.rb, line 6 def make_color(color) return color if color.is_a?(Color) if color.nil? @foreground else Color.parse(color) end end
new_list_id()
click to toggle source
# File lib/rabbit/renderer/kernel.rb, line 233 def new_list_id @list_id += 1 @list_id end
reflect_context(base, params={})
click to toggle source
# File lib/rabbit/renderer/kernel.rb, line 24 def reflect_context(base, params={}) end
restore_context()
click to toggle source
# File lib/rabbit/renderer/kernel.rb, line 40 def restore_context end
rotate_context(angle, params={})
click to toggle source
# File lib/rabbit/renderer/kernel.rb, line 18 def rotate_context(angle, params={}) end
save_context() { || ... }
click to toggle source
# File lib/rabbit/renderer/kernel.rb, line 30 def save_context if block_given? begin yield ensure restore_context end end end
scale_context(x, y, params={})
click to toggle source
# File lib/rabbit/renderer/kernel.rb, line 21 def scale_context(x, y, params={}) end
shear_context(x, y, params={})
click to toggle source
# File lib/rabbit/renderer/kernel.rb, line 27 def shear_context(x, y, params={}) end
translate_context(x, y, params={})
click to toggle source
# File lib/rabbit/renderer/kernel.rb, line 15 def translate_context(x, y, params={}) end
z_far()
click to toggle source
# File lib/rabbit/renderer/kernel.rb, line 225 def z_far 100.0 end
z_view()
click to toggle source
# File lib/rabbit/renderer/kernel.rb, line 229 def z_view 5.0 end
Private Instance Methods
get_line_width(params, default=nil)
click to toggle source
# File lib/rabbit/renderer/kernel.rb, line 239 def get_line_width(params, default=nil) params[:line_width] || default end
set_font_resolution(context)
click to toggle source
# File lib/rabbit/renderer/kernel.rb, line 243 def set_font_resolution(context) end