ico 0.1.1 → 0.1.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5a012e50b4d328b067cd6bc6c8eb90e88cd1b5b6
4
- data.tar.gz: 8a2da2df36d786586806871a0e205e0cacb1acdb
3
+ metadata.gz: ea80756d32854345ffc3a3470ea0d2a2ec4ebb66
4
+ data.tar.gz: 7c5df1dc0e7318d78daee2b5d9f17d94a70fa564
5
5
  SHA512:
6
- metadata.gz: e6c9f22a4bfe78001d2c80c852943639d82b6e1c5062a585835293d1fdbe7a07c7e82e753799b7de92eaca3e51f46172432caf59bbfaacc113f36476c50677c7
7
- data.tar.gz: 77512c9b61c7268f65cdd434bc0e3d8d4cd64636efc9225672a456df8f6173b0d206d61629d4f1f9843e9ba2a2c97af5939cbc46af5f068a81aef88be6faa41c
6
+ metadata.gz: e48056d32d636cdeb946c1d32703f09242005d897e1fe102d32db95804678340349ed46d54735895dbc9647612a9f4e03bcad7bee3e9ce8ded7c8c7abfb0120f
7
+ data.tar.gz: 37ccca7ab65758e2895c5bceb265b5921cb7bb01ba8a015dcae40facfc119d4dcc2acf6abdb6f1c08bf8925736d8c86a030dcdae735ef2049eb4708b8a656688
@@ -1,14 +1,14 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: ico 0.1.1 ruby lib
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.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-02"
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
- file_size = img_hash[:image_size] + ICO::IconImage::HEADER_SIZE_IN_BYTES
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 = img_hash[:image_size]
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 = entries.join + images.join
69
+ icon_dir.data = entries.join + images.join
70
70
 
71
71
  icon_dir
72
72
  end
@@ -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 => 5669
16
- unsigned :y_pixels_per_meter, 32, nil, :default => 5669
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
 
@@ -1,3 +1,3 @@
1
1
  module ICO
2
- VERSION = '0.1.1'
2
+ VERSION = '0.1.2'
3
3
  end
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.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-02 00:00:00.000000000 Z
11
+ date: 2017-04-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chunky_png