ico 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ico.gemspec +3 -3
- data/lib/ico.rb +8 -8
- data/lib/ico/icon_image.rb +2 -2
- data/lib/ico/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ea80756d32854345ffc3a3470ea0d2a2ec4ebb66
|
4
|
+
data.tar.gz: 7c5df1dc0e7318d78daee2b5d9f17d94a70fa564
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e48056d32d636cdeb946c1d32703f09242005d897e1fe102d32db95804678340349ed46d54735895dbc9647612a9f4e03bcad7bee3e9ce8ded7c8c7abfb0120f
|
7
|
+
data.tar.gz: 37ccca7ab65758e2895c5bceb265b5921cb7bb01ba8a015dcae40facfc119d4dcc2acf6abdb6f1c08bf8925736d8c86a030dcdae735ef2049eb4708b8a656688
|
data/ico.gemspec
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
# stub: ico 0.1.
|
2
|
+
# stub: ico 0.1.2 ruby lib
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "ico"
|
6
|
-
s.version = "0.1.
|
6
|
+
s.version = "0.1.2"
|
7
7
|
|
8
8
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
9
9
|
s.require_paths = ["lib"]
|
10
10
|
s.authors = ["So Awesome Man"]
|
11
|
-
s.date = "2017-04-
|
11
|
+
s.date = "2017-04-03"
|
12
12
|
s.description = "ICO file format in Ruby"
|
13
13
|
s.email = "support@bordee.com"
|
14
14
|
s.extra_rdoc_files = ["History.txt", "Manifest.txt", "README.md", "History.txt"]
|
data/lib/ico.rb
CHANGED
@@ -45,28 +45,28 @@ module ICO
|
|
45
45
|
img = ChunkyPNG::Image.from_file(fn)
|
46
46
|
#img_hash = BMP::Utils.parse_image(img, ICO::IconImage::HEADER_SIZE_IN_BYTES)
|
47
47
|
img_hash = BMP::Utils.parse_image(img)
|
48
|
-
|
48
|
+
mask_size = img_hash[:image_width] * 4
|
49
|
+
mask = "\x00\x00\x00\x00" * img_hash[:image_width]
|
50
|
+
image_size = (img_hash[:image_width] * img_hash[:image_height] * 4) + mask_size
|
51
|
+
file_size = image_size + ICO::IconImage::HEADER_SIZE_IN_BYTES
|
49
52
|
|
50
53
|
entry = entries[i]
|
51
|
-
image = images[i]
|
52
|
-
|
53
54
|
entry.width = img_hash[:image_width]
|
54
55
|
entry.height = img_hash[:image_height]
|
55
|
-
#entry.bytes_in_res = img_hash[:file_size]
|
56
56
|
entry.bytes_in_res = file_size
|
57
57
|
entry.image_offset = offset
|
58
58
|
|
59
|
+
image = images[i]
|
59
60
|
image.width = img_hash[:image_width]
|
60
61
|
image.height = (img_hash[:image_height] * 2)
|
61
|
-
image.size_image =
|
62
|
-
image.data = img_hash[:pixel_array]
|
62
|
+
image.size_image = image_size
|
63
|
+
image.data = img_hash[:pixel_array] + mask
|
63
64
|
|
64
|
-
#offset += img_hash[:file_size]
|
65
65
|
offset += file_size
|
66
66
|
end
|
67
67
|
|
68
68
|
# IconDirEntry + IconImage section as binary data string
|
69
|
-
icon_dir.data =
|
69
|
+
icon_dir.data = entries.join + images.join
|
70
70
|
|
71
71
|
icon_dir
|
72
72
|
end
|
data/lib/ico/icon_image.rb
CHANGED
@@ -12,8 +12,8 @@ module ICO
|
|
12
12
|
unsigned :bit_count, 16, nil, :default => 32
|
13
13
|
unsigned :compression, 32, nil, :default => 0
|
14
14
|
unsigned :size_image, 32
|
15
|
-
unsigned :x_pixels_per_meter, 32, nil, :default =>
|
16
|
-
unsigned :y_pixels_per_meter, 32, nil, :default =>
|
15
|
+
unsigned :x_pixels_per_meter, 32, nil, :default => 0
|
16
|
+
unsigned :y_pixels_per_meter, 32, nil, :default => 0
|
17
17
|
unsigned :colors_used, 32, nil, :default => 0
|
18
18
|
unsigned :colors_important, 32, nil, :default => 0
|
19
19
|
|
data/lib/ico/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- So Awesome Man
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-04-
|
11
|
+
date: 2017-04-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: chunky_png
|