# File lib/rabbit/element/video.rb, line 24 def initialize(filename, prop) @filename = filename prop = Utils.stringify_hash_key(prop) super() normalized_prop = {} prop.each do |name, value| normalized_prop[name.gsub(/-/, '_')] = value end prop = normalized_prop %(as_large_as_possible).each do |name| instance_variable_set("@#{name}", true_value?(prop[name])) end %(width height normalized_width normalized_height relative_width relative_height relative_margin_top relative_margin_bottom relative_margin_left relative_margin_right relative_padding_top relative_padding_bottom relative_padding_left relative_padding_right ).each do |name| begin instance_variable_set("@#{name}", prop[name] && Integer(prop[name])) rescue ArgumentError raise InvalidImageSizeError.new(filename, name, prop[name]) end end resize(@width, @height) end
# File lib/rabbit/element/video.rb, line 72 def as_large_as_possible? @as_large_as_possible end
# File lib/rabbit/element/video.rb, line 59 def compile(canvas, x, y, w, h) super adjust_size(canvas, @x, @y, @w, @h) end
# File lib/rabbit/element/video.rb, line 55 def compile_for_horizontal_centering(canvas, x, y, w, h) _compile(canvas, x, y, w, h) end
# File lib/rabbit/element/video.rb, line 76 def draw_element(canvas, x, y, w, h, simulation) unless simulation if canvas.display? require "rabbit/video-window" @video_window ||= VideoWindow.new(self) @video_window.show(canvas.window) else draw_layout(canvas, x, y) end end [x, y + height, w, h - height] end
# File lib/rabbit/element/video.rb, line 68 def height @height.to_i + @padding_top + @padding_bottom end
Generated with the Darkfish Rdoc Generator 2.