colourdistance 0.8.5 → 0.8.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b535e4a5714978f5f0d0ca48f2effec4cf28169d
4
- data.tar.gz: eb1a65487e25cc8defef3ece24d8b8a68ad2beee
3
+ metadata.gz: 4b1e9cb5ecb0868206f36d2a42f7df9d19a51981
4
+ data.tar.gz: 828374831b463c92993dd435eb5a75369e67f6c6
5
5
  SHA512:
6
- metadata.gz: 4777c6322351453bf999d6658a70b7e64c351fdd8e5a70b503f6e61ea64be377727d0510c86ef7faa318aa12878f96b74a2a582d1f95f5d5cbe2e216334f6da2
7
- data.tar.gz: 895ca4675ed7d0f4df96c579493244212aa1ac0222057ee889046d4c53a556292e0c272e95a918f234705144459de7ca549a244dbd6b0294a36cb10765dc509e
6
+ metadata.gz: a567cab03251e6c22b95db587792fc506cccdab0f6938e778f4a6a10ea379992b78fa8ba59f461327aba1ac0e270824389a9452bf8e4175bbeaa00b6d56eee59
7
+ data.tar.gz: ce53b37f3cc814c5d14c7581c8262dd1eb44e6bb392430de04870dab66af5db261410d4123acbd5de13d32d4933908504e62e1872963ccd03be5ba48d8ed89d6
data/Rakefile CHANGED
@@ -1,4 +1,5 @@
1
1
  require "bundler/gem_tasks"
2
+ require "inline"
2
3
  require 'rspec/core/rake_task'
3
4
 
4
5
  RSpec::Core::RakeTask.new(:spec)
@@ -28,5 +28,6 @@ Gem::Specification.new do |spec|
28
28
 
29
29
  spec.add_development_dependency "bundler", "~> 1.10"
30
30
  spec.add_development_dependency "rake", "~> 10.0"
31
+ spec.add_development_dependency "RubyInline", "~>3.12.4"
31
32
  spec.add_development_dependency "rspec"
32
33
  end
@@ -1,6 +1,273 @@
1
1
  require "colourdistance/version"
2
- require "colourdiff"
2
+ require "inline"
3
3
 
4
4
  module Colourdistance
