oily_png 1.0.2 → 1.0.3
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/.travis.yml +10 -3
- data/Gemfile +1 -1
- data/ext/oily_png/color.c +12 -15
- data/ext/oily_png/png_decoding.c +2 -24
- data/ext/oily_png/resampling.c +2 -0
- data/lib/oily_png.rb +1 -1
- data/oily_png.gemspec +2 -2
- metadata +58 -79
data/.travis.yml
CHANGED
@@ -1,8 +1,15 @@
|
|
1
|
+
language: ruby
|
2
|
+
script: bundle exec rake
|
1
3
|
rvm:
|
2
|
-
- 1.8.6
|
3
4
|
- 1.8.7
|
4
|
-
- 1.9.1
|
5
5
|
- 1.9.2
|
6
|
+
- 1.9.3
|
6
7
|
- ruby-head
|
7
8
|
- ree
|
8
|
-
- rbx
|
9
|
+
- rbx-18mode
|
10
|
+
- rbx-19mode
|
11
|
+
matrix:
|
12
|
+
allow_failures:
|
13
|
+
- rvm: rbx-18mode
|
14
|
+
- rvm: rbx-19mode
|
15
|
+
- rvm: ruby-head
|
data/Gemfile
CHANGED
data/ext/oily_png/color.c
CHANGED
@@ -1,17 +1,18 @@
|
|
1
1
|
#include "oily_png_ext.h"
|
2
2
|
|
3
3
|
PIXEL oily_png_compose_color(PIXEL fg, PIXEL bg) {
|
4
|
-
|
4
|
+
BYTE a_com, new_r, new_g, new_b, new_a;
|
5
|
+
|
5
6
|
// Check for simple cases first
|
6
7
|
if ((A_BYTE(fg) == 0xff) || (A_BYTE(bg) == 0x00)) return fg;
|
7
8
|
if (A_BYTE(fg) == 0x00) return bg;
|
8
9
|
|
9
10
|
// Calculate the new values using fast 8-bit multiplication
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
11
|
+
a_com = INT8_MULTIPLY(0xff - A_BYTE(fg), A_BYTE(bg));
|
12
|
+
new_r = INT8_MULTIPLY(A_BYTE(fg), R_BYTE(fg)) + INT8_MULTIPLY(a_com, R_BYTE(bg));
|
13
|
+
new_g = INT8_MULTIPLY(A_BYTE(fg), G_BYTE(fg)) + INT8_MULTIPLY(a_com, G_BYTE(bg));
|
14
|
+
new_b = INT8_MULTIPLY(A_BYTE(fg), B_BYTE(fg)) + INT8_MULTIPLY(a_com, B_BYTE(bg));
|
15
|
+
new_a = A_BYTE(fg) + a_com;
|
15
16
|
|
16
17
|
return BUILD_PIXEL(new_r, new_g, new_b, new_a);
|
17
18
|
}
|
@@ -23,24 +24,20 @@ VALUE oily_png_color_compose_quick(VALUE self, VALUE fg_color, VALUE bg_color) {
|
|
23
24
|
|
24
25
|
VALUE oily_png_color_r(VALUE self, VALUE value) {
|
25
26
|
UNUSED_PARAMETER(self);
|
26
|
-
|
27
|
-
return INT2FIX(red);
|
27
|
+
return INT2FIX(R_BYTE(NUM2UINT(value)));
|
28
28
|
}
|
29
29
|
|
30
30
|
VALUE oily_png_color_g(VALUE self, VALUE value) {
|
31
31
|
UNUSED_PARAMETER(self);
|
32
|
-
|
33
|
-
return INT2FIX(green);
|
32
|
+
return INT2FIX(G_BYTE(NUM2UINT(value)));
|
34
33
|
}
|
35
34
|
|
36
35
|
VALUE oily_png_color_b(VALUE self, VALUE value) {
|
37
|
-
UNUSED_PARAMETER(self);
|
38
|
-
|
39
|
-
return INT2FIX(blue);
|
36
|
+
UNUSED_PARAMETER(self);
|
37
|
+
return INT2FIX(B_BYTE(NUM2UINT(value)));
|
40
38
|
}
|
41
39
|
|
42
40
|
VALUE oily_png_color_a(VALUE self, VALUE value) {
|
43
41
|
UNUSED_PARAMETER(self);
|
44
|
-
|
45
|
-
return INT2FIX(alpha);
|
42
|
+
return INT2FIX(A_BYTE(NUM2UINT(value)));
|
46
43
|
}
|
data/ext/oily_png/png_decoding.c
CHANGED
@@ -81,33 +81,11 @@ BYTE oily_png_resample_1bit_element(BYTE* bytes, long start, long x) {
|
|
81
81
|
}
|
82
82
|
|
83
83
|
BYTE oily_png_resample_2bit_element(BYTE* bytes, long start, long x) {
|
84
|
-
|
85
|
-
case 0x00: return 0x00;
|
86
|
-
case 0x01: return 0x55;
|
87
|
-
case 0x02: return 0xaa;
|
88
|
-
case 0x03: default: return 0xff;
|
89
|
-
}
|
84
|
+
return oily_png_extract_2bit_element(bytes, start, x) * 85;
|
90
85
|
}
|
91
86
|
|
92
87
|
BYTE oily_png_resample_4bit_element(BYTE* bytes, long start, long x) {
|
93
|
-
|
94
|
-
case 0x00: return 0;
|
95
|
-
case 0x01: return 17;
|
96
|
-
case 0x02: return 34;
|
97
|
-
case 0x03: return 51;
|
98
|
-
case 0x04: return 68;
|
99
|
-
case 0x05: return 85;
|
100
|
-
case 0x06: return 102;
|
101
|
-
case 0x07: return 119;
|
102
|
-
case 0x08: return 137;
|
103
|
-
case 0x09: return 154;
|
104
|
-
case 0x0a: return 171;
|
105
|
-
case 0x0b: return 188;
|
106
|
-
case 0x0c: return 205;
|
107
|
-
case 0x0d: return 222;
|
108
|
-
case 0x0e: return 239;
|
109
|
-
case 0x0f: default: return 255;
|
110
|
-
}
|
88
|
+
return oily_png_extract_4bit_element(bytes, start, x) * 17;
|
111
89
|
}
|
112
90
|
|
113
91
|
/////////////////////////////////////////////////////////////////////
|
data/ext/oily_png/resampling.c
CHANGED
@@ -44,6 +44,7 @@ void oily_png_generate_steps_residues(long width, long new_width, long *steps, l
|
|
44
44
|
}
|
45
45
|
|
46
46
|
VALUE oily_png_canvas_steps(VALUE self, VALUE v_width, VALUE v_new_width) {
|
47
|
+
UNUSED_PARAMETER(self);
|
47
48
|
long width = NUM2LONG(v_width);
|
48
49
|
long new_width = NUM2LONG(v_new_width);
|
49
50
|
|
@@ -70,6 +71,7 @@ VALUE oily_png_canvas_steps(VALUE self, VALUE v_width, VALUE v_new_width) {
|
|
70
71
|
|
71
72
|
|
72
73
|
VALUE oily_png_canvas_steps_residues(VALUE self, VALUE v_width, VALUE v_new_width) {
|
74
|
+
UNUSED_PARAMETER(self);
|
73
75
|
long width = NUM2LONG(v_width);
|
74
76
|
long new_width = NUM2LONG(v_new_width);
|
75
77
|
|
data/lib/oily_png.rb
CHANGED
data/oily_png.gemspec
CHANGED
@@ -4,8 +4,8 @@ Gem::Specification.new do |s|
|
|
4
4
|
|
5
5
|
# Do not change the version and date fields by hand. This will be done
|
6
6
|
# automatically by the gem release script.
|
7
|
-
s.version = "1.0.
|
8
|
-
s.date = "
|
7
|
+
s.version = "1.0.3"
|
8
|
+
s.date = "2013-01-19"
|
9
9
|
|
10
10
|
s.summary = "Native mixin to speed up ChunkyPNG"
|
11
11
|
s.description = <<-EOT
|
metadata
CHANGED
@@ -1,86 +1,72 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: oily_png
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
6
|
-
- 1
|
7
|
-
- 0
|
8
|
-
- 2
|
9
|
-
version: 1.0.2
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.3
|
5
|
+
prerelease:
|
10
6
|
platform: ruby
|
11
|
-
authors:
|
7
|
+
authors:
|
12
8
|
- Willem van Bergen
|
13
9
|
autorequire:
|
14
10
|
bindir: bin
|
15
11
|
cert_chain: []
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
dependencies:
|
20
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2013-01-19 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
21
15
|
name: chunky_png
|
22
|
-
|
23
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: &70150338537120 !ruby/object:Gem::Requirement
|
24
17
|
none: false
|
25
|
-
requirements:
|
18
|
+
requirements:
|
26
19
|
- - ~>
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
segments:
|
29
|
-
- 1
|
30
|
-
- 2
|
31
|
-
- 1
|
20
|
+
- !ruby/object:Gem::Version
|
32
21
|
version: 1.2.1
|
33
22
|
type: :runtime
|
34
|
-
version_requirements: *id001
|
35
|
-
- !ruby/object:Gem::Dependency
|
36
|
-
name: rake
|
37
23
|
prerelease: false
|
38
|
-
|
24
|
+
version_requirements: *70150338537120
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: rake
|
27
|
+
requirement: &70150338536620 !ruby/object:Gem::Requirement
|
39
28
|
none: false
|
40
|
-
requirements:
|
41
|
-
- -
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
|
44
|
-
- 0
|
45
|
-
version: "0"
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
46
33
|
type: :development
|
47
|
-
version_requirements: *id002
|
48
|
-
- !ruby/object:Gem::Dependency
|
49
|
-
name: rake-compiler
|
50
34
|
prerelease: false
|
51
|
-
|
35
|
+
version_requirements: *70150338536620
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: rake-compiler
|
38
|
+
requirement: &70150338535960 !ruby/object:Gem::Requirement
|
52
39
|
none: false
|
53
|
-
requirements:
|
54
|
-
- -
|
55
|
-
- !ruby/object:Gem::Version
|
56
|
-
|
57
|
-
- 0
|
58
|
-
version: "0"
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
59
44
|
type: :development
|
60
|
-
version_requirements: *id003
|
61
|
-
- !ruby/object:Gem::Dependency
|
62
|
-
name: rspec
|
63
45
|
prerelease: false
|
64
|
-
|
46
|
+
version_requirements: *70150338535960
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: rspec
|
49
|
+
requirement: &70150338534780 !ruby/object:Gem::Requirement
|
65
50
|
none: false
|
66
|
-
requirements:
|
51
|
+
requirements:
|
67
52
|
- - ~>
|
68
|
-
- !ruby/object:Gem::Version
|
69
|
-
|
70
|
-
- 2
|
71
|
-
version: "2"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '2'
|
72
55
|
type: :development
|
73
|
-
|
74
|
-
|
75
|
-
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *70150338534780
|
58
|
+
description: ! ' This Ruby C extenstion defines a module that can be included into
|
59
|
+
ChunkyPNG to improve its speed.
|
60
|
+
|
61
|
+
'
|
62
|
+
email:
|
76
63
|
- willem@railsdoctors.com
|
77
64
|
executables: []
|
78
|
-
|
79
|
-
extensions:
|
65
|
+
extensions:
|
80
66
|
- ext/oily_png/extconf.rb
|
81
|
-
extra_rdoc_files:
|
67
|
+
extra_rdoc_files:
|
82
68
|
- README.rdoc
|
83
|
-
files:
|
69
|
+
files:
|
84
70
|
- .gitignore
|
85
71
|
- .infinity_test
|
86
72
|
- .travis.yml
|
@@ -198,45 +184,38 @@ files:
|
|
198
184
|
- spec/spec_helper.rb
|
199
185
|
- tasks/github-gem.rake
|
200
186
|
- tasks/testing.rake
|
201
|
-
has_rdoc: true
|
202
187
|
homepage: http://wiki.github.com/wvanbergen/oily_png
|
203
188
|
licenses: []
|
204
|
-
|
205
189
|
post_install_message:
|
206
|
-
rdoc_options:
|
190
|
+
rdoc_options:
|
207
191
|
- --title
|
208
192
|
- oily_png
|
209
193
|
- --main
|
210
194
|
- README.rdoc
|
211
195
|
- --line-numbers
|
212
196
|
- --inline-source
|
213
|
-
require_paths:
|
197
|
+
require_paths:
|
214
198
|
- lib
|
215
199
|
- ext
|
216
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
200
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
217
201
|
none: false
|
218
|
-
requirements:
|
219
|
-
- -
|
220
|
-
- !ruby/object:Gem::Version
|
221
|
-
|
222
|
-
|
223
|
-
version: "0"
|
224
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
202
|
+
requirements:
|
203
|
+
- - ! '>='
|
204
|
+
- !ruby/object:Gem::Version
|
205
|
+
version: '0'
|
206
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
225
207
|
none: false
|
226
|
-
requirements:
|
227
|
-
- -
|
228
|
-
- !ruby/object:Gem::Version
|
229
|
-
|
230
|
-
- 0
|
231
|
-
version: "0"
|
208
|
+
requirements:
|
209
|
+
- - ! '>='
|
210
|
+
- !ruby/object:Gem::Version
|
211
|
+
version: '0'
|
232
212
|
requirements: []
|
233
|
-
|
234
213
|
rubyforge_project: oily_png
|
235
|
-
rubygems_version: 1.
|
214
|
+
rubygems_version: 1.8.16
|
236
215
|
signing_key:
|
237
216
|
specification_version: 3
|
238
217
|
summary: Native mixin to speed up ChunkyPNG
|
239
|
-
test_files:
|
218
|
+
test_files:
|
240
219
|
- spec/color_spec.rb
|
241
220
|
- spec/decoding_spec.rb
|
242
221
|
- spec/encoding_spec.rb
|