rainbow_gradient 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rainbow/color_range.rb +7 -0
- data/lib/rainbow/gradient.rb +10 -1
- data/lib/rainbow/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cb79c41b47fd5c4ef9c145bcf5fca9c22b7542f9
|
4
|
+
data.tar.gz: 18be4286ebceea937cbdfca2f9b336cbcde0adb0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7df48a93150dcd667c8dfbbc89fbc4ac8f310928477b9feda1da2fb0c9db786ebc3b430beecea02f2b16386e59e26a9b60d5cf6f97bbeb494136f2387ffb87b1
|
7
|
+
data.tar.gz: 4f026e45176d9845f664ca63a6610b7e0a11a77a2c12c9a8c92cb9ca6648e5c97c643798b5c84b79f8abeeb04b0ab2cf48a25cf0ee58c54048bd2491cf52e6bd
|
data/lib/rainbow/color_range.rb
CHANGED
@@ -68,6 +68,13 @@ module Rainbow
|
|
68
68
|
@mid_location_in_pixel = @from_location_in_pixel + @first_width
|
69
69
|
@to_location_in_pixel = @from_location_in_pixel + @width
|
70
70
|
|
71
|
+
if ENV['CHOPSTICK_DEBUG']
|
72
|
+
puts "from: (#{from_color.location * gradient.width / 100.0}) #{@from_location_in_pixel}, " +
|
73
|
+
"to: #{@to_location_in_pixel}, " +
|
74
|
+
"width: (#{gradient.width * (to_color.location - from_color.location) / 100.0}) #{@width}"
|
75
|
+
puts '-' * 50
|
76
|
+
end
|
77
|
+
|
71
78
|
@leftover_width = ((100 - to_color.location) * gradient.width / 100.0).ceil
|
72
79
|
end
|
73
80
|
|
data/lib/rainbow/gradient.rb
CHANGED
@@ -169,8 +169,14 @@ module Rainbow
|
|
169
169
|
end
|
170
170
|
|
171
171
|
def paint_body(canvas, color_range, x_coverred)
|
172
|
+
n = 0
|
172
173
|
color_range.width.times do |x|
|
173
|
-
x
|
174
|
+
if x == 0 && x + x_coverred != color_range.from_location_in_pixel
|
175
|
+
n = x + x_coverred - color_range.from_location_in_pixel
|
176
|
+
end
|
177
|
+
|
178
|
+
x += x_coverred - n
|
179
|
+
puts " x: #{x}, n: #{n}" if ENV['RAINBOW_DEBUG']
|
174
180
|
|
175
181
|
break if x == width
|
176
182
|
|
@@ -184,6 +190,9 @@ module Rainbow
|
|
184
190
|
def paint_suffix(canvas, color_range, x_coverred)
|
185
191
|
color_range.leftover_width.times do |x|
|
186
192
|
x += x_coverred
|
193
|
+
|
194
|
+
break if x == width
|
195
|
+
|
187
196
|
color_range.current_x = x
|
188
197
|
height.times { |y| canvas[x, y] = color_range.current_color }
|
189
198
|
end
|
data/lib/rainbow/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rainbow_gradient
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sophy Eung
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-08-
|
11
|
+
date: 2014-08-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: chunky_png
|