5
- extend Colourdiff
5
+ inline(:C) do |builder|
6
+ builder.include '<stdio.h>'
7
+ builder.include '<math.h>'
8
+
9
+ builder.c_singleton 'VALUE ciede94(VALUE color1, VALUE color2) {
10
+ double pi = 3.1415927;
11
+ double e = 2.7182818;
12
+ double l1;
13
+ double l2;
14
+ double a1;
15
+ double a2;
16
+
17
+
18
+ double r1 = NUM2DBL(rb_hash_aref(color1, rb_str_intern(rb_str_new2("r"))))/255.0;
19
+ double g1 = NUM2DBL(rb_hash_aref(color1, rb_str_intern(rb_str_new2("g"))))/255.0;
20
+ double b1 = NUM2DBL(rb_hash_aref(color1, rb_str_intern(rb_str_new2("b"))))/255.0;
21
+
22
+ double r2 = NUM2DBL(rb_hash_aref(color2, rb_str_intern(rb_str_new2("r"))))/255.0;
23
+ double g2 = NUM2DBL(rb_hash_aref(color2, rb_str_intern(rb_str_new2("g"))))/255.0;
24
+ double b2 = NUM2DBL(rb_hash_aref(color2, rb_str_intern(rb_str_new2("b"))))/255.0;
25
+
26
+ r1 = ((r1 <= 0.04045) ? r1 / 12.92 : pow(((r1 + 0.055) / 1.055),2.4));
27
+ g1 = ((g1 <= 0.04045) ? g1 / 12.92 : pow(((g1 + 0.055) / 1.055),2.4));
28
+ b1 = ((b1 <= 0.04045) ? b1 / 12.92 : pow(((b1 + 0.055) / 1.055),2.4));
29
+
30
+ r2 = ((r2 <= 0.04045) ? r2 / 12.92 : pow(((r2 + 0.055) / 1.055),2.4));
31
+ g2 = ((g2 <= 0.04045) ? g2 / 12.92 : pow(((g2 + 0.055) / 1.055),2.4));
32
+ b2 = ((b2 <= 0.04045) ? b2 / 12.92 : pow(((b2 + 0.055) / 1.055),2.4));
33
+
34
+ double x1 = 0.412453 * r1 + 0.357580 * g1 + 0.180423 * b1;
35
+ double y1 = 0.212671 * r1 + 0.715160 * g1 + 0.072169 * b1;
36
+ double z1 = 0.019334 * r1 + 0.119193 * g1 + 0.950227 * b1;
37
+
38
+ double x2 = 0.412453 * r2 + 0.357580 * g2 + 0.180423 * b2;
39
+ double y2 = 0.212671 * r2 + 0.715160 * g2 + 0.072169 * b2;
40
+ double z2 = 0.019334 * r2 + 0.119193 * g2 + 0.950227 * b2;
41
+
42
+ double fx;
43
+ double fy;
44
+ double fz;
45
+
46
+ if(x1 <= 0.008856){
47
+ fx = 7.787 * x1/0.95047 + 16.0/116.0;
48
+ }else{
49
+ fx = cbrt(x1/0.95047);
50
+ }
51
+
52
+ if(y1 <= 0.008856){
53
+ l1 = 903.3 * y1;
54
+ fy = (7.787 * y1 + 16.0/116.0);
55
+ }else{
56
+ l1 = 116.0 * cbrt(y1) - 16.0;
57
+ fy = cbrt(y1);
58
+ }
59
+
60
+ if(z1 <= 0.008856){
61
+ fz = 7.787 * z1/1.08883 + 16.0/116.0;
62
+ }else{
63
+ fz = cbrt(z1/1.08883);
64
+ }
65
+
66
+ a1 = 500.0 * (fx-fy);
67
+ b1 = 200.0 * (fy-fz);
68
+
69
+
70
+ if(x2 <= 0.008856){
71
+ fx = (7.787 * x2/0.95047 + 16.0/116.0);
72
+ }else{
73
+ fx = cbrt(x2/0.95047);
74
+ }
75
+
76
+ if(y2 <= 0.008856){
77
+ l2 = 903.3 * y2;
78
+ fy = (7.787 * y2 + 16.0/116.0);
79
+ }else{
80
+ l2 = 116.0 * cbrt(y2) - 16.0;
81
+ fy = cbrt(y2);
82
+ }
83
+
84
+ if(z2 <= 0.008856){
85
+ fz = (7.787 * z2/1.08883 + 16.0/116.0);
86
+ }else{
87
+ fz = cbrt(z2/1.08883);
88
+ }
89
+
90
+ a2 = 500.0 * (fx-fy);
91
+ b2 = 200.0 * (fy-fz);
92
+
93
+ double kl = 2.0;
94
+ double k1 = 0.048;
95
+ double k2 = 0.014;
96
+
97
+ double c1 = sqrt(a1*a1+b1*b1);
98
+ double c2 = sqrt(a2*a2+b2*b2);
99
+ double cdelta = c2 - c1;
100
+
101
+ double sc = 1.0 + k1 * c1;
102
+ double sh = 1.0 + k2 * c1;
103
+
104
+ double habdelta = sqrt((a2-a1)*(a2-a1)+(b2-b1)*(b2-b1) - cdelta*cdelta);
105
+
106
+ double ldiff = (l1 - l2)/kl;
107
+ double adiff = cdelta/sc;
108
+ double bdiff = habdelta/sh;
109
+
110
+ return DBL2NUM(sqrt(ldiff*ldiff+adiff*adiff+bdiff*bdiff)/50.0);
111
+ }'
112
+
113
+ builder.c_singleton 'VALUE ciede2000(VALUE color1, VALUE color2) {
114
+ double pi = 3.1415927;
115
+ double e = 2.7182818;
116
+ double conversion = pi/180;
117
+ double _kL = 1.0;
118
+ double _kC = 1.0;
119
+ double _kH = 1.0;
120
+ double l1;
121
+ double l2;
122
+ double a1;
123
+ double a2;
124
+
125
+ double r1 = NUM2DBL(rb_hash_aref(color1, rb_str_intern(rb_str_new2("r"))))/255.0;
126
+ double g1 = NUM2DBL(rb_hash_aref(color1, rb_str_intern(rb_str_new2("g"))))/255.0;
127
+ double b1 = NUM2DBL(rb_hash_aref(color1, rb_str_intern(rb_str_new2("b"))))/255.0;
128
+
129
+ double r2 = NUM2DBL(rb_hash_aref(color2, rb_str_intern(rb_str_new2("r"))))/255.0;
130
+ double g2 = NUM2DBL(rb_hash_aref(color2, rb_str_intern(rb_str_new2("g"))))/255.0;
131
+ double b2 = NUM2DBL(rb_hash_aref(color2, rb_str_intern(rb_str_new2("b"))))/255.0;
132
+
133
+ r1 = ((r1 <= 0.04045) ? r1 / 12.92 : pow(((r1 + 0.055) / 1.055),2.4));
134
+ g1 = ((g1 <= 0.04045) ? g1 / 12.92 : pow(((g1 + 0.055) / 1.055),2.4));
135
+ b1 = ((b1 <= 0.04045) ? b1 / 12.92 : pow(((b1 + 0.055) / 1.055),2.4));
136
+
137
+ r2 = ((r2 <= 0.04045) ? r2 / 12.92 : pow(((r2 + 0.055) / 1.055),2.4));
138
+ g2 = ((g2 <= 0.04045) ? g2 / 12.92 : pow(((g2 + 0.055) / 1.055),2.4));
139
+ b2 = ((b2 <= 0.04045) ? b2 / 12.92 : pow(((b2 + 0.055) / 1.055),2.4));
140
+
141
+ double x1 = 0.412453 * r1 + 0.357580 * g1 + 0.180423 * b1;
142
+ double y1 = 0.212671 * r1 + 0.715160 * g1 + 0.072169 * b1;
143
+ double z1 = 0.019334 * r1 + 0.119193 * g1 + 0.950227 * b1;
144
+
145
+ double x2 = 0.412453 * r2 + 0.357580 * g2 + 0.180423 * b2;
146
+ double y2 = 0.212671 * r2 + 0.715160 * g2 + 0.072169 * b2;
147
+ double z2 = 0.019334 * r2 + 0.119193 * g2 + 0.950227 * b2;
148
+
149
+ double fx;
150
+ double fy;
151
+ double fz;
152
+
153
+ if(x1 <= 0.008856){
154
+ fx = 7.787 * x1/0.95047 + 16.0/116.0;
155
+ }else{
156
+ fx = cbrt(x1/0.95047);
157
+ }
158
+
159
+ if(y1 <= 0.008856){
160
+ l1 = 903.3 * y1;
161
+ fy = (7.787 * y1 + 16.0/116.0);
162
+ }else{
163
+ l1 = 116.0 * cbrt(y1) - 16.0;
164
+ fy = cbrt(y1);
165
+ }
166
+
167
+ if(z1 <= 0.008856){
168
+ fz = 7.787 * z1/1.08883 + 16.0/116.0;
169
+ }else{
170
+ fz = cbrt(z1/1.08883);
171
+ }
172
+
173
+ a1 = 500.0 * (fx-fy);
174
+ b1 = 200.0 * (fy-fz);
175
+
176
+ if(x2 <= 0.008856){
177
+ fx = (7.787 * x2/0.95047 + 16.0/116.0);
178
+ }else{
179
+ fx = cbrt(x2/0.95047);
180
+ }
181
+
182
+ if(y2 <= 0.008856){
183
+ l2 = 903.3 * y2;
184
+ fy = (7.787 * y2 + 16.0/116.0);
185
+ }else{
186
+ l2 = 116.0 * cbrt(y2) - 16.0;
187
+ fy = cbrt(y2);
188
+ }
189
+
190
+ if(z2 <= 0.008856){
191
+ fz = (7.787 * z2/1.08883 + 16.0/116.0);
192
+ }else{
193
+ fz = cbrt(z2/1.08883);
194
+ }
195
+
196
+ a2 = 500.0 * (fx-fy);
197
+ b2 = 200.0 * (fy-fz);
198
+
199
+ double c1 = sqrt(a1*a1+b1*b1);
200
+ double c2 = sqrt(a2*a2+b2*b2);
201
+ double cdelta = c2 - c1;
202
+
203
+ double lbar = (l1 + l2)/2.0;
204
+ double cbar = (c1 + c2)/2.0;
205
+
206
+ double lbaradj = (lbar - 50.0)*(lbar - 50.0);
207
+ double cbaradj = sqrt(pow(cbar,7)/(pow(cbar,7)+6103515625.0));
208
+
209
+ double a1prime = a1 + (a1/2.0) * (1.0-cbaradj);
210
+ double a2prime = a2 + (a2/2.0) * (1.0-cbaradj);
211
+
212
+ double c1prime = sqrt(a1prime*a1prime+b1*b1);
213
+ double c2prime = sqrt(a2prime*a2prime+b2*b2);
214
+ double cprime = (c1prime + c2prime)/2.0;
215
+ double cprimeadj = sqrt(pow(cprime,7)/(pow(cprime,7)+6103515625.0));
216
+ double cprimedelta = c2prime - c1prime;
217
+
218
+ double h1;
219
+ double h2;
220
+ if(c1 == 0.0){
221
+ h1 = 0.0;
222
+ }else{
223
+ h1 = fmod(atan2(b1,a1prime)*180.0/pi,360.0);
224
+ }
225
+ if(c2 == 0.0){
226
+ h2 = 0.0;
227
+ }else{
228
+ h2 = fmod(atan2(b2,a2prime)*180.0/pi,360.0);
229
+ }
230
+
231
+ double h;
232
+ if (fabs(h2 - h1) <= 180.0){
233
+ h = h2 - h1;
234
+ }else if(h2 <= h1){
235
+ h = h2 - h1 + 360.0;
236
+ }else{
237
+ h = h2 - h1 - 360.0;
238
+ }
239
+
240
+ double hdelta = 2.0 * sqrt(c1prime * c2prime) * sin(conversion*h/2.0);
241
+ double hprime = (h1 + h2)/2.0;
242
+ if (fabs(h1 - h2) > 180.0){
243
+ hprime += 180.0;
244
+ }
245
+ if(c1prime == 0.0 || c2prime == 0.0){
246
+ hprime *= 2.0;
247
+ }
248
+
249
+ double t = 1.0 - 0.17*cos(conversion*(hprime-30.0)) +
250
+ 0.24*cos(conversion*(2.0*hprime)) +
251
+ 0.32*cos(conversion*(3.0*hprime + 6.0)) -
252
+ 0.20*cos(conversion*(4.0*hprime-63.0));
253
+
254
+ double sl = 1.0 + 0.015 * lbaradj/sqrt(20+lbaradj);
255
+ double sc = 1.0 + 0.045*cprime;
256
+ double sh = 1.0 + 0.015*cprime*t;
257
+
258
+ if (hprime < 0.0){
259
+ hprime += 360.0;
260
+ }
261
+
262
+ double rt = -2.0*cprimeadj*sin(conversion*60.0*pow(e,(hprime-275.0)*(hprime-275.0)/(-625.0)));
263
+
264
+ double ldiff = (l1 - l2)/sl;
265
+ double adiff = cprimedelta/sc;
266
+ double bdiff = hdelta/sh;
267
+ double rdiff = rt*adiff*bdiff;
268
+ double val = sqrt(ldiff*ldiff+adiff*adiff+bdiff*bdiff+rdiff)/100.0;
269
+
270
+ return DBL2NUM(val);
271
+ }'
272
+ end
6
273
  end
