Class: Fidgit::ImageFrame
- Defined in:
- lib/fidgit/elements/image_frame.rb
Overview
A wrapper around a Gosu::Image to show it in the GUI.
Constant Summary collapse
Constants inherited from Element
Element::DEFAULT_SCHEMA_FILE, Element::VALID_ALIGN_H, Element::VALID_ALIGN_V
Instance Attribute Summary collapse
-
#factor_x ⇒ Object
readonly
Returns the value of attribute factor_x.
-
#factor_y ⇒ Object
readonly
Returns the value of attribute factor_y.
-
#image ⇒ Object
Returns the value of attribute image.
Attributes inherited from Element
#align_h, #align_v, #background_color, #border_thickness, #font, #padding_bottom, #padding_left, #padding_right, #padding_top, #parent, #tip, #z
Instance Method Summary collapse
- #draw_foreground ⇒ Object
-
#initialize(image, options = {}) ⇒ ImageFrame
constructor
A new instance of ImageFrame.
- #thumbnail? ⇒ Boolean
Methods inherited from Element
#default, #drag?, #draw, #draw_frame, #draw_rect, #enabled=, #enabled?, #height, #height=, #hit?, #max_height, #max_width, #min_height, #min_width, new, original_new, #outer_height, #outer_width, #recalc, schema, #to_s, #update, #width, #width=, #with, #x, #x=, #y, #y=
Methods included from Event
#events, included, new_event_handlers, #publish, #subscribe, #unsubscribe
Constructor Details
#initialize(image, options = {}) ⇒ ImageFrame
Returns a new instance of ImageFrame.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/fidgit/elements/image_frame.rb', line 16 def initialize(image, = {}) = { thumbnail: false, factor: 1, }.merge! @thumbnail = [:thumbnail] @factor_x = [:factor_x] || [:factor] @factor_y = [:factor_y] || [:factor] super() self.image = image end |
Instance Attribute Details
#factor_x ⇒ Object (readonly)
Returns the value of attribute factor_x.
7 8 9 |
# File 'lib/fidgit/elements/image_frame.rb', line 7 def factor_x @factor_x end |
#factor_y ⇒ Object (readonly)
Returns the value of attribute factor_y.
7 8 9 |
# File 'lib/fidgit/elements/image_frame.rb', line 7 def factor_y @factor_y end |
#image ⇒ Object
Returns the value of attribute image.
7 8 9 |
# File 'lib/fidgit/elements/image_frame.rb', line 7 def image @image end |
Instance Method Details
#draw_foreground ⇒ Object
40 41 42 |
# File 'lib/fidgit/elements/image_frame.rb', line 40 def draw_foreground @image.draw(x + padding_left, y + padding_top, z, factor_x, factor_y, enabled? ? ENABLED_COLOR : DISABLED_COLOR) if @image end |
#thumbnail? ⇒ Boolean
9 |
# File 'lib/fidgit/elements/image_frame.rb', line 9 def thumbnail?; @thumbnail; end |