ico 0.1.0 → 0.1.1
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/Manifest.txt +1 -0
- data/ico.gemspec +67 -0
- data/lib/ico.rb +17 -14
- data/lib/ico/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5a012e50b4d328b067cd6bc6c8eb90e88cd1b5b6
|
4
|
+
data.tar.gz: 8a2da2df36d786586806871a0e205e0cacb1acdb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e6c9f22a4bfe78001d2c80c852943639d82b6e1c5062a585835293d1fdbe7a07c7e82e753799b7de92eaca3e51f46172432caf59bbfaacc113f36476c50677c7
|
7
|
+
data.tar.gz: 77512c9b61c7268f65cdd434bc0e3d8d4cd64636efc9225672a456df8f6173b0d206d61629d4f1f9843e9ba2a2c97af5939cbc46af5f068a81aef88be6faa41c
|
data/Manifest.txt
CHANGED
data/ico.gemspec
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
# stub: ico 0.1.1 ruby lib
|
3
|
+
|
4
|
+
Gem::Specification.new do |s|
|
5
|
+
s.name = "ico"
|
6
|
+
s.version = "0.1.1"
|
7
|
+
|
8
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
9
|
+
s.require_paths = ["lib"]
|
10
|
+
s.authors = ["So Awesome Man"]
|
11
|
+
s.date = "2017-04-02"
|
12
|
+
s.description = "ICO file format in Ruby"
|
13
|
+
s.email = "support@bordee.com"
|
14
|
+
s.extra_rdoc_files = ["History.txt", "Manifest.txt", "README.md", "History.txt"]
|
15
|
+
s.files = [".autotest", ".gitignore", ".hoeignore", "Gemfile", "History.txt", "LICENSE", "Manifest.txt", "README.md", "Rakefile", "ico.gemspec", "lib/core_ext/array/extract_options.rb", "lib/ico.rb", "lib/ico/icon_dir.rb", "lib/ico/icon_dir_entry.rb", "lib/ico/icon_image.rb", "lib/ico/utils.rb", "lib/ico/version.rb", "lib/tasks/ico.rake"]
|
16
|
+
s.homepage = "https://github.com/bordeeinc/ico"
|
17
|
+
s.licenses = ["MIT"]
|
18
|
+
s.rdoc_options = ["--title", "ico", "--markup", "markdown", "--quiet"]
|
19
|
+
s.required_ruby_version = Gem::Requirement.new(">= 1.9.2")
|
20
|
+
s.rubygems_version = "2.2.5"
|
21
|
+
s.summary = "ICO file format in Ruby"
|
22
|
+
|
23
|
+
if s.respond_to? :specification_version then
|
24
|
+
s.specification_version = 4
|
25
|
+
|
26
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
27
|
+
s.add_runtime_dependency(%q<chunky_png>, ["= 1.3.8"])
|
28
|
+
s.add_runtime_dependency(%q<bit-struct>, ["= 0.15.0"])
|
29
|
+
s.add_runtime_dependency(%q<bmp-ruby>, ["= 0.1.1"])
|
30
|
+
s.add_development_dependency(%q<minitest>, ["~> 5.10"])
|
31
|
+
s.add_development_dependency(%q<hoe-yard>, [">= 0.1.3"])
|
32
|
+
s.add_development_dependency(%q<hoe-ignore>, ["~> 1.0"])
|
33
|
+
s.add_development_dependency(%q<hoe-bundler>, ["~> 1.2"])
|
34
|
+
s.add_development_dependency(%q<hoe-gemspec>, ["~> 1.0"])
|
35
|
+
s.add_development_dependency(%q<hoe-git>, ["~> 1.6"])
|
36
|
+
s.add_development_dependency(%q<yard>, ["~> 0.8"])
|
37
|
+
s.add_development_dependency(%q<redcarpet>, ["~> 3.3"])
|
38
|
+
s.add_development_dependency(%q<hoe>, ["~> 3.16"])
|
39
|
+
else
|
40
|
+
s.add_dependency(%q<chunky_png>, ["= 1.3.8"])
|
41
|
+
s.add_dependency(%q<bit-struct>, ["= 0.15.0"])
|
42
|
+
s.add_dependency(%q<bmp-ruby>, ["= 0.1.1"])
|
43
|
+
s.add_dependency(%q<minitest>, ["~> 5.10"])
|
44
|
+
s.add_dependency(%q<hoe-yard>, [">= 0.1.3"])
|
45
|
+
s.add_dependency(%q<hoe-ignore>, ["~> 1.0"])
|
46
|
+
s.add_dependency(%q<hoe-bundler>, ["~> 1.2"])
|
47
|
+
s.add_dependency(%q<hoe-gemspec>, ["~> 1.0"])
|
48
|
+
s.add_dependency(%q<hoe-git>, ["~> 1.6"])
|
49
|
+
s.add_dependency(%q<yard>, ["~> 0.8"])
|
50
|
+
s.add_dependency(%q<redcarpet>, ["~> 3.3"])
|
51
|
+
s.add_dependency(%q<hoe>, ["~> 3.16"])
|
52
|
+
end
|
53
|
+
else
|
54
|
+
s.add_dependency(%q<chunky_png>, ["= 1.3.8"])
|
55
|
+
s.add_dependency(%q<bit-struct>, ["= 0.15.0"])
|
56
|
+
s.add_dependency(%q<bmp-ruby>, ["= 0.1.1"])
|
57
|
+
s.add_dependency(%q<minitest>, ["~> 5.10"])
|
58
|
+
s.add_dependency(%q<hoe-yard>, [">= 0.1.3"])
|
59
|
+
s.add_dependency(%q<hoe-ignore>, ["~> 1.0"])
|
60
|
+
s.add_dependency(%q<hoe-bundler>, ["~> 1.2"])
|
61
|
+
s.add_dependency(%q<hoe-gemspec>, ["~> 1.0"])
|
62
|
+
s.add_dependency(%q<hoe-git>, ["~> 1.6"])
|
63
|
+
s.add_dependency(%q<yard>, ["~> 0.8"])
|
64
|
+
s.add_dependency(%q<redcarpet>, ["~> 3.3"])
|
65
|
+
s.add_dependency(%q<hoe>, ["~> 3.16"])
|
66
|
+
end
|
67
|
+
end
|
data/lib/ico.rb
CHANGED
@@ -32,23 +32,28 @@ module ICO
|
|
32
32
|
# ensure .png extensions
|
33
33
|
raise "more than PNG format files in #{filename_array.inspect}" if ICO::Utils.contains_other_than_ext?(fn_array, :png)
|
34
34
|
|
35
|
+
fn_array_length = fn_array.length
|
35
36
|
icon_dir = ICO::IconDir.new
|
36
37
|
icon_dir.image_count = fn_array.length
|
37
|
-
offset = ICO::IconDir::LENGTH_IN_BYTES + (
|
38
|
-
entries =
|
39
|
-
images =
|
40
|
-
|
38
|
+
offset = ICO::IconDir::LENGTH_IN_BYTES + (fn_array_length * ICO::IconDirEntry::LENGTH_IN_BYTES)
|
39
|
+
entries = Array.new(fn_array_length) {ICO::IconDirEntry.new}
|
40
|
+
images = Array.new(fn_array_length) {ICO::IconImage.new}
|
41
|
+
# reorder by image size
|
42
|
+
images_array = ICO::Utils.sizes_hash(fn_array, true, true).values
|
41
43
|
|
42
|
-
|
44
|
+
images_array.each_with_index do |fn,i|
|
43
45
|
img = ChunkyPNG::Image.from_file(fn)
|
46
|
+
#img_hash = BMP::Utils.parse_image(img, ICO::IconImage::HEADER_SIZE_IN_BYTES)
|
44
47
|
img_hash = BMP::Utils.parse_image(img)
|
48
|
+
file_size = img_hash[:image_size] + ICO::IconImage::HEADER_SIZE_IN_BYTES
|
45
49
|
|
46
|
-
entry = entries[
|
47
|
-
image = images[
|
50
|
+
entry = entries[i]
|
51
|
+
image = images[i]
|
48
52
|
|
49
53
|
entry.width = img_hash[:image_width]
|
50
54
|
entry.height = img_hash[:image_height]
|
51
|
-
entry.bytes_in_res = img_hash[:file_size]
|
55
|
+
#entry.bytes_in_res = img_hash[:file_size]
|
56
|
+
entry.bytes_in_res = file_size
|
52
57
|
entry.image_offset = offset
|
53
58
|
|
54
59
|
image.width = img_hash[:image_width]
|
@@ -56,14 +61,12 @@ module ICO
|
|
56
61
|
image.size_image = img_hash[:image_size]
|
57
62
|
image.data = img_hash[:pixel_array]
|
58
63
|
|
59
|
-
offset += img_hash[:file_size]
|
64
|
+
#offset += img_hash[:file_size]
|
65
|
+
offset += file_size
|
60
66
|
end
|
61
67
|
|
62
|
-
# IconDirEntry section as binary data string
|
63
|
-
icon_dir.data =
|
64
|
-
|
65
|
-
# IconImage section as binary data string
|
66
|
-
icon_dir.data += images_hash.inject('') {|str,(k,v)| str += images.fetch(v); str}
|
68
|
+
# IconDirEntry + IconImage section as binary data string
|
69
|
+
icon_dir.data = entries.join + images.join
|
67
70
|
|
68
71
|
icon_dir
|
69
72
|
end
|
data/lib/ico/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ico
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- So Awesome Man
|
@@ -196,6 +196,7 @@ files:
|
|
196
196
|
- Manifest.txt
|
197
197
|
- README.md
|
198
198
|
- Rakefile
|
199
|
+
- ico.gemspec
|
199
200
|
- lib/core_ext/array/extract_options.rb
|
200
201
|
- lib/ico.rb
|
201
202
|
- lib/ico/icon_dir.rb
|