Class: RColor

Inherits:
Object
  • Object
show all
Defined in:
lib/command_handlers/models/r_color.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(display, red, green, blue, alpha = nil) ⇒ RColor

Returns a new instance of RColor.



16
17
18
19
20
21
22
# File 'lib/command_handlers/models/r_color.rb', line 16

def initialize(display, red, green, blue, alpha = nil)
  @display = display
  @red = red
  @green = green
  @blue = blue
  @alpha = alpha
end

Instance Attribute Details

#alphaObject (readonly)

Returns the value of attribute alpha.



4
5
6
# File 'lib/command_handlers/models/r_color.rb', line 4

def alpha
  @alpha
end

#blueObject (readonly)

Returns the value of attribute blue.



4
5
6
# File 'lib/command_handlers/models/r_color.rb', line 4

def blue
  @blue
end

#displayObject

Returns the value of attribute display.



4
5
6
# File 'lib/command_handlers/models/r_color.rb', line 4

def display
  @display
end

#greenObject (readonly)

Returns the value of attribute green.



4
5
6
# File 'lib/command_handlers/models/r_color.rb', line 4

def green
  @green
end

#redObject (readonly)

Returns the value of attribute red.



4
5
6
# File 'lib/command_handlers/models/r_color.rb', line 4

def red
  @red
end

Class Method Details

.for(display, standard_color) ⇒ Object



11
12
13
# File 'lib/command_handlers/models/r_color.rb', line 11

def for(display, standard_color)
  display.getSystemColor(RSwt[standard_color])
end

Instance Method Details

#colorObject



24
25
26
# File 'lib/command_handlers/models/r_color.rb', line 24

def color
  @color ||= Color.new(@display, *[@red, @green, @blue, @alpha].compact)
end