Class: Metro::UI::Image
Overview
The image will draw an image with the specifie path, color, rotation, and scale.
Constant Summary
Constants included from Metro::Units
Instance Attribute Summary collapse
-
#angle ⇒ Object
The angle at which to draw the image.
-
#center_x ⇒ Object
The center x position of the image as expressed in a scale of from left to right (0.0 to 1.0).
-
#center_y ⇒ Object
The center y position of the image as expressed in a scale of from top to bottom (0.0 to 1.0).
-
#color ⇒ Object
The color of the image, by default this is white to display the image as normal, but this can be used to augment the look of the image.
-
#dimensions ⇒ Object
The dimensions of the image.
-
#image ⇒ Object
The image asset to draw.
-
#position ⇒ Object
The position of the image.
-
#scale ⇒ Object
The scale of the image.
Attributes inherited from Model
Instance Method Summary collapse
Methods inherited from Model
#_load, #_save, #after_initialize, #create, #draw_completed?, hierarchy, inherited, #initialize, metro_name, #model, model_name, models, #name, #notification, #saveable_to_view, #show, #to_hash, #update, #update_completed?
Methods included from HasEvents
Methods included from KeyValueCoding
Methods included from PropertyOwner
Constructor Details
This class inherits a constructor from Metro::Model
Instance Attribute Details
#angle ⇒ Object
The angle at which to draw the image
33 |
# File 'lib/metro/models/ui/image.rb', line 33 property :angle, type: :numeric, default: 0 |
#center_x ⇒ Object
The center x position of the image as expressed in a scale of from left to right (0.0 to 1.0).
38 |
# File 'lib/metro/models/ui/image.rb', line 38 property :center_x, type: :numeric, default: 0.5 |
#center_y ⇒ Object
The center y position of the image as expressed in a scale of from top to bottom (0.0 to 1.0).
43 |
# File 'lib/metro/models/ui/image.rb', line 43 property :center_y, type: :numeric, default: 0.5 |
#color ⇒ Object
The color of the image, by default this is white to display the image as normal, but this can be used to augment the look of the image. Mostly color is use for the sub-property :alpha which allows an image to be faded-in and faded-out
29 |
# File 'lib/metro/models/ui/image.rb', line 29 property :color |
#dimensions ⇒ Object
The dimensions of the image.
51 52 53 |
# File 'lib/metro/models/ui/image.rb', line 51 property :dimensions do image.dimensions end |
#image ⇒ Object
The image asset to draw.
47 |
# File 'lib/metro/models/ui/image.rb', line 47 property :image |
#position ⇒ Object
The position of the image
18 |
# File 'lib/metro/models/ui/image.rb', line 18 property :position |
Instance Method Details
#bounds ⇒ Object
55 56 57 |
# File 'lib/metro/models/ui/image.rb', line 55 def bounds Bounds.new left: left_x, right: right_x, top: top_y, bottom: bottom_y end |
#draw ⇒ Object
59 60 61 62 63 64 65 |
# File 'lib/metro/models/ui/image.rb', line 59 def draw image.draw_rot x, y, z_order, angle.to_f, center_x, center_y, x_factor, y_factor, color end |