@@ -1,3 +1,3 @@
1
1
  module Colourdistance
2
- VERSION = "0.8.5"
2
+ VERSION = "0.8.6"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: colourdistance
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.5
4
+ version: 0.8.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Orange Seven
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - ~>
39
39
  - !ruby/object:Gem::Version
40
40
  version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: RubyInline
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: 3.12.4
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: 3.12.4
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: rspec
43
57
  requirement: !ruby/object:Gem::Requirement
@@ -66,19 +80,11 @@ files:
66
80
  - .travis.yml
67
81
  - Gemfile
68
82
  - LICENSE.txt
69
- - Makefile
70
83
  - README.md
71
84
  - Rakefile
72
85
  - bin/console
73
86
  - bin/setup
74
87
  - colourdistance.gemspec
75
- - ext/Colourdiff.bundle
76
- - ext/Makefile
77
- - ext/colourdiff.c
78
- - ext/colourdiff.o
79
- - ext/colourdistance.o
80
- - ext/extconf.rb
81
- - lib/Colourdiff.bundle
82
88
  - lib/colourdistance.rb
83
89
  - lib/colourdistance/version.rb
84
90
  homepage:
data/Makefile DELETED
@@ -1,238 +0,0 @@
1
-
2
- SHELL = /bin/sh
3
-
4
- # V=0 quiet, V=1 verbose. other values don't work.
5
- V = 0
6
- Q1 = $(V:1=)
7
- Q = $(Q1:0=@)
8
- ECHO1 = $(V:1=@:)
9
- ECHO = $(ECHO1:0=@echo)
10
-
11
- #### Start of system configuration section. ####
12
-
13
- srcdir = ext
14
- topdir = /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0
15
- hdrdir = $(topdir)
16
- arch_hdrdir = /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0/universal-darwin14
17
- PATH_SEPARATOR = :
18
- VPATH = $(srcdir):$(arch_hdrdir)/ruby:$(hdrdir)/ruby
19
- prefix = /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr
20
- rubysitearchprefix = $(rubylibprefix)/$(sitearch)
21
- rubyarchprefix = $(rubylibprefix)/$(arch)
22
- rubylibprefix = $(libdir)/$(RUBY_BASE_NAME)
23
- exec_prefix = $(prefix)
24
- vendorarchhdrdir = $(vendorhdrdir)/$(sitearch)
25
- sitearchhdrdir = $(sitehdrdir)/$(sitearch)
26
- rubyarchhdrdir = $(rubyhdrdir)/$(arch)
27
- vendorhdrdir = $(rubyhdrdir)/vendor_ruby
28
- sitehdrdir = $(rubyhdrdir)/site_ruby
29
- rubyhdrdir = $(includedir)/$(RUBY_VERSION_NAME)
30
- vendorarchdir = $(vendorlibdir)/$(sitearch)
31
- vendorlibdir = $(vendordir)/$(ruby_version)
32
- vendordir = $(rubylibprefix)/vendor_ruby
33
- sitearchdir = $(sitelibdir)/$(sitearch)
34
- sitelibdir = $(sitedir)/$(ruby_version)
35
- sitedir = $(DESTDIR)/Library/Ruby/Site
36
- rubyarchdir = $(rubylibdir)/$(arch)
37
- rubylibdir = $(rubylibprefix)/$(ruby_version)
38
- sitearchincludedir = $(includedir)/$(sitearch)
39
- archincludedir = $(includedir)/$(arch)
40
- sitearchlibdir = $(libdir)/$(sitearch)
41
- archlibdir = $(libdir)/$(arch)
42
- ridir = $(datarootdir)/$(RI_BASE_NAME)
43
- mandir = $(DESTDIR)/usr/share/man
44
- localedir = $(datarootdir)/locale
45
- libdir = $(exec_prefix)/lib
46
- psdir = $(docdir)
47
- pdfdir = $(docdir)
48
- dvidir = $(docdir)
49
- htmldir = $(docdir)
50
- infodir = $(DESTDIR)/usr/share/info
51
- docdir = $(datarootdir)/doc/$(PACKAGE)
52
- oldincludedir = /usr/include
53
- includedir = $(prefix)/include
54
- localstatedir = $(prefix)/var
55
- sharedstatedir = $(prefix)/com
56
- sysconfdir = $(DESTDIR)/Library/Ruby/Site
57
- datadir = $(datarootdir)
58
- datarootdir = $(prefix)/share
59
- libexecdir = $(exec_prefix)/libexec
60
- sbindir = $(exec_prefix)/sbin
61
- bindir = $(exec_prefix)/bin
62
- archdir = $(rubyarchdir)
63
-
64
-
65
- CC = xcrun clang
66
- CXX = xcrun clang++
67
- LIBRUBY = $(LIBRUBY_SO)
68
- LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
69
- LIBRUBYARG_SHARED = -l$(RUBY_SO_NAME)
70
- LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)-static
71
- empty =
72
- OUTFLAG = -o $(empty)
73
- COUTFLAG = -o $(empty)
74
-
75
- RUBY_EXTCONF_H =
76
- cflags = $(optflags) $(debugflags) $(warnflags)
77
- optflags =
78
- debugflags = -g
79
- warnflags =
80
- CCDLFLAGS =
81
- CFLAGS = $(CCDLFLAGS) -g -Os -pipe -DHAVE_GCC_SYNC_BUILTINS $(ARCH_FLAG)
82
- INCFLAGS = -I. -I$(arch_hdrdir) -I$(hdrdir)/ruby/backward -I$(hdrdir) -I$(srcdir)
83
- DEFS =
84
- CPPFLAGS = -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT $(DEFS) $(cppflags)
85
- CXXFLAGS = $(CCDLFLAGS) $(ARCH_FLAG) -g -Os -pipe $(ARCH_FLAG)
86
- ldflags = -L. -L/usr/local/lib
87
- dldflags = -Wl,-undefined,dynamic_lookup -Wl,-multiply_defined,suppress
88
- ARCH_FLAG = -arch x86_64 -arch i386
89
- DLDFLAGS = $(ldflags) $(dldflags) $(ARCH_FLAG)
90
- LDSHARED = $(CC) -dynamic -bundle
91
- LDSHAREDXX = $(CXX) -dynamic -bundle
92
- AR = ar
93
- EXEEXT =
94
-
95
- RUBY_INSTALL_NAME = ruby
96
- RUBY_SO_NAME = ruby.2.0.0
97
- RUBYW_INSTALL_NAME =
98
- RUBY_VERSION_NAME = $(RUBY_BASE_NAME)-$(ruby_version)
99
- RUBYW_BASE_NAME = rubyw
100
- RUBY_BASE_NAME = ruby
101
-
102
- arch = universal-darwin14
103
- sitearch = $(arch)
104
- ruby_version = 2.0.0
105
- ruby = $(bindir)/ruby
106
- RUBY = $(ruby)
107
- ruby_headers = $(hdrdir)/ruby.h $(hdrdir)/ruby/defines.h $(arch_hdrdir)/ruby/config.h
108
-
109
- RM = rm -f
110
- RM_RF = $(RUBY) -run -e rm -- -rf
111
- RMDIRS = rmdir -p
112
- MAKEDIRS = mkdir -p
113
- INSTALL = /usr/bin/install -c
114
- INSTALL_PROG = $(INSTALL) -m 0755
115
- INSTALL_DATA = $(INSTALL) -m 644
116
- COPY = cp
117
- TOUCH = exit >
118
-
119
- #### End of system configuration section. ####
120
-
121
- preload =
122
-
123
- libpath = . $(libdir)
124
- LIBPATH = -L. -L$(libdir)
125
- DEFFILE =
126
-
127
- CLEANFILES = mkmf.log
128
- DISTCLEANFILES =
129
- DISTCLEANDIRS =
130
-
131
- extout =
132
- extout_prefix =
133
- target_prefix =
134
- LOCAL_LIBS =
135
- LIBS = $(LIBRUBYARG_SHARED) -lpthread -ldl -lobjc
136
- ORIG_SRCS = colourdiff.c
137
- SRCS = $(ORIG_SRCS)
138
- OBJS = colourdiff.o
139
- HDRS =
140
- TARGET = Colourdiff
141
- TARGET_NAME = Colourdiff
142
- TARGET_ENTRY = Init_$(TARGET_NAME)
143
- DLLIB = $(TARGET).bundle
144
- EXTSTATIC =
145
- STATIC_LIB =
146
-
147
- BINDIR = $(DESTDIR)$(bindir)
148
- RUBYCOMMONDIR = $(DESTDIR)$(sitedir)$(target_prefix)
149
- RUBYLIBDIR = $(DESTDIR)$(sitelibdir)$(target_prefix)
150
- RUBYARCHDIR = $(DESTDIR)$(sitearchdir)$(target_prefix)
151
- HDRDIR = $(DESTDIR)$(rubyhdrdir)/ruby$(target_prefix)
152
- ARCHHDRDIR = $(DESTDIR)$(rubyhdrdir)/$(arch)/ruby$(target_prefix)
153
-
154
- TARGET_SO = $(DLLIB)
155
- CLEANLIBS = $(TARGET).bundle
156
- CLEANOBJS = *.o *.bak
157
-
158
- all: $(DLLIB)
159
- static: $(STATIC_LIB)
160
- .PHONY: all install static install-so install-rb
161
- .PHONY: clean clean-so clean-static clean-rb
162
-
163
- clean-static::
164
- clean-rb-default::
165
- clean-rb::
166
- clean-so::
167
- clean: clean-so clean-static clean-rb-default clean-rb
168
- -$(Q)$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES) .*.time
169
-
170
- distclean-rb-default::
171
- distclean-rb::
172
- distclean-so::
173
- distclean-static::
174
- distclean: clean distclean-so distclean-static distclean-rb-default distclean-rb
175
- -$(Q)$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log
176
- -$(Q)$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES)
177
- -$(Q)$(RMDIRS) $(DISTCLEANDIRS) 2> /dev/null || true
178
-
179
- realclean: distclean
180
- install: install-so install-rb
181
-
182
- install-so: $(DLLIB) ./.RUBYARCHDIR.time
183
- $(INSTALL_PROG) $(DLLIB) $(RUBYARCHDIR)
184
- clean-static::
185
- -$(Q)$(RM) $(STATIC_LIB)
186
- install-rb: pre-install-rb install-rb-default
187
- install-rb-default: pre-install-rb-default
188
- pre-install-rb: Makefile
189
- pre-install-rb-default: Makefile
190
- pre-install-rb-default:
191
- $(ECHO) installing default Colourdiff libraries
192
- ./.RUBYARCHDIR.time:
193
- $(Q) $(MAKEDIRS) $(RUBYARCHDIR)
194
- $(Q) $(TOUCH) $@
195
-
196
- site-install: site-install-so site-install-rb
197
- site-install-so: install-so
198
- site-install-rb: install-rb
199
-
200
- .SUFFIXES: .c .m .cc .mm .cxx .cpp .C .o
201
-
202
- .cc.o:
203
- $(ECHO) compiling $(<)
204
- $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
205
-
206
- .mm.o:
207
- $(ECHO) compiling $(<)
208
- $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
209
-
210
- .cxx.o:
211
- $(ECHO) compiling $(<)
212
- $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
213
-
214
- .cpp.o:
215
- $(ECHO) compiling $(<)
216
- $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
217
-
218
- .C.o:
219
- $(ECHO) compiling $(<)
220
- $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
221
-
222
- .c.o:
223
- $(ECHO) compiling $(<)
224
- $(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $<
225
-
226
- .m.o:
227
- $(ECHO) compiling $(<)
228
- $(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $<
229
-
230
- $(DLLIB): $(OBJS) Makefile
231
- $(ECHO) linking shared-object $(DLLIB)
232
- -$(Q)$(RM) $(@)
233
- $(Q) $(LDSHARED) -o $@ $(OBJS) $(LIBPATH) $(DLDFLAGS) $(LOCAL_LIBS) $(LIBS)
234
- $(Q) test -z '$(RUBY_CODESIGN)' || codesign -s '$(RUBY_CODESIGN)' -f $@
235
-
236
-
237
-
238
- $(OBJS): $(HDRS) $(ruby_headers)
Binary file
@@ -1,238 +0,0 @@
1
-
2
- SHELL = /bin/sh
3
-
4
- # V=0 quiet, V=1 verbose. other values don't work.
5
- V = 0
6
- Q1 = $(V:1=)
7
- Q = $(Q1:0=@)
8
- ECHO1 = $(V:1=@:)
9
- ECHO = $(ECHO1:0=@echo)
10
-
11
- #### Start of system configuration section. ####
12
-
13
- srcdir = .
14
- topdir = /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0
15
- hdrdir = $(topdir)
16
- arch_hdrdir = /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0/universal-darwin14
17
- PATH_SEPARATOR = :
18
- VPATH = $(srcdir):$(arch_hdrdir)/ruby:$(hdrdir)/ruby
19
- prefix = /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr
20
- rubysitearchprefix = $(rubylibprefix)/$(sitearch)
21
- rubyarchprefix = $(rubylibprefix)/$(arch)
22
- rubylibprefix = $(libdir)/$(RUBY_BASE_NAME)
23
- exec_prefix = $(prefix)
24
- vendorarchhdrdir = $(vendorhdrdir)/$(sitearch)
25
- sitearchhdrdir = $(sitehdrdir)/$(sitearch)
26
- rubyarchhdrdir = $(rubyhdrdir)/$(arch)
27
- vendorhdrdir = $(rubyhdrdir)/vendor_ruby
28
- sitehdrdir = $(rubyhdrdir)/site_ruby
29
- rubyhdrdir = $(includedir)/$(RUBY_VERSION_NAME)
30
- vendorarchdir = $(vendorlibdir)/$(sitearch)
31
- vendorlibdir = $(vendordir)/$(ruby_version)
32
- vendordir = $(rubylibprefix)/vendor_ruby
33
- sitearchdir = $(sitelibdir)/$(sitearch)
34
- sitelibdir = $(sitedir)/$(ruby_version)
35
- sitedir = $(DESTDIR)/Library/Ruby/Site
36
- rubyarchdir = $(rubylibdir)/$(arch)
37
- rubylibdir = $(rubylibprefix)/$(ruby_version)
38
- sitearchincludedir = $(includedir)/$(sitearch)
39
- archincludedir = $(includedir)/$(arch)
40
- sitearchlibdir = $(libdir)/$(sitearch)
41
- archlibdir = $(libdir)/$(arch)
42
- ridir = $(datarootdir)/$(RI_BASE_NAME)
43
- mandir = $(DESTDIR)/usr/share/man
44
- localedir = $(datarootdir)/locale
45
- libdir = $(exec_prefix)/lib
46
- psdir = $(docdir)
47
- pdfdir = $(docdir)
48
- dvidir = $(docdir)
49
- htmldir = $(docdir)
50
- infodir = $(DESTDIR)/usr/share/info
51
- docdir = $(datarootdir)/doc/$(PACKAGE)
52
- oldincludedir = /usr/include
53
- includedir = $(prefix)/include
54
- localstatedir = $(prefix)/var
55
- sharedstatedir = $(prefix)/com
56
- sysconfdir = $(DESTDIR)/Library/Ruby/Site
57
- datadir = $(datarootdir)
58
- datarootdir = $(prefix)/share
59
- libexecdir = $(exec_prefix)/libexec
60
- sbindir = $(exec_prefix)/sbin
61
- bindir = $(exec_prefix)/bin
62
- archdir = $(rubyarchdir)
63
-
64
-
65
- CC = xcrun clang
66
- CXX = xcrun clang++
67
- LIBRUBY = $(LIBRUBY_SO)
68
- LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
69
- LIBRUBYARG_SHARED = -l$(RUBY_SO_NAME)
70
- LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)-static
71
- empty =
72
- OUTFLAG = -o $(empty)
73
- COUTFLAG = -o $(empty)
74
-
75
- RUBY_EXTCONF_H =
76
- cflags = $(optflags) $(debugflags) $(warnflags)
77
- optflags =
78
- debugflags = -g
79
- warnflags =
80
- CCDLFLAGS =
81
- CFLAGS = $(CCDLFLAGS) -g -Os -pipe -DHAVE_GCC_SYNC_BUILTINS $(ARCH_FLAG)
82
- INCFLAGS = -I. -I$(arch_hdrdir) -I$(hdrdir)/ruby/backward -I$(hdrdir) -I$(srcdir)
83
- DEFS =
84
- CPPFLAGS = -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT $(DEFS) $(cppflags)
85
- CXXFLAGS = $(CCDLFLAGS) $(ARCH_FLAG) -g -Os -pipe $(ARCH_FLAG)
86
- ldflags = -L. -L/usr/local/lib
87
- dldflags = -Wl,-undefined,dynamic_lookup -Wl,-multiply_defined,suppress
88
- ARCH_FLAG = -arch x86_64 -arch i386
89
- DLDFLAGS = $(ldflags) $(dldflags) $(ARCH_FLAG)
90
- LDSHARED = $(CC) -dynamic -bundle
91
- LDSHAREDXX = $(CXX) -dynamic -bundle
92
- AR = ar
93
- EXEEXT =
94
-
95
- RUBY_INSTALL_NAME = ruby
96
- RUBY_SO_NAME = ruby.2.0.0
97
- RUBYW_INSTALL_NAME =
98
- RUBY_VERSION_NAME = $(RUBY_BASE_NAME)-$(ruby_version)
99
- RUBYW_BASE_NAME = rubyw
100
- RUBY_BASE_NAME = ruby
101
-
102
- arch = universal-darwin14
103
- sitearch = $(arch)
104
- ruby_version = 2.0.0
105
- ruby = $(bindir)/ruby
106
- RUBY = $(ruby)
107
- ruby_headers = $(hdrdir)/ruby.h $(hdrdir)/ruby/defines.h $(arch_hdrdir)/ruby/config.h
108
-
109
- RM = rm -f
110
- RM_RF = $(RUBY) -run -e rm -- -rf
111
- RMDIRS = rmdir -p
112
- MAKEDIRS = mkdir -p
113
- INSTALL = /usr/bin/install -c
114
- INSTALL_PROG = $(INSTALL) -m 0755
115
- INSTALL_DATA = $(INSTALL) -m 644
116
- COPY = cp
117
- TOUCH = exit >
118
-
119
- #### End of system configuration section. ####
120
-
121
- preload =
122
-
123
- libpath = . $(libdir)
124
- LIBPATH = -L. -L$(libdir)
125
- DEFFILE =
126
-
127
- CLEANFILES = mkmf.log
128
- DISTCLEANFILES =
129
- DISTCLEANDIRS =
130
-
131
- extout =
132
- extout_prefix =
133
- target_prefix =
134
- LOCAL_LIBS =
135
- LIBS = $(LIBRUBYARG_SHARED) -lpthread -ldl -lobjc
136
- ORIG_SRCS = colourdiff.c
137
- SRCS = $(ORIG_SRCS)
138
- OBJS = colourdiff.o
139
- HDRS =
140
- TARGET = Colourdiff
141
- TARGET_NAME = Colourdiff
142
- TARGET_ENTRY = Init_$(TARGET_NAME)
143
- DLLIB = $(TARGET).bundle
144
- EXTSTATIC =
145
- STATIC_LIB =
146
-
147
- BINDIR = $(DESTDIR)$(bindir)
148
- RUBYCOMMONDIR = $(DESTDIR)$(sitedir)$(target_prefix)
149
- RUBYLIBDIR = $(DESTDIR)$(sitelibdir)$(target_prefix)
150
- RUBYARCHDIR = $(DESTDIR)$(sitearchdir)$(target_prefix)
151
- HDRDIR = $(DESTDIR)$(rubyhdrdir)/ruby$(target_prefix)
152
- ARCHHDRDIR = $(DESTDIR)$(rubyhdrdir)/$(arch)/ruby$(target_prefix)
153
-
154
- TARGET_SO = $(DLLIB)
155
- CLEANLIBS = $(TARGET).bundle
156
- CLEANOBJS = *.o *.bak
157
-
158
- all: $(DLLIB)
159
- static: $(STATIC_LIB)
160
- .PHONY: all install static install-so install-rb
161
- .PHONY: clean clean-so clean-static clean-rb
162
-
163
- clean-static::
164
- clean-rb-default::
165
- clean-rb::
166
- clean-so::
167
- clean: clean-so clean-static clean-rb-default clean-rb
168
- -$(Q)$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES) .*.time
169
-
170
- distclean-rb-default::
171
- distclean-rb::
172
- distclean-so::
173
- distclean-static::
174
- distclean: clean distclean-so distclean-static distclean-rb-default distclean-rb
175
- -$(Q)$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log
176
- -$(Q)$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES)
177
- -$(Q)$(RMDIRS) $(DISTCLEANDIRS) 2> /dev/null || true
178
-
179
- realclean: distclean
180
- install: install-so install-rb
181
-
182
- install-so: $(DLLIB) ./.RUBYARCHDIR.time
183
- $(INSTALL_PROG) $(DLLIB) $(RUBYARCHDIR)
184
- clean-static::
185
- -$(Q)$(RM) $(STATIC_LIB)
186
- install-rb: pre-install-rb install-rb-default
187
- install-rb-default: pre-install-rb-default
188
- pre-install-rb: Makefile
189
- pre-install-rb-default: Makefile
190
- pre-install-rb-default:
191
- $(ECHO) installing default Colourdiff libraries
192
- ./.RUBYARCHDIR.time:
193
- $(Q) $(MAKEDIRS) $(RUBYARCHDIR)
194
- $(Q) $(TOUCH) $@
195
-
196
- site-install: site-install-so site-install-rb
197
- site-install-so: install-so
198
- site-install-rb: install-rb
199
-
200
- .SUFFIXES: .c .m .cc .mm .cxx .cpp .C .o
201
-
202
- .cc.o:
203
- $(ECHO) compiling $(<)
204
- $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
205
-
206
- .mm.o:
207
- $(ECHO) compiling $(<)
208
- $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
209
-
210
- .cxx.o:
211
- $(ECHO) compiling $(<)
212
- $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
213
-
214
- .cpp.o:
215
- $(ECHO) compiling $(<)
216
- $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
217
-
218
- .C.o:
219
- $(ECHO) compiling $(<)
220
- $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
221
-
222
- .c.o:
223
- $(ECHO) compiling $(<)
224
- $(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $<
225
-
226
- .m.o:
227
- $(ECHO) compiling $(<)
228
- $(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $<
229
-
230
- $(DLLIB): $(OBJS) Makefile
231
- $(ECHO) linking shared-object $(DLLIB)
232
- -$(Q)$(RM) $(@)
233
- $(Q) $(LDSHARED) -o $@ $(OBJS) $(LIBPATH) $(DLDFLAGS) $(LOCAL_LIBS) $(LIBS)
234
- $(Q) test -z '$(RUBY_CODESIGN)' || codesign -s '$(RUBY_CODESIGN)' -f $@
235
-
236
-
237
-
238
- $(OBJS): $(HDRS) $(ruby_headers)
@@ -1,172 +0,0 @@
1
- #include <ruby.h>
2
- #include <stdio.h>
3
- #include <math.h>
4
-
5
- VALUE Colourdiff = Qnil; /* Ruby Module */
6
-
7
- VALUE method_ciede2000(VALUE self, VALUE color1, VALUE color2) {
8
- double pi = 3.1415927;
9
- double e = 2.7182818;
10
- double conversion = pi/180.0;
11
- double _kL = 1.0;
12
- double _kC = 1.0;
13
- double _kH = 1.0;
14
- double l1;
15
- double l2;
16
- double a1;
17
- double a2;
18
-
19
- double r1 = NUM2DBL(rb_hash_aref(color1, rb_str_intern(rb_str_new2("r"))))/255.0;
20
- double g1 = NUM2DBL(rb_hash_aref(color1, rb_str_intern(rb_str_new2("g"))))/255.0;
21
- double b1 = NUM2DBL(rb_hash_aref(color1, rb_str_intern(rb_str_new2("b"))))/255.0;
22
-
23
- double r2 = NUM2DBL(rb_hash_aref(color2, rb_str_intern(rb_str_new2("r"))))/255.0;
24
- double g2 = NUM2DBL(rb_hash_aref(color2, rb_str_intern(rb_str_new2("g"))))/255.0;
25
- double b2 = NUM2DBL(rb_hash_aref(color2, rb_str_intern(rb_str_new2("b"))))/255.0;
26
-
27
- r1 = ((r1 <= 0.04045) ? r1 / 12.92 : pow(((r1 + 0.055) / 1.055),2.4));
28
- g1 = ((g1 <= 0.04045) ? g1 / 12.92 : pow(((g1 + 0.055) / 1.055),2.4));
29
- b1 = ((b1 <= 0.04045) ? b1 / 12.92 : pow(((b1 + 0.055) / 1.055),2.4));
30
-
31
- r2 = ((r2 <= 0.04045) ? r2 / 12.92 : pow(((r2 + 0.055) / 1.055),2.4));
32
- g2 = ((g2 <= 0.04045) ? g2 / 12.92 : pow(((g2 + 0.055) / 1.055),2.4));
33
- b2 = ((b2 <= 0.04045) ? b2 / 12.92 : pow(((b2 + 0.055) / 1.055),2.4));
34
-
35
- double x1 = 0.412453 * r1 + 0.357580 * g1 + 0.180423 * b1;
36
- double y1 = 0.212671 * r1 + 0.715160 * g1 + 0.072169 * b1;
37
- double z1 = 0.019334 * r1 + 0.119193 * g1 + 0.950227 * b1;
38
-
39
- double x2 = 0.412453 * r2 + 0.357580 * g2 + 0.180423 * b2;
40
- double y2 = 0.212671 * r2 + 0.715160 * g2 + 0.072169 * b2;
41
- double z2 = 0.019334 * r2 + 0.119193 * g2 + 0.950227 * b2;
42
-
43
- double fx;
44
- double fy;
45
- double fz;
46
-
47
- if(x1 <= 0.008856){
48
- fx = 7.787 * x1/0.95047 + 16.0/116.0;
49
- }else{
50
- fx = cbrt(x1/0.95047);
51
- }
52
-
53
- if(y1 <= 0.008856){
54
- l1 = 903.3 * y1;
55
- fy = (7.787 * y1 + 16.0/116.0);
56
- }else{
57
- l1 = 116.0 * cbrt(y1) - 16.0;
58
- fy = cbrt(y1);
59
- }
60
-
61
- if(z1 <= 0.008856){
62
- fz = 7.787 * z1/1.08883 + 16.0/116.0;
63
- }else{
64
- fz = cbrt(z1/1.08883);
65
- }
66
-
67
- a1 = 500.0 * (fx-fy);
68
- b1 = 200.0 * (fy-fz);
69
-
70
- if(x2 <= 0.008856){
71
- fx = (7.787 * x2/0.95047 + 16.0/116.0);
72
- }else{
73
- fx = cbrt(x2/0.95047);
74
- }
75
-
76
- if(y2 <= 0.008856){
77
- l2 = 903.3 * y2;
78
- fy = (7.787 * y2 + 16.0/116.0);
79
- }else{
80
- l2 = 116.0 * cbrt(y2) - 16.0;
81
- fy = cbrt(y2);
82
- }
83
-
84
- if(z2 <= 0.008856){
85
- fz = (7.787 * z2/1.08883 + 16.0/116.0);
86
- }else{
87
- fz = cbrt(z2/1.08883);
88
- }
89
-
90
- a2 = 500.0 * (fx-fy);
91
- b2 = 200.0 * (fy-fz);
92
-
93
- double c1 = sqrt(a1*a1+b1*b1);
94
- double c2 = sqrt(a2*a2+b2*b2);
95
- double cdelta = c2 - c1;
96
-
97
- double lbar = (l1 + l2)/2.0;
98
- double cbar = (c1 + c2)/2.0;
99
-
100
- double lbaradj = (lbar - 50.0)*(lbar - 50.0);
101
- double cbaradj = sqrt(pow(cbar,7)/(pow(cbar,7)+6103515625.0));
102
-
103
- double a1prime = a1 + (a1/2.0) * (1.0-cbaradj);
104
- double a2prime = a2 + (a2/2.0) * (1.0-cbaradj);
105
-
106
- double c1prime = sqrt(a1prime*a1prime+b1*b1);
107
- double c2prime = sqrt(a2prime*a2prime+b2*b2);
108
- double cprime = (c1prime + c2prime)/2.0;
109
- double cprimeadj = sqrt(pow(cprime,7)/(pow(cprime,7)+6103515625.0));
110
- double cprimedelta = c2prime - c1prime;
111
-
112
- double h1;
113
- double h2;
114
- if(c1 == 0.0){
115
- h1 = 0.0;
116
- }else{
117
- h1 = fmod(atan2(b1,a1prime)*180.0/pi,360.0);
118
- }
119
- if(c2 == 0.0){
120
- h2 = 0.0;
121
- }else{
122
- h2 = fmod(atan2(b2,a2prime)*180.0/pi,360.0);
123
- }
124
-
125
- double h;
126
- if (fabs(h2 - h1) <= 180.0){
127
- h = h2 - h1;
128
- }else if(h2 <= h1){
129
- h = h2 - h1 + 360.0;
130
- }else{
131
- h = h2 - h1 - 360.0;
132
- }
133
-
134
- double hdelta = 2.0 * sqrt(c1prime * c2prime) * sin(conversion*h/2.0);
135
- double hprime = (h1 + h2)/2.0;
136
- if (fabs(h1 - h2) > 180.0){
137
- hprime += 180.0;
138
- }
139
- if(c1prime == 0.0 || c2prime == 0.0){
140
- hprime *= 2.0;
141
- }
142
-
143
- double t = 1.0 - 0.17*cos(conversion*(hprime-30.0)) +
144
- 0.24*cos(conversion*(2.0*hprime)) +
145
- 0.32*cos(conversion*(3.0*hprime + 6.0)) -
146
- 0.20*cos(conversion*(4.0*hprime-63.0));
147
-
148
- double sl = 1.0 + 0.015 * lbaradj/sqrt(20+lbaradj);
149
- double sc = 1.0 + 0.045*cprime;
150
- double sh = 1.0 + 0.015*cprime*t;
151
-
152
- if (hprime < 0.0){
153
- hprime += 360.0;
154
- }
155
-
156
- double rt = -2.0*cprimeadj*sin(conversion*60.0*pow(e,(hprime-275.0)*(hprime-275.0)/(-625.0)));
157
-
158
- double ldiff = (l1 - l2)/sl;
159
- double adiff = cprimedelta/sc;
160
- double bdiff = hdelta/sh;
161
- double rdiff = rt*adiff*bdiff;
162
- double val = sqrt(ldiff*ldiff+adiff*adiff+bdiff*bdiff+rdiff)/100.0;
163
-
164
- return DBL2NUM(val);
165
- }
166
-
167
-
168
- void Init_colourdiff() {
169
- Colourdiff = rb_define_module("Colourdiff");
170
- rb_define_singleton_method(Colourdiff, "ciede2000", method_ciede2000, 2);
171
- }
172
-
Binary file
Binary file
@@ -1,6 +0,0 @@
1
- require 'mkmf';
2
-
3
- # extension name
4
- extname = 'Colourdiff';
5
-
6
- create_makefile(extname);
Binary file