image_voodoo 0.8.8 → 0.8.9
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.
- checksums.yaml +4 -4
- data/.rubocop.yml +115 -0
- data/.travis.yml +7 -0
- data/Rakefile +2 -2
- data/bin/image_voodoo +71 -84
- data/image_voodoo.gemspec +6 -5
- data/lib/image_science.rb +1 -1
- data/lib/image_voodoo.rb +41 -93
- data/lib/image_voodoo/awt.rb +156 -153
- data/lib/image_voodoo/awt/core_ext/buffered_image.rb +13 -0
- data/lib/image_voodoo/awt/core_ext/graphics2d.rb +17 -0
- data/lib/image_voodoo/awt/shapes.rb +39 -3
- data/lib/image_voodoo/gae.rb +10 -6
- data/lib/image_voodoo/metadata.rb +115 -89
- data/lib/image_voodoo/needs_head.rb +1 -0
- data/lib/image_voodoo/version.rb +1 -1
- data/samples/bench.rb +29 -36
- data/samples/file_view.rb +2 -1
- data/samples/{in-memory.rb → in_memory.rb} +0 -0
- data/test/test_image_science.rb +32 -74
- data/test/test_image_voodoo.rb +82 -0
- data/test/test_metadata.rb +23 -16
- data/test/test_shapes.rb +21 -0
- data/tools/gen.rb +31 -27
- metadata +15 -8
data/tools/gen.rb
CHANGED
@@ -2,22 +2,26 @@
|
|
2
2
|
# in appropriate access methods so I generate with get_string and then manually
|
3
3
|
# update. In future versions I will just run this twice with old and new src
|
4
4
|
# and manually splice in new data (or fixes).
|
5
|
-
#
|
5
|
+
#
|
6
6
|
# % find ../metadata-extractor/Source/ -name '*Directory.java' | xargs grep TAG_ | grep 'public static final' | ruby tools/gen.rb
|
7
7
|
|
8
|
+
# FIXME: I made style tweaks and removed redundant data manually in generated
|
9
|
+
# source. I should update this tool to do all that.
|
10
|
+
# FIXME: I should add a generated comment in metadata generated file.
|
11
|
+
|
8
12
|
def normalize_directory_name(path)
|
9
|
-
path.
|
13
|
+
path.tr('/', '.')
|
10
14
|
end
|
11
15
|
|
12
16
|
def normalize_tag_name(capname)
|
13
|
-
name = capname.split('_').map
|
17
|
+
name = capname.split('_').map(&:capitalize).join(' ')
|
14
18
|
[name, "TAG_#{capname}"]
|
15
19
|
end
|
16
20
|
|
17
21
|
# 'ExifSubIFDDirectory' => 'Exif Sub IFD0'
|
18
22
|
def humanize_directory_name(s)
|
19
23
|
s = s.gsub('Directory', '')
|
20
|
-
s.split(/([A-Z]+[a-z]+)/).map {|a| a ==
|
24
|
+
s.split(/([A-Z]+[a-z]+)/).map { |a| a == '' ? nil : a }.compact.join(' ')
|
21
25
|
end
|
22
26
|
|
23
27
|
io = $stdin
|
@@ -25,37 +29,37 @@ directories = {}
|
|
25
29
|
|
26
30
|
io.readlines.each do |line|
|
27
31
|
# .../IptcDirectory.java: public static final int TAG_BY_LINE = 80;
|
28
|
-
if %r{Source/[/]?(?<
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
end
|
32
|
+
next if %r{Source/[/]?(?<dir_name>.*).java:.*TAG_(?<tag_name>[\S]+)} !~ line
|
33
|
+
directory_name = normalize_directory_name dir_name
|
34
|
+
directories[directory_name] ||= []
|
35
|
+
directories[directory_name] << normalize_tag_name(tag_name)
|
33
36
|
end
|
34
37
|
|
35
38
|
directories.each do |directory, tag_names|
|
36
39
|
class_name = directory.split('.')[-1]
|
37
|
-
puts "
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
40
|
+
puts <<"EOS"
|
41
|
+
# GENERATED
|
42
|
+
class #{class_name} < Directory
|
43
|
+
java_import #{directory}
|
44
|
+
|
45
|
+
def self.directory_class
|
46
|
+
#{directory}
|
47
|
+
end"
|
48
|
+
|
49
|
+
TAGS = {
|
50
|
+
EOS
|
45
51
|
tag_names.each do |name, original_name|
|
46
|
-
puts "
|
52
|
+
puts "'#{name}' => ['#{original_name}', :get_string],"
|
53
|
+
end
|
54
|
+
puts <<EOS
|
55
|
+
}.freeze
|
47
56
|
end
|
48
|
-
|
49
|
-
puts "end"
|
50
|
-
puts ""
|
57
|
+
EOS
|
51
58
|
end
|
52
59
|
|
53
|
-
puts
|
54
|
-
puts "DIRECTORY_MAP = {"
|
60
|
+
puts 'DIRECTORY_MAP = {'
|
55
61
|
directories.each do |directory, _|
|
56
62
|
class_name = directory.split('.')[-1]
|
57
|
-
puts "
|
63
|
+
puts "'#{humanize_directory_name(class_name)}' => #{class_name},"
|
58
64
|
end
|
59
|
-
puts
|
60
|
-
|
61
|
-
|
65
|
+
puts '}.freeze'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: image_voodoo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thomas E. Enebo, Charles Nutter, Nick Sieger
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-07-06 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Image manipulation in JRuby with ImageScience compatible API
|
14
14
|
email: tom.enebo@gmail.com
|
@@ -20,6 +20,7 @@ files:
|
|
20
20
|
- ".gitignore"
|
21
21
|
- ".hgignore"
|
22
22
|
- ".hgtags"
|
23
|
+
- ".rubocop.yml"
|
23
24
|
- ".travis.yml"
|
24
25
|
- History.txt
|
25
26
|
- LICENSE-2.0.txt
|
@@ -33,21 +34,26 @@ files:
|
|
33
34
|
- lib/image_science.rb
|
34
35
|
- lib/image_voodoo.rb
|
35
36
|
- lib/image_voodoo/awt.rb
|
37
|
+
- lib/image_voodoo/awt/core_ext/buffered_image.rb
|
38
|
+
- lib/image_voodoo/awt/core_ext/graphics2d.rb
|
36
39
|
- lib/image_voodoo/awt/shapes.rb
|
37
40
|
- lib/image_voodoo/gae.rb
|
38
41
|
- lib/image_voodoo/metadata.rb
|
42
|
+
- lib/image_voodoo/needs_head.rb
|
39
43
|
- lib/image_voodoo/version.rb
|
40
44
|
- samples/bench.rb
|
41
45
|
- samples/checkerboard.jpg
|
42
46
|
- samples/file_greyscale.rb
|
43
47
|
- samples/file_thumbnail.rb
|
44
48
|
- samples/file_view.rb
|
45
|
-
- samples/
|
49
|
+
- samples/in_memory.rb
|
46
50
|
- samples/lossy.rb
|
47
51
|
- test/pix.png
|
48
52
|
- test/pix_cmyk.jpg
|
49
53
|
- test/test_image_science.rb
|
54
|
+
- test/test_image_voodoo.rb
|
50
55
|
- test/test_metadata.rb
|
56
|
+
- test/test_shapes.rb
|
51
57
|
- tools/gen.rb
|
52
58
|
- vendor/CMYKDemo.jar
|
53
59
|
- vendor/metadata-extractor-2.7.0.jar
|
@@ -55,7 +61,7 @@ files:
|
|
55
61
|
homepage: http://github.com/jruby/image_voodoo
|
56
62
|
licenses: []
|
57
63
|
metadata: {}
|
58
|
-
post_install_message:
|
64
|
+
post_install_message:
|
59
65
|
rdoc_options: []
|
60
66
|
require_paths:
|
61
67
|
- lib
|
@@ -72,13 +78,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
72
78
|
version: '0'
|
73
79
|
requirements: []
|
74
80
|
rubyforge_project: image_voodoo
|
75
|
-
rubygems_version: 2.
|
76
|
-
signing_key:
|
81
|
+
rubygems_version: 2.5.2
|
82
|
+
signing_key:
|
77
83
|
specification_version: 4
|
78
84
|
summary: Image manipulation in JRuby with ImageScience compatible API
|
79
85
|
test_files:
|
80
86
|
- test/pix.png
|
81
87
|
- test/pix_cmyk.jpg
|
82
88
|
- test/test_image_science.rb
|
89
|
+
- test/test_image_voodoo.rb
|
83
90
|
- test/test_metadata.rb
|
84
|
-
|
91
|
+
- test/test_shapes.rb
|