imageruby 0.2.3 → 0.2.4
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.
- data/CHANGELOG +10 -0
- data/Rakefile +1 -1
- data/lib/imageruby/color.rb +4 -0
- data/lib/imageruby/pureruby.rb +5 -5
- data/spec/color_spec.rb +1 -1
- data/spec/image_spec.rb +1 -1
- data/spec/validation_spec.rb +1 -1
- metadata +2 -2
data/CHANGELOG
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
0.2.4 fixed read of pixel data on alpha combinations
|
2
|
+
|
3
|
+
fixed Color#inspect
|
4
|
+
|
5
|
+
fixed require on specs requiring "imageruby" instead of "lib/imageruby"
|
6
|
+
|
7
|
+
fixed encoding of alpha channels on replace_color! method (update to ruby1.9)
|
8
|
+
|
9
|
+
fixed error on alpha decoding when reading ordinal
|
10
|
+
|
1
11
|
0.2.1 Fixed compatibility with ruby 1.9 on bitmap representation (Thanks amadanmath!)
|
2
12
|
|
3
13
|
0.2.0 Added persistor and loaders
|
data/Rakefile
CHANGED
data/lib/imageruby/color.rb
CHANGED
@@ -158,6 +158,10 @@ module ImageRuby
|
|
158
158
|
end
|
159
159
|
end
|
160
160
|
|
161
|
+
def inspect
|
162
|
+
"\##{sprintf("%02x%02x%02x",r,g,b)}#{a==255?"": a.to_s(16)}"
|
163
|
+
end
|
164
|
+
|
161
165
|
define_colors "red" => [255,0,0], "green" => [0,255,0] , "blue" => [0,0,255],
|
162
166
|
"white" => [255,255,255], "silver" => [0xc0, 0xc0, 0xc0], "gray" => [0x80,0x80,0x80],
|
163
167
|
"black" => [0,0,0], "maroon" => [0x80,0,0], "yellow" => [0xff,0xff,0],
|
data/lib/imageruby/pureruby.rb
CHANGED
@@ -151,22 +151,22 @@ public
|
|
151
151
|
(0..draw_width-1).each do |x_orig|
|
152
152
|
color = orig_pixel_data[origpointer..origpointer+2]
|
153
153
|
|
154
|
-
alpha = image.alpha_data[y_orig*image.width+x_orig]
|
154
|
+
alpha = image.alpha_data[y_orig*image.width+x_orig].ord
|
155
155
|
|
156
156
|
if alpha < 255
|
157
157
|
if alpha > 0
|
158
158
|
dest_pixel_data[destpointer] =
|
159
|
-
( orig_pixel_data[origpointer]*(alpha) + dest_pixel_data[destpointer]*(255-alpha) ) / 255
|
159
|
+
(( orig_pixel_data[origpointer].ord*(alpha) + dest_pixel_data[destpointer].ord*(255-alpha) ) / 255).chr
|
160
160
|
origpointer = origpointer + 1
|
161
161
|
destpointer = destpointer + 1
|
162
162
|
|
163
163
|
dest_pixel_data[destpointer] =
|
164
|
-
( orig_pixel_data[origpointer]*(alpha) + dest_pixel_data[destpointer]*(255-alpha) ) / 255
|
164
|
+
(( orig_pixel_data[origpointer].ord*(alpha) + dest_pixel_data[destpointer].ord*(255-alpha) ) / 255).chr
|
165
165
|
origpointer = origpointer + 1
|
166
166
|
destpointer = destpointer + 1
|
167
167
|
|
168
168
|
dest_pixel_data[destpointer] =
|
169
|
-
( orig_pixel_data[origpointer]*(alpha) + dest_pixel_data[destpointer]*(255-alpha) ) / 255
|
169
|
+
(( orig_pixel_data[origpointer].ord*(alpha) + dest_pixel_data[destpointer].ord*(255-alpha) ) / 255).chr
|
170
170
|
origpointer = origpointer + 1
|
171
171
|
destpointer = destpointer + 1
|
172
172
|
|
@@ -247,7 +247,7 @@ public
|
|
247
247
|
strcolor1 = color1.to_s
|
248
248
|
strcolor2 = color2.to_s
|
249
249
|
|
250
|
-
a = color2.a
|
250
|
+
a = color2.a.chr
|
251
251
|
|
252
252
|
(0..width*height).each do |i|
|
253
253
|
if pixel_data[i*3..i*3+2] == strcolor1 then
|
data/spec/color_spec.rb
CHANGED
data/spec/image_spec.rb
CHANGED
data/spec/validation_spec.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: imageruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-09-10 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description:
|
15
15
|
email: robertodarioseminara@gmail.com
|