Class: Gosu::Color
- Inherits:
-
Object
- Object
- Gosu::Color
- Defined in:
- rdoc/gosu.rb
Overview
Represents an ARGB color value with 8 bits for each channel. Colors can be used interchangeably with integer literals of the form 0xAARRGGBB in all Gosu APIs.
Constant Summary collapse
- NONE =
Gosu::Color.argb(0x00_000000)
- BLACK =
Gosu::Color.argb(0xff_000000)
- GRAY =
Gosu::Color.argb(0xff_808080)
- WHITE =
Gosu::Color.argb(0xff_ffffff)
- AQUA =
Gosu::Color.argb(0xff_00ffff)
- RED =
Gosu::Color.argb(0xff_ff0000)
- GREEN =
Gosu::Color.argb(0xff_00ff00)
- BLUE =
Gosu::Color.argb(0xff_0000ff)
- YELLOW =
Gosu::Color.argb(0xff_ffff00)
- FUCHSIA =
Gosu::Color.argb(0xff_ff00ff)
- CYAN =
Gosu::Color.argb(0xff_00ffff)
Instance Attribute Summary collapse
-
#alpha ⇒ Integer
The color's alpha channel.
-
#blue ⇒ Integer
The color's blue channel.
-
#green ⇒ Integer
The color's green channel.
-
#hue ⇒ Float
The color's hue in the range [0.0; 360.0).
-
#red ⇒ Integer
The color's red channel.
-
#saturation ⇒ Float
The color's saturation in the range [0.0; 1.0].
-
#value ⇒ Float
The color's value in the range [0.0; 1.0].
Creating colors. collapse
-
.argb(*args) ⇒ Color
This method is equivalent to calling `Color.new`, but the name makes the parameter order explicit.
-
.from_ahsv(a, h, s, v) ⇒ Color
Converts an HSV triplet to a color with the alpha channel set to a given value.
-
.from_hsv(h, s, v) ⇒ Color
Converts an HSV triplet to an opaque color.
-
.rgba(*args) ⇒ Color
A new instance of Color.
-
#initialize(*args) ⇒ Color
constructor
A new instance of Color.
Instance Method Summary collapse
-
#dup ⇒ Color
A copy of the color.
-
#gl ⇒ Integer
Returns a 32-bit representation of the color suitable for use with OpenGL calls.
Constructor Details
Instance Attribute Details
#alpha ⇒ Integer
Returns the color's alpha channel.
102 103 104 |
# File 'rdoc/gosu.rb', line 102 def alpha @alpha end |
#blue ⇒ Integer
Returns the color's blue channel.
114 115 116 |
# File 'rdoc/gosu.rb', line 114 def blue @blue end |
#green ⇒ Integer
Returns the color's green channel.
110 111 112 |
# File 'rdoc/gosu.rb', line 110 def green @green end |
#hue ⇒ Float
Returns the color's hue in the range [0.0; 360.0).
118 119 120 |
# File 'rdoc/gosu.rb', line 118 def hue @hue end |
#red ⇒ Integer
Returns the color's red channel.
106 107 108 |
# File 'rdoc/gosu.rb', line 106 def red @red end |
#saturation ⇒ Float
Returns the color's saturation in the range [0.0; 1.0].
122 123 124 |
# File 'rdoc/gosu.rb', line 122 def saturation @saturation end |
#value ⇒ Float
Returns the color's value in the range [0.0; 1.0].
126 127 128 |
# File 'rdoc/gosu.rb', line 126 def value @value end |
Class Method Details
.argb(argb) ⇒ Color .argb(a, r, g, b) ⇒ Color
This method is equivalent to calling `Color.new`, but the name makes the parameter order explicit.
170 |
# File 'rdoc/gosu.rb', line 170 def self.argb(*args); end |
.from_ahsv(a, h, s, v) ⇒ Color
Converts an HSV triplet to a color with the alpha channel set to a given value.
189 |
# File 'rdoc/gosu.rb', line 189 def self.from_ahsv(a, h, s, v); end |
.from_hsv(h, s, v) ⇒ Color
Converts an HSV triplet to an opaque color.
180 |
# File 'rdoc/gosu.rb', line 180 def self.from_hsv(h, s, v); end |
Instance Method Details
#gl ⇒ Integer
Returns a 32-bit representation of the color suitable for use with OpenGL calls. This color is stored in a fixed order in memory and its integer value may vary depending on your system's byte order.
196 |
# File 'rdoc/gosu.rb', line 196 def gl; end |