rgss 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.clang-format +6 -0
- data/.gitignore +167 -0
- data/.yardopts +6 -0
- data/CHANGELOG.md +4 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/Rakefile +9 -0
- data/ext/rgss/cglm-v0.7.9.tar.gz +0 -0
- data/ext/rgss/color.c +599 -0
- data/ext/rgss/entity.c +373 -0
- data/ext/rgss/extconf.rb +53 -0
- data/ext/rgss/font.c +135 -0
- data/ext/rgss/game.c +469 -0
- data/ext/rgss/game.h +99 -0
- data/ext/rgss/gl.c +3217 -0
- data/ext/rgss/glad.c +1140 -0
- data/ext/rgss/glad.h +2129 -0
- data/ext/rgss/glfw.c +1453 -0
- data/ext/rgss/graphics.c +324 -0
- data/ext/rgss/image.c +274 -0
- data/ext/rgss/input.c +745 -0
- data/ext/rgss/khrplatform.h +290 -0
- data/ext/rgss/mat4.c +279 -0
- data/ext/rgss/pax_global_header +1 -0
- data/ext/rgss/point.c +253 -0
- data/ext/rgss/rect.c +449 -0
- data/ext/rgss/rgss.c +56 -0
- data/ext/rgss/rgss.h +241 -0
- data/ext/rgss/stb_image.h +7762 -0
- data/ext/rgss/stb_image_write.h +1690 -0
- data/ext/rgss/stb_rect_pack.h +628 -0
- data/ext/rgss/stb_truetype.h +5011 -0
- data/ext/rgss/utf8.h +1652 -0
- data/ext/rgss/uthash.h +1133 -0
- data/ext/rgss/vec.c +114 -0
- data/ext/rgss/vec.h +192 -0
- data/ext/rgss/vec2.c +489 -0
- data/ext/rgss/vec3.c +751 -0
- data/ext/rgss/vec4.c +681 -0
- data/lib/rgss.rb +140 -0
- data/lib/rgss/batch.rb +57 -0
- data/lib/rgss/blend.rb +47 -0
- data/lib/rgss/game_object.rb +28 -0
- data/lib/rgss/plane.rb +95 -0
- data/lib/rgss/renderable.rb +158 -0
- data/lib/rgss/rgss.so +0 -0
- data/lib/rgss/shader.rb +94 -0
- data/lib/rgss/shaders/sprite-frag.glsl +40 -0
- data/lib/rgss/shaders/sprite-vert.glsl +17 -0
- data/lib/rgss/sprite.rb +139 -0
- data/lib/rgss/stubs/color.rb +318 -0
- data/lib/rgss/stubs/gl.rb +1999 -0
- data/lib/rgss/stubs/glfw.rb +626 -0
- data/lib/rgss/stubs/rect.rb +324 -0
- data/lib/rgss/stubs/rpg.rb +267 -0
- data/lib/rgss/stubs/tone.rb +65 -0
- data/lib/rgss/texture.rb +132 -0
- data/lib/rgss/tilemap.rb +116 -0
- data/lib/rgss/version.rb +3 -0
- data/lib/rgss/viewport.rb +67 -0
- data/rgss.gemspec +44 -0
- data/test.png +0 -0
- metadata +178 -0
data/lib/rgss/rgss.so
ADDED
Binary file
|
data/lib/rgss/shader.rb
ADDED
@@ -0,0 +1,94 @@
|
|
1
|
+
|
2
|
+
module RGSS
|
3
|
+
|
4
|
+
class Shader < GameObject
|
5
|
+
|
6
|
+
PROJECTION_BINDING = 0
|
7
|
+
|
8
|
+
extend GL
|
9
|
+
include GL
|
10
|
+
|
11
|
+
def initialize(vertex, fragment, geometry = nil)
|
12
|
+
super(glCreateProgram)
|
13
|
+
|
14
|
+
raise(ArgumentError, 'vertex source cannot be nil') unless vertex
|
15
|
+
raise(ArgumentError, 'fragment source cannot be nil') unless fragment
|
16
|
+
|
17
|
+
v = compile(GL_VERTEX_SHADER, vertex)
|
18
|
+
f = compile(GL_FRAGMENT_SHADER, fragment)
|
19
|
+
g = geometry ? compile(GL_GEOMETRY_SHADER, geometry) : 0
|
20
|
+
|
21
|
+
glAttachShader(self.id, v)
|
22
|
+
glAttachShader(self.id, f)
|
23
|
+
glAttachShader(self.id, g) if g > 0
|
24
|
+
|
25
|
+
glLinkProgram(self.id)
|
26
|
+
|
27
|
+
[v, f, g].each do |shader|
|
28
|
+
next if shader.zero?
|
29
|
+
glDetachShader(self.id, shader)
|
30
|
+
glDeleteShader(shader)
|
31
|
+
end
|
32
|
+
|
33
|
+
buffer = "\0" * SIZEOF_INT
|
34
|
+
glGetProgramiv(self.id, GL_LINK_STATUS, buffer)
|
35
|
+
|
36
|
+
return if buffer.unpack1('i') == GL_TRUE
|
37
|
+
|
38
|
+
glGetProgramiv(self.id, GL_INFO_LOG_LENGTH, buffer)
|
39
|
+
length = buffer.unpack1('i')
|
40
|
+
message = "\0" * length
|
41
|
+
|
42
|
+
glGetProgramInfoLog(self.id, lengh, buffer, message)
|
43
|
+
raise(RuntimeError, "failed to link shader program: #{message}")
|
44
|
+
|
45
|
+
index = glGetUniformBlockIndex(self.id, 'ortho')
|
46
|
+
glUniformBlockBinding(@id, index, 0) if index >= 0
|
47
|
+
|
48
|
+
p index
|
49
|
+
|
50
|
+
if block_given?
|
51
|
+
yield self
|
52
|
+
dispose
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def dispose
|
57
|
+
glDeleteProgram(self.id) if self.id.nonzero?
|
58
|
+
super
|
59
|
+
end
|
60
|
+
|
61
|
+
def valid?
|
62
|
+
self.id.nonzero? && glIsProgram(self.id)
|
63
|
+
end
|
64
|
+
|
65
|
+
def locate(uniform)
|
66
|
+
return uniform ? glGetUniformLocation(self.id, uniform) : -1
|
67
|
+
end
|
68
|
+
|
69
|
+
def use
|
70
|
+
glUseProgram(@id)
|
71
|
+
end
|
72
|
+
|
73
|
+
protected
|
74
|
+
|
75
|
+
def compile(type, source)
|
76
|
+
|
77
|
+
id = glCreateShader(type)
|
78
|
+
glShaderSource(id, source)
|
79
|
+
glCompileShader(id)
|
80
|
+
|
81
|
+
buffer = "\0" * SIZEOF_INT
|
82
|
+
glGetShaderiv(id, GL_COMPILE_STATUS, buffer)
|
83
|
+
return id if buffer.unpack1('i') == GL_TRUE
|
84
|
+
|
85
|
+
glGetShaderiv(id, GL_INFO_LOG_LENGTH, buffer)
|
86
|
+
length = buffer.unpack1('i')
|
87
|
+
message = "\0" * length
|
88
|
+
|
89
|
+
glGetShaderInfoLog(id, length, buffer, message)
|
90
|
+
raise(SyntaxError, "failed to compile shader: #{message}")
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
#version 330 core
|
2
|
+
|
3
|
+
in vec2 uv;
|
4
|
+
out vec4 result;
|
5
|
+
|
6
|
+
uniform sampler2D image;
|
7
|
+
uniform vec4 color;
|
8
|
+
uniform vec4 tone;
|
9
|
+
uniform vec4 flash;
|
10
|
+
uniform float opacity = 1.0;
|
11
|
+
uniform float hue;
|
12
|
+
|
13
|
+
const vec3 k = vec3(0.57735, 0.57735, 0.57735);
|
14
|
+
|
15
|
+
void main() {
|
16
|
+
|
17
|
+
// Get the fragment from bound texture
|
18
|
+
result = texture(image, uv);
|
19
|
+
|
20
|
+
// Applu hue shift
|
21
|
+
float angle = cos(radians(hue));
|
22
|
+
vec3 rgb = vec3(result.rgb * angle + cross(k, result.rgb) * sin(radians(hue)) + k * dot(k, result.rgb) * (1.0 - angle));
|
23
|
+
result = vec4(rgb, result.a);
|
24
|
+
|
25
|
+
// Apply color blending
|
26
|
+
result = vec4(mix(result.rgb, color.rgb, color.a), result.a);
|
27
|
+
|
28
|
+
// Apply tone blending
|
29
|
+
float avg = (result.r + result.g + result.b) / 3.0;
|
30
|
+
result.r = result.r - ((result.r - avg) * tone.a);
|
31
|
+
result.g = result.g - ((result.g - avg) * tone.a);
|
32
|
+
result.b = result.b - ((result.b - avg) * tone.a);
|
33
|
+
result = vec4(clamp(result.rgb + tone.rgb, 0.0, 1.0), result.a);
|
34
|
+
|
35
|
+
// Flash effect color blending
|
36
|
+
result = vec4(mix(result.rgb, flash.rgb, flash.a), result.a);
|
37
|
+
|
38
|
+
// Apply opacity
|
39
|
+
result *= opacity;
|
40
|
+
}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
#version 330 core
|
2
|
+
|
3
|
+
in layout(location = 0) vec4 vertex;
|
4
|
+
|
5
|
+
out vec2 uv;
|
6
|
+
|
7
|
+
layout (std140) uniform ortho
|
8
|
+
{
|
9
|
+
mat4 projection;
|
10
|
+
};
|
11
|
+
|
12
|
+
uniform mat4 model;
|
13
|
+
|
14
|
+
void main() {
|
15
|
+
uv = vertex.zw;
|
16
|
+
gl_Position = projection * model * vec4(vertex.xy, 0.0, 1.0);
|
17
|
+
}
|
data/lib/rgss/sprite.rb
ADDED
@@ -0,0 +1,139 @@
|
|
1
|
+
|
2
|
+
module RGSS
|
3
|
+
|
4
|
+
class Sprite < Renderable
|
5
|
+
|
6
|
+
FLIP_NONE = 0x00
|
7
|
+
FLIP_X = 0x01
|
8
|
+
FLIP_Y = 0x02
|
9
|
+
FLIP_BOTH = FLIP_X | FLIP_Y
|
10
|
+
|
11
|
+
attr_reader :texture
|
12
|
+
attr_accessor :flip
|
13
|
+
|
14
|
+
def initialize(*args, **opts)
|
15
|
+
super(opts[:viewport]&.batch || Graphics.batch)
|
16
|
+
vertex_setup
|
17
|
+
@flip = FLIP_NONE
|
18
|
+
self.texture = nil
|
19
|
+
self.src_rect = Rect.empty
|
20
|
+
end
|
21
|
+
|
22
|
+
def texture=(value)
|
23
|
+
@texture = value
|
24
|
+
self.src_rect = @texture ? @texture.rect : Rect.empty
|
25
|
+
value
|
26
|
+
end
|
27
|
+
|
28
|
+
def flip=(value)
|
29
|
+
@flip = value || FLIP_NONE
|
30
|
+
update_vertices
|
31
|
+
value
|
32
|
+
end
|
33
|
+
|
34
|
+
def src_rect=(rect)
|
35
|
+
@src_rect = rect || Rect.empty
|
36
|
+
self.size = rect.size
|
37
|
+
update_vertices
|
38
|
+
rect
|
39
|
+
end
|
40
|
+
|
41
|
+
def render(alpha)
|
42
|
+
return unless @texture && @visible && @opacity > 0.0
|
43
|
+
super(alpha)
|
44
|
+
@texture.bind
|
45
|
+
glBindVertexArray(@vao)
|
46
|
+
glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_BYTE, nil)
|
47
|
+
glBindVertexArray(GL_NONE)
|
48
|
+
end
|
49
|
+
|
50
|
+
|
51
|
+
def update_vertices
|
52
|
+
return unless @texture
|
53
|
+
|
54
|
+
l = @src_rect.x / @texture.width.to_f
|
55
|
+
t = @src_rect.y / @texture.height.to_f
|
56
|
+
r = l + @src_rect.width / @texture.width.to_f
|
57
|
+
b = t + @src_rect.height / @texture.height.to_f
|
58
|
+
|
59
|
+
if (@flip & FLIP_X).nonzero?
|
60
|
+
l, r = r, l
|
61
|
+
end
|
62
|
+
if (@flip & FLIP_Y).nonzero?
|
63
|
+
t, b = b, t
|
64
|
+
end
|
65
|
+
vertices =
|
66
|
+
[
|
67
|
+
0.0, 1.0, l, b, # Bottom-Left
|
68
|
+
1.0, 0.0, r, t, # Top-Right
|
69
|
+
0.0, 0.0, l, t, # Top-Left
|
70
|
+
1.0, 1.0, r, b, # Bottom-Right
|
71
|
+
].pack('f*')
|
72
|
+
glBindBuffer(GL_ARRAY_BUFFER, @vbo)
|
73
|
+
glBufferSubData(GL_ARRAY_BUFFER, 0, vertices.size, vertices)
|
74
|
+
glBindBuffer(GL_ARRAY_BUFFER, 0)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
|
79
|
+
class SpriteAtlas < Sprite
|
80
|
+
|
81
|
+
attr_reader :region
|
82
|
+
attr_reader :columns
|
83
|
+
attr_reader :rows
|
84
|
+
|
85
|
+
attr_reader :cx
|
86
|
+
attr_reader :cy
|
87
|
+
|
88
|
+
def initialize(*args, **opts)
|
89
|
+
@region = opts[:region]
|
90
|
+
@columns = opts[:columns] || 0
|
91
|
+
@rows = opts[:rows] || 0
|
92
|
+
super
|
93
|
+
|
94
|
+
@cx = 0
|
95
|
+
@cy = 0
|
96
|
+
update_src_rect
|
97
|
+
end
|
98
|
+
|
99
|
+
def cx=(cell_x)
|
100
|
+
@cx = @columns.zero? ? 0 : cell_x % @columns
|
101
|
+
update_src_rect
|
102
|
+
cell_x
|
103
|
+
end
|
104
|
+
|
105
|
+
def cy=(cell_y)
|
106
|
+
@cy = @rows.zero? ? 0 : cell_y % @rows
|
107
|
+
update_src_rect
|
108
|
+
cell_y
|
109
|
+
end
|
110
|
+
|
111
|
+
def region=(value)
|
112
|
+
@region = value
|
113
|
+
update_src_rect
|
114
|
+
value
|
115
|
+
end
|
116
|
+
|
117
|
+
def select(cell_x, cell_y)
|
118
|
+
@cx = @columns.zero? ? 0 : cell_x % @columns
|
119
|
+
@cy = @rows.zero? ? 0 : cell_y % @rows
|
120
|
+
update_src_rect
|
121
|
+
end
|
122
|
+
|
123
|
+
private
|
124
|
+
|
125
|
+
def update_src_rect
|
126
|
+
return unless @texture
|
127
|
+
|
128
|
+
@region ||= @texture.rect
|
129
|
+
@cw = @columns.zero? ? 0 : @region.width / @columns
|
130
|
+
@ch = @rows.zero? ? 0 : @region.height / @rows
|
131
|
+
|
132
|
+
cell_x = (@cx * @cw) + @region.x
|
133
|
+
cell_y = (@cy * @ch) + @region.y
|
134
|
+
|
135
|
+
self.src_rect = Rect.new(cell_x, cell_y, @cw, @ch)
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
end
|
@@ -0,0 +1,318 @@
|
|
1
|
+
module RGSS
|
2
|
+
##
|
3
|
+
# A structure for describing a color, in RGB, HSL, and HSV/HSB color-spaces, though RGBA is the internal format. All
|
4
|
+
# components are normalized floating point values in the range of `0.0` and `1.0`. Internally this class is
|
5
|
+
# represented as a typical 4 component vector, with 32-bit floating point values. Ruby uses a 64-bit `double` for
|
6
|
+
# floating point numbers, which have a higher precision (about 13 digits) compared to a 32-bit `float` (about 7
|
7
|
+
# digits), so bear this in mind and do not rely on any precision or accuracy of values beyond 6-7 digits, they should
|
8
|
+
# be ignored beyond that point.
|
9
|
+
#
|
10
|
+
# @note All out of range values are automatically clamped to their respective limits.
|
11
|
+
#
|
12
|
+
# @note All relevant methods implemented in `Object` (i.e. `#dup`, `#clone`, Marshalling, equality) have also been
|
13
|
+
# properly implemented/overridden, but have been omitted from the documentation for brevity.
|
14
|
+
class Color
|
15
|
+
|
16
|
+
##
|
17
|
+
# The value of the red color component.
|
18
|
+
# @return [Float] a normalized value between `0.0` amd `1.0`.
|
19
|
+
attr_reader :r
|
20
|
+
|
21
|
+
##
|
22
|
+
# The value of the green color component.
|
23
|
+
# @return [Float] a normalized value between `0.0` amd `1.0`.
|
24
|
+
attr_reader :g
|
25
|
+
|
26
|
+
##
|
27
|
+
# The value of the blue color component.
|
28
|
+
# @return [Float] a normalized value between `0.0` amd `1.0`.
|
29
|
+
attr_reader :b
|
30
|
+
|
31
|
+
##
|
32
|
+
# The value of the alpha color component.
|
33
|
+
# @return [Float] a normalized value between `0.0` amd `1.0`.
|
34
|
+
attr_reader :a
|
35
|
+
|
36
|
+
##
|
37
|
+
# Creates a new instance of the {Color} class.
|
38
|
+
# @param red [Float] the red component, a normalized value between `0.0` and `1.0`.
|
39
|
+
# @param green [Float] the green component, a normalized value between `0.0` and `1.0`.
|
40
|
+
# @param blue [Float] the blue component, a normalized value between `0.0` and `1.0`.
|
41
|
+
# @param alpha [Float] the alpha component, a normalized value between `0.0` and `1.0`.
|
42
|
+
def initialize(red, green, blue, alpha = 1.0)
|
43
|
+
end
|
44
|
+
|
45
|
+
##
|
46
|
+
# Creates an array instance that represents this object.
|
47
|
+
# @return [Array(Float, Float, Float, Float)] The newly created Array.
|
48
|
+
# @example
|
49
|
+
# Color::BLUE_VIOLET.to_a
|
50
|
+
# #=> []
|
51
|
+
def to_a
|
52
|
+
end
|
53
|
+
BLUE_VIOLET = Color.new(0.54118, 0.16863, 0.88627, 1.00000)
|
54
|
+
##
|
55
|
+
# Creates a hash instance that represents this object.
|
56
|
+
# @return [Hash{Symbol => Float}] The newly created Hash.
|
57
|
+
# @example
|
58
|
+
# Color::BLUE_VIOLET.to_h
|
59
|
+
# #=> { :red => 0.54118, :green => 0.16863, :blue => 0.88627, :alpha => 1.0 }
|
60
|
+
def to_h
|
61
|
+
end
|
62
|
+
|
63
|
+
##
|
64
|
+
# Creates a new {Color} by inverting the values of the this instance, producing the "negative" of the color.
|
65
|
+
# @param alpha [Boolean] `true` to invert the alpha component, otherwise `false` to maintain the same alpha.
|
66
|
+
# @return [Color] the resulting {Color} instance.
|
67
|
+
#
|
68
|
+
# @example
|
69
|
+
# magenta = Color.new(1.00000, 0.00000, 1.00000, 1.00000)
|
70
|
+
# #=> <1.0, 0.0, 1.0, 1.0>
|
71
|
+
# negative = magenta.inverse
|
72
|
+
# #> <0.0, 1.0, 0.0, 1.0>
|
73
|
+
def inverse(alpha = false)
|
74
|
+
end
|
75
|
+
|
76
|
+
##
|
77
|
+
# Creates a new {Color} by linearly scaling the components of this instance by the specified value.
|
78
|
+
# @param scalar [Float] A scalar value to alter this value by.
|
79
|
+
# @return [Color] the resulting {Color} instance.
|
80
|
+
#
|
81
|
+
# @example
|
82
|
+
# white = Color.new(1.0, 1.0, 1.0, 1.0)
|
83
|
+
# #=> <1.0, 1.0, 1.0, 1.0>
|
84
|
+
# mid_gray = white * 0.5
|
85
|
+
# #=> <0.5, 0.5, 0.5, 0.5>
|
86
|
+
def *(scalar)
|
87
|
+
end
|
88
|
+
|
89
|
+
##
|
90
|
+
# The hue component of the color from the HSL and HSB/HSV color-spaces.
|
91
|
+
# @return [Float] the hue of the color, in the range of `0.0` to `360.0`.
|
92
|
+
def hue
|
93
|
+
end
|
94
|
+
|
95
|
+
##
|
96
|
+
# The saturation component of the color from the HSL and HSB/HSV color-spaces.
|
97
|
+
# @return [Float] the hue of the color, in the range of `0.0` to `1.0`.
|
98
|
+
def saturation
|
99
|
+
end
|
100
|
+
|
101
|
+
##
|
102
|
+
# The lightness component of the color from the HSL color-space.
|
103
|
+
# @return [Float] the lightness of the color, in the range of `0.0` to `1.0`.
|
104
|
+
def lightness
|
105
|
+
end
|
106
|
+
|
107
|
+
##
|
108
|
+
# The brightness/value component of the color from the HSB/HSV color-space.
|
109
|
+
# @return [Float] the brightness of the color, in the range of `0.0` to `1.0`.
|
110
|
+
def brightness
|
111
|
+
end
|
112
|
+
|
113
|
+
##
|
114
|
+
# The values of the color in the HSL color-space.
|
115
|
+
# @return [Array(Float, Float, Float)] the HSL components.
|
116
|
+
# @note It is more efficient to retrieve all at values at once than each component individually.
|
117
|
+
def hsl
|
118
|
+
end
|
119
|
+
|
120
|
+
##
|
121
|
+
# The values of the color in the HSB/HSV color-space.
|
122
|
+
# @return [Array(Float, Float, Float)] the HSB/HSV components.
|
123
|
+
# @note It is more efficient to retrieve all at values at once than each component individually.
|
124
|
+
def hsv
|
125
|
+
end
|
126
|
+
|
127
|
+
alias_method :red, :r
|
128
|
+
alias_method :green, :g
|
129
|
+
alias_method :blue, :b
|
130
|
+
alias_method :alpha, :a
|
131
|
+
alias_method :multiply, :*
|
132
|
+
alias_method :value, :brightness
|
133
|
+
alias_method :hsb, :hsv
|
134
|
+
|
135
|
+
##
|
136
|
+
# Linearly interpolates two colors using the given the weight to produce a mixture of each.
|
137
|
+
# @param color1 [Color] the base color to mix from.
|
138
|
+
# @param color2 [Color] the target color to mix to.
|
139
|
+
# @param weight [Float] the scaling factor of the second color to apply, where `0.0` means none, and *color1* will
|
140
|
+
# be returned, `1.0` means fully *color2*, and values in between are a weighted mixture.
|
141
|
+
# @return [Color] the resulting {Color} instance.
|
142
|
+
def self.mix(color1, color2, weight)
|
143
|
+
end
|
144
|
+
|
145
|
+
##
|
146
|
+
# Creates a new {Color} using from the HSL color-space.
|
147
|
+
# @param hue [Float] the hue component in the range of `0.0` and `360.0`.
|
148
|
+
# @param saturation [Float] the saturation component in the range of `0.0` and `1.0`.
|
149
|
+
# @param lightness [Float] the lightness component in the range of `0.0` and `1.0`.
|
150
|
+
# @param alpha [Float] the alpha component of the color in the range of `0.0` and `1.0`.
|
151
|
+
# @return [Color] the newly created {Color}.
|
152
|
+
def self.from_hsl(hue, saturation, lightness, alpha = 1.0)
|
153
|
+
end
|
154
|
+
|
155
|
+
##
|
156
|
+
# Creates a new {Color} using from the HSB/HSL color-space.
|
157
|
+
# @param hue [Float] the hue component in the range of `0.0` and `360.0`.
|
158
|
+
# @param saturation [Float] the saturation component in the range of `0.0` and `1.0`.
|
159
|
+
# @param brightness [Float] the brightness/value component in the range of `0.0` and `1.0`.
|
160
|
+
# @param alpha [Float] the alpha component of the color in the range of `0.0` and `1.0`.
|
161
|
+
# @return [Color] the newly created {Color}.
|
162
|
+
def self.from_hsb(hue, saturation, brightness, alpha = 1.0)
|
163
|
+
end
|
164
|
+
|
165
|
+
##
|
166
|
+
# Creates a new {Color} using from the HSB/HSL color-space.
|
167
|
+
# @param hue [Float] the hue component in the range of `0.0` and `360.0`.
|
168
|
+
# @param saturation [Float] the saturation component in the range of `0.0` and `1.0`.
|
169
|
+
# @param value [Float] the brightness/value component in the range of `0.0` and `1.0`.
|
170
|
+
# @param alpha [Float] the alpha component of the color in the range of `0.0` and `1.0`.
|
171
|
+
# @return [Color] the newly created {Color}.
|
172
|
+
def self.from_hsv(hue, saturation, value, alpha = 1.0)
|
173
|
+
end
|
174
|
+
|
175
|
+
NONE = Color.new(0.00000, 0.00000, 0.00000, 0.00000)
|
176
|
+
TRANSPARENT = Color.new(1.00000, 1.00000, 1.00000, 0.00000)
|
177
|
+
ALICE_BLUE = Color.new(0.94118, 0.97255, 1.00000, 1.00000)
|
178
|
+
ANTIQUE_WHITE = Color.new(0.98039, 0.92157, 0.84314, 1.00000)
|
179
|
+
AQUA = Color.new(0.00000, 1.00000, 1.00000, 1.00000)
|
180
|
+
AQUAMARINE = Color.new(0.49804, 1.00000, 0.83137, 1.00000)
|
181
|
+
AZURE = Color.new(0.94118, 1.00000, 1.00000, 1.00000)
|
182
|
+
BEIGE = Color.new(0.96078, 0.96078, 0.86275, 1.00000)
|
183
|
+
BISQUE = Color.new(1.00000, 0.89412, 0.76863, 1.00000)
|
184
|
+
BLACK = Color.new(0.00000, 0.00000, 0.00000, 1.00000)
|
185
|
+
BLANCHED_ALMOND = Color.new(1.00000, 0.92157, 0.80392, 1.00000)
|
186
|
+
BLUE = Color.new(0.00000, 0.00000, 1.00000, 1.00000)
|
187
|
+
BLUE_VIOLET = Color.new(0.54118, 0.16863, 0.88627, 1.00000)
|
188
|
+
BROWN = Color.new(0.64706, 0.16471, 0.16471, 1.00000)
|
189
|
+
BURLY_WOOD = Color.new(0.87059, 0.72157, 0.52941, 1.00000)
|
190
|
+
CADET_BLUE = Color.new(0.37255, 0.61961, 0.62745, 1.00000)
|
191
|
+
CHARTREUSE = Color.new(0.49804, 1.00000, 0.00000, 1.00000)
|
192
|
+
CHOCOLATE = Color.new(0.82353, 0.41176, 0.11765, 1.00000)
|
193
|
+
CORAL = Color.new(1.00000, 0.49804, 0.31373, 1.00000)
|
194
|
+
CORNFLOWER_BLUE = Color.new(0.39216, 0.58431, 0.92941, 1.00000)
|
195
|
+
CORNSILK = Color.new(1.00000, 0.97255, 0.86275, 1.00000)
|
196
|
+
CRIMSON = Color.new(0.86275, 0.07843, 0.23529, 1.00000)
|
197
|
+
CYAN = Color.new(0.00000, 1.00000, 1.00000, 1.00000)
|
198
|
+
DARK_BLUE = Color.new(0.00000, 0.00000, 0.54510, 1.00000)
|
199
|
+
DARK_CYAN = Color.new(0.00000, 0.54510, 0.54510, 1.00000)
|
200
|
+
DARK_GOLDENROD = Color.new(0.72157, 0.52549, 0.04314, 1.00000)
|
201
|
+
DARK_GRAY = Color.new(0.66275, 0.66275, 0.66275, 1.00000)
|
202
|
+
DARK_GREEN = Color.new(0.00000, 0.39216, 0.00000, 1.00000)
|
203
|
+
DARK_KHAKI = Color.new(0.74118, 0.71765, 0.41961, 1.00000)
|
204
|
+
DARK_MAGENTA = Color.new(0.54510, 0.00000, 0.54510, 1.00000)
|
205
|
+
DARK_OLIVE_GREEN = Color.new(0.33333, 0.41961, 0.18431, 1.00000)
|
206
|
+
DARK_ORANGE = Color.new(1.00000, 0.54902, 0.00000, 1.00000)
|
207
|
+
DARK_ORCHID = Color.new(0.60000, 0.19608, 0.80000, 1.00000)
|
208
|
+
DARK_RED = Color.new(0.54510, 0.00000, 0.00000, 1.00000)
|
209
|
+
DARK_SALMON = Color.new(0.91373, 0.58824, 0.47843, 1.00000)
|
210
|
+
DARK_SEA_GREEN = Color.new(0.56078, 0.73725, 0.54510, 1.00000)
|
211
|
+
DARK_SLATE_BLUE = Color.new(0.28235, 0.23922, 0.54510, 1.00000)
|
212
|
+
DARK_SLATE_GRAY = Color.new(0.18431, 0.30980, 0.30980, 1.00000)
|
213
|
+
DARK_TURQUOISE = Color.new(0.00000, 0.80784, 0.81961, 1.00000)
|
214
|
+
DARK_VIOLET = Color.new(0.58039, 0.00000, 0.82745, 1.00000)
|
215
|
+
DEEP_PINK = Color.new(1.00000, 0.07843, 0.57647, 1.00000)
|
216
|
+
DEEP_SKY_BLUE = Color.new(0.00000, 0.74902, 1.00000, 1.00000)
|
217
|
+
DIM_GRAY = Color.new(0.41176, 0.41176, 0.41176, 1.00000)
|
218
|
+
DODGER_BLUE = Color.new(0.11765, 0.56471, 1.00000, 1.00000)
|
219
|
+
FIREBRICK = Color.new(0.69804, 0.13333, 0.13333, 1.00000)
|
220
|
+
FLORAL_WHITE = Color.new(1.00000, 0.98039, 0.94118, 1.00000)
|
221
|
+
FOREST_GREEN = Color.new(0.13333, 0.54510, 0.13333, 1.00000)
|
222
|
+
FUCHSIA = Color.new(1.00000, 0.00000, 1.00000, 1.00000)
|
223
|
+
GAINSBORO = Color.new(0.86275, 0.86275, 0.86275, 1.00000)
|
224
|
+
GHOST_WHITE = Color.new(0.97255, 0.97255, 1.00000, 1.00000)
|
225
|
+
GOLD = Color.new(1.00000, 0.84314, 0.00000, 1.00000)
|
226
|
+
GOLDENROD = Color.new(0.85490, 0.64706, 0.12549, 1.00000)
|
227
|
+
GRAY = Color.new(0.50196, 0.50196, 0.50196, 1.00000)
|
228
|
+
GREEN = Color.new(0.00000, 0.50196, 0.00000, 1.00000)
|
229
|
+
GREEN_YELLOW = Color.new(0.67843, 1.00000, 0.18431, 1.00000)
|
230
|
+
HONEYDEW = Color.new(0.94118, 1.00000, 0.94118, 1.00000)
|
231
|
+
HOT_PINK = Color.new(1.00000, 0.41176, 0.70588, 1.00000)
|
232
|
+
INDIAN_RED = Color.new(0.80392, 0.36078, 0.36078, 1.00000)
|
233
|
+
INDIGO = Color.new(0.29412, 0.00000, 0.50980, 1.00000)
|
234
|
+
IVORY = Color.new(1.00000, 1.00000, 0.94118, 1.00000)
|
235
|
+
KHAKI = Color.new(0.94118, 0.90196, 0.54902, 1.00000)
|
236
|
+
LAVENDER = Color.new(0.90196, 0.90196, 0.98039, 1.00000)
|
237
|
+
LAVENDER_BLUSH = Color.new(1.00000, 0.94118, 0.96078, 1.00000)
|
238
|
+
LAWN_GREEN = Color.new(0.48627, 0.98824, 0.00000, 1.00000)
|
239
|
+
LEMON_CHIFFON = Color.new(1.00000, 0.98039, 0.80392, 1.00000)
|
240
|
+
LIGHT_BLUE = Color.new(0.67843, 0.84706, 0.90196, 1.00000)
|
241
|
+
LIGHT_CORAL = Color.new(0.94118, 0.50196, 0.50196, 1.00000)
|
242
|
+
LIGHT_CYAN = Color.new(0.87843, 1.00000, 1.00000, 1.00000)
|
243
|
+
LIGHT_GOLDENROD_YELLOW = Color.new(0.98039, 0.98039, 0.82353, 1.00000)
|
244
|
+
LIGHT_GRAY = Color.new(0.82745, 0.82745, 0.82745, 1.00000)
|
245
|
+
LIGHT_GREEN = Color.new(0.56471, 0.93333, 0.56471, 1.00000)
|
246
|
+
LIGHT_PINK = Color.new(1.00000, 0.71373, 0.75686, 1.00000)
|
247
|
+
LIGHT_SALMON = Color.new(1.00000, 0.62745, 0.47843, 1.00000)
|
248
|
+
LIGHT_SEA_GREEN = Color.new(0.12549, 0.69804, 0.66667, 1.00000)
|
249
|
+
LIGHT_SKY_BLUE = Color.new(0.52941, 0.80784, 0.98039, 1.00000)
|
250
|
+
LIGHT_SLATE_GRAY = Color.new(0.46667, 0.53333, 0.60000, 1.00000)
|
251
|
+
LIGHT_STEEL_BLUE = Color.new(0.69020, 0.76863, 0.87059, 1.00000)
|
252
|
+
LIGHT_YELLOW = Color.new(1.00000, 1.00000, 0.87843, 1.00000)
|
253
|
+
LIME = Color.new(0.00000, 1.00000, 0.00000, 1.00000)
|
254
|
+
LIME_GREEN = Color.new(0.19608, 0.80392, 0.19608, 1.00000)
|
255
|
+
LINEN = Color.new(0.98039, 0.94118, 0.90196, 1.00000)
|
256
|
+
MAGENTA = Color.new(1.00000, 0.00000, 1.00000, 1.00000)
|
257
|
+
MAROON = Color.new(0.50196, 0.00000, 0.00000, 1.00000)
|
258
|
+
MEDIUM_AQUAMARINE = Color.new(0.40000, 0.80392, 0.66667, 1.00000)
|
259
|
+
MEDIUM_BLUE = Color.new(0.00000, 0.00000, 0.80392, 1.00000)
|
260
|
+
MEDIUM_ORCHID = Color.new(0.72941, 0.33333, 0.82745, 1.00000)
|
261
|
+
MEDIUM_PURPLE = Color.new(0.57647, 0.43922, 0.85882, 1.00000)
|
262
|
+
MEDIUM_SEA_GREEN = Color.new(0.23529, 0.70196, 0.44314, 1.00000)
|
263
|
+
MEDIUM_SLATE_BLUE = Color.new(0.48235, 0.40784, 0.93333, 1.00000)
|
264
|
+
MEDIUM_SPRING_GREEN = Color.new(0.00000, 0.98039, 0.60392, 1.00000)
|
265
|
+
MEDIUM_TURQUOISE = Color.new(0.28235, 0.81961, 0.80000, 1.00000)
|
266
|
+
MEDIUM_VIOLET_RED = Color.new(0.78039, 0.08235, 0.52157, 1.00000)
|
267
|
+
MIDNIGHT_BLUE = Color.new(0.09804, 0.09804, 0.43922, 1.00000)
|
268
|
+
MINT_CREAM = Color.new(0.96078, 1.00000, 0.98039, 1.00000)
|
269
|
+
MISTY_ROSE = Color.new(1.00000, 0.89412, 0.88235, 1.00000)
|
270
|
+
MOCCASIN = Color.new(1.00000, 0.89412, 0.70980, 1.00000)
|
271
|
+
NAVAJO_WHITE = Color.new(1.00000, 0.87059, 0.67843, 1.00000)
|
272
|
+
NAVY = Color.new(0.00000, 0.00000, 0.50196, 1.00000)
|
273
|
+
OLD_LACE = Color.new(0.99216, 0.96078, 0.90196, 1.00000)
|
274
|
+
OLIVE = Color.new(0.50196, 0.50196, 0.00000, 1.00000)
|
275
|
+
OLIVE_DRAB = Color.new(0.41961, 0.55686, 0.13725, 1.00000)
|
276
|
+
ORANGE = Color.new(1.00000, 0.64706, 0.00000, 1.00000)
|
277
|
+
ORANGE_RED = Color.new(1.00000, 0.27059, 0.00000, 1.00000)
|
278
|
+
ORCHID = Color.new(0.85490, 0.43922, 0.83922, 1.00000)
|
279
|
+
PALE_GOLDENROD = Color.new(0.93333, 0.90980, 0.66667, 1.00000)
|
280
|
+
PALE_GREEN = Color.new(0.59608, 0.98431, 0.59608, 1.00000)
|
281
|
+
PALE_TURQUOISE = Color.new(0.68627, 0.93333, 0.93333, 1.00000)
|
282
|
+
PALE_VIOLET_RED = Color.new(0.85882, 0.43922, 0.57647, 1.00000)
|
283
|
+
PAPAYA_WHIP = Color.new(1.00000, 0.93725, 0.83529, 1.00000)
|
284
|
+
PEACH_PUFF = Color.new(1.00000, 0.85490, 0.72549, 1.00000)
|
285
|
+
PERU = Color.new(0.80392, 0.52157, 0.24706, 1.00000)
|
286
|
+
PINK = Color.new(1.00000, 0.75294, 0.79608, 1.00000)
|
287
|
+
PLUM = Color.new(0.86667, 0.62745, 0.86667, 1.00000)
|
288
|
+
POWDER_BLUE = Color.new(0.69020, 0.87843, 0.90196, 1.00000)
|
289
|
+
PURPLE = Color.new(0.50196, 0.00000, 0.50196, 1.00000)
|
290
|
+
RED = Color.new(1.00000, 0.00000, 0.00000, 1.00000)
|
291
|
+
ROSY_BROWN = Color.new(0.73725, 0.56078, 0.56078, 1.00000)
|
292
|
+
ROYAL_BLUE = Color.new(0.25490, 0.41176, 0.88235, 1.00000)
|
293
|
+
SADDLE_BROWN = Color.new(0.54510, 0.27059, 0.07451, 1.00000)
|
294
|
+
SALMON = Color.new(0.98039, 0.50196, 0.44706, 1.00000)
|
295
|
+
SANDY_BROWN = Color.new(0.95686, 0.64314, 0.37647, 1.00000)
|
296
|
+
SEA_GREEN = Color.new(0.18039, 0.54510, 0.34118, 1.00000)
|
297
|
+
SEA_SHELL = Color.new(1.00000, 0.96078, 0.93333, 1.00000)
|
298
|
+
SIENNA = Color.new(0.62745, 0.32157, 0.17647, 1.00000)
|
299
|
+
SILVER = Color.new(0.75294, 0.75294, 0.75294, 1.00000)
|
300
|
+
SKY_BLUE = Color.new(0.52941, 0.80784, 0.92157, 1.00000)
|
301
|
+
SLATE_BLUE = Color.new(0.41569, 0.35294, 0.80392, 1.00000)
|
302
|
+
SLATE_GRAY = Color.new(0.43922, 0.50196, 0.56471, 1.00000)
|
303
|
+
SNOW = Color.new(1.00000, 0.98039, 0.98039, 1.00000)
|
304
|
+
SPRING_GREEN = Color.new(0.00000, 1.00000, 0.49804, 1.00000)
|
305
|
+
STEEL_BLUE = Color.new(0.27451, 0.50980, 0.70588, 1.00000)
|
306
|
+
TAN = Color.new(0.82353, 0.70588, 0.54902, 1.00000)
|
307
|
+
TEAL = Color.new(0.00000, 0.50196, 0.50196, 1.00000)
|
308
|
+
THISTLE = Color.new(0.84706, 0.74902, 0.84706, 1.00000)
|
309
|
+
TOMATO = Color.new(1.00000, 0.38824, 0.27843, 1.00000)
|
310
|
+
TURQUOISE = Color.new(0.25098, 0.87843, 0.81569, 1.00000)
|
311
|
+
VIOLET = Color.new(0.93333, 0.50980, 0.93333, 1.00000)
|
312
|
+
WHEAT = Color.new(0.96078, 0.87059, 0.70196, 1.00000)
|
313
|
+
WHITE = Color.new(1.00000, 1.00000, 1.00000, 1.00000)
|
314
|
+
WHITE_SMOKE = Color.new(0.96078, 0.96078, 0.96078, 1.00000)
|
315
|
+
YELLOW = Color.new(1.00000, 1.00000, 0.00000, 1.00000)
|
316
|
+
YELLOW_GREEN = Color.new(0.60392, 0.80392, 0.19608, 1.00000)
|
317
|
+
end
|
318
|
+
end
|