Parent

Class/Module Index [+]

Quicksearch

Rabbit::Element::Video

Attributes

filename[R]
normalized_height[R]
normalized_width[R]
relative_height[R]
relative_margin_bottom[R]
relative_margin_left[R]
relative_margin_right[R]
relative_margin_top[R]
relative_padding_bottom[R]
relative_padding_left[R]
relative_padding_right[R]
relative_padding_top[R]
relative_width[R]

Public Class Methods

new(filename, prop) click to toggle source
# 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

Public Instance Methods

_compile(canvas, x, y, w, h) click to toggle source
Alias for: compile
as_large_as_possible?() click to toggle source
# File lib/rabbit/element/video.rb, line 72
def as_large_as_possible?
  @as_large_as_possible
end
compile(canvas, x, y, w, h) click to toggle source
# File lib/rabbit/element/video.rb, line 59
def compile(canvas, x, y, w, h)
  super
  adjust_size(canvas, @x, @y, @w, @h)
end
Also aliased as: _compile
compile_for_horizontal_centering(canvas, x, y, w, h) click to toggle source
# 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
draw_element(canvas, x, y, w, h, simulation) click to toggle source
# 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
height() click to toggle source
# File lib/rabbit/element/video.rb, line 68
def height
  @height.to_i + @padding_top + @padding_bottom
end
text() click to toggle source
# File lib/rabbit/element/video.rb, line 89
def text
  "video : #{File.basename(@filename)}"
end
to_rd() click to toggle source
# File lib/rabbit/element/video.rb, line 93
def to_rd
  text
end
width() click to toggle source
# File lib/rabbit/element/video.rb, line 64
def width
  @width.to_i + @padding_left + @padding_right
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.