Class: DYI::Shape::Image

Inherits:
Rectangle show all
Defined in:
lib/dyi/shape/base.rb

Overview

Since:

  • 1.0.0

Direct Known Subclasses

ImageReference

Constant Summary

Constants inherited from GraphicalElement

GraphicalElement::CLASS_REGEXP

Constants inherited from Element

Element::ID_REGEXP

Instance Attribute Summary collapse

Attributes inherited from Base

#anchor_href, #anchor_target, #attributes, #clipping, #parent

Attributes inherited from GraphicalElement

#css_class

Attributes inherited from Element

#description, #title

Instance Method Summary collapse

Methods inherited from Rectangle

#bottom, #center, create_on_corner, create_on_width_height, #left, #right, #top

Methods inherited from Base

#add_animation, #add_painting_animation, #add_transform_animation, #animate?, #animations, #clear_clipping, #draw_on, #has_marker?, #root_element?, #root_node?, #rotate, #scale, #set_clipping, #set_clipping_shapes, #set_event, #skew_x, #skew_y, #transform, #translate

Methods inherited from GraphicalElement

#add_css_class, #add_event_listener, #css_classes, #event_listeners, #event_target?, #remove_css_class, #remove_event_listener, #set_event, #to_reused_source

Methods inherited from Element

#canvas, #child_elements, #id, #id=, #include_external_file?, #inner_id

Constructor Details

#initialize(left_top, width, height, file_path, options = {}) ⇒ Image

Returns a new instance of Image.

Parameters:

  • left_top (Coordinate)

    a left-top coordinate of the image

  • width (Length)

    width of the image

  • heigth (Length)

    heigth of the image

  • file_path (String)

    a file path of the image

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :painting (Painting)

    painting status of this shape

  • :description (String)

    the description of this shape

  • :title (String)

    the title of this shape

Since:

  • 1.0.0



749
750
751
752
# File 'lib/dyi/shape/base.rb', line 749

def initialize(left_top, width, height, file_path, options={})
  super(left_top, width, height, options)
  @file_path = file_path
end

Instance Attribute Details

#file_pathObject (readonly)

Since:

  • 1.0.0



740
741
742
# File 'lib/dyi/shape/base.rb', line 740

def file_path
  @file_path
end

Instance Method Details

#has_uri_reference?Boolean

Returns whether the element has a URI reference.

Returns:

  • (Boolean)

    whether the element has a URI reference

Since:

  • 1.0.0



755
756
757
# File 'lib/dyi/shape/base.rb', line 755

def has_uri_reference?
  true
end

#write_as(formatter, io = $>) ⇒ Object

Since:

  • 1.0.0



759
760
761
# File 'lib/dyi/shape/base.rb', line 759

def write_as(formatter, io=$>)
  formatter.write_image(self, io, &(block_given? ? Proc.new : nil))
end