Class: Axon::Solid
- Inherits:
-
Object
- Object
- Axon::Solid
- Includes:
- Image, Enumerable
- Defined in:
- lib/axon/solid.rb
Instance Attribute Summary collapse
-
#color_model ⇒ Object
readonly
Returns the value of attribute color_model.
-
#components ⇒ Object
readonly
Returns the value of attribute components.
-
#height ⇒ Object
readonly
Returns the value of attribute height.
-
#width ⇒ Object
readonly
Returns the value of attribute width.
Instance Method Summary collapse
- #each ⇒ Object
-
#initialize(width, height, color = nil, color_model = nil) ⇒ Solid
constructor
A new instance of Solid.
Methods included from Image
#crop, #fit, #scale_bilinear, #scale_nearest_neighbor, #to_jpeg, #to_png, #write_jpeg, #write_png
Constructor Details
#initialize(width, height, color = nil, color_model = nil) ⇒ Solid
Returns a new instance of Solid.
7 8 9 10 11 12 |
# File 'lib/axon/solid.rb', line 7 def initialize(width, height, color=nil, color_model=nil) @width, @height = width, height @color = color || "\x00\x00\x00" @color_model = color_model || :RGB @components = @color.size end |
Instance Attribute Details
#color_model ⇒ Object (readonly)
Returns the value of attribute color_model.
5 6 7 |
# File 'lib/axon/solid.rb', line 5 def color_model @color_model end |
#components ⇒ Object (readonly)
Returns the value of attribute components.
5 6 7 |
# File 'lib/axon/solid.rb', line 5 def components @components end |
#height ⇒ Object (readonly)
Returns the value of attribute height.
5 6 7 |
# File 'lib/axon/solid.rb', line 5 def height @height end |
#width ⇒ Object (readonly)
Returns the value of attribute width.
5 6 7 |
# File 'lib/axon/solid.rb', line 5 def width @width end |
Instance Method Details
#each ⇒ Object
14 15 16 17 |
# File 'lib/axon/solid.rb', line 14 def each sl = @color * width height.times { yield sl } end |