grayphash 0.0.7 → 0.0.8
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/ext/grayphash/grayphash.cpp +6 -14
- data/lib/grayphash.rb +1 -1
- metadata +2 -2
data/ext/grayphash/grayphash.cpp
CHANGED
@@ -8,17 +8,10 @@
|
|
8
8
|
typedef VALUE (ruby_method)(...);
|
9
9
|
typedef unsigned long long ulong64;
|
10
10
|
|
11
|
-
extern "C" VALUE t_init(VALUE self, VALUE file)
|
12
|
-
{
|
13
|
-
Check_Type(file, T_STRING);
|
14
|
-
rb_iv_set(self, "@file", file);
|
15
|
-
|
16
|
-
return self;
|
17
|
-
}
|
18
11
|
|
19
12
|
extern "C" VALUE t_about(VALUE self)
|
20
13
|
{
|
21
|
-
return rb_str_new_cstr("pHash 0.9.4. Copyright 2008-2010 Aetilius, Inc. Included only some image functions (grayphash v-0.0.
|
14
|
+
return rb_str_new_cstr("pHash 0.9.4. Copyright 2008-2010 Aetilius, Inc. Included only some image functions (grayphash v-0.0.8).");
|
22
15
|
}
|
23
16
|
|
24
17
|
|
@@ -80,14 +73,14 @@
|
|
80
73
|
return 0;
|
81
74
|
}
|
82
75
|
|
83
|
-
extern "C" VALUE t_phash(VALUE self) {
|
84
|
-
|
76
|
+
extern "C" VALUE t_phash(VALUE self, VALUE lfile) {
|
77
|
+
Check_Type(lfile, T_STRING);
|
85
78
|
char* file = RSTRING_PTR(lfile);
|
86
79
|
ulong64 phash = 0;
|
87
80
|
ph_dct_imagehash(file, phash);
|
88
81
|
|
89
82
|
if(phash==0)
|
90
|
-
rb_raise(rb_eFatal, "PHash cannot be 0 but it calcutaled as it. Probably you load PNG file with transparency.");
|
83
|
+
rb_raise(rb_eFatal, "PHash cannot be 0 but it calcutaled as it. Probably you load PNG file with transparency or this file is not exists.");
|
91
84
|
|
92
85
|
rb_iv_set(self, "@phash", ULL2NUM(phash));
|
93
86
|
|
@@ -119,10 +112,9 @@
|
|
119
112
|
|
120
113
|
extern "C" void Init_grayphash()
|
121
114
|
{
|
122
|
-
Grayphash =
|
123
|
-
rb_define_method(Grayphash, "initialize", (ruby_method*) &t_init, 1);
|
115
|
+
Grayphash = rb_define_module("Grayphash");
|
124
116
|
rb_define_method(Grayphash, "about", (ruby_method*) &t_about, 0);
|
125
|
-
rb_define_method(Grayphash, "phash", (ruby_method*) &t_phash,
|
117
|
+
rb_define_method(Grayphash, "phash", (ruby_method*) &t_phash, 1);
|
126
118
|
rb_define_method(Grayphash, "hamming", (ruby_method*) &t_hamming, 2);
|
127
119
|
}
|
128
120
|
|
data/lib/grayphash.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: grayphash
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
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: 2012-07-
|
12
|
+
date: 2012-07-23 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: pHash image wrapper
|
15
15
|
email: tauraloke@gmail.com
|