pura-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/README.md +8 -3
- data/lib/pura/ico/image.rb +5 -0
- data/lib/pura/ico/version.rb +1 -1
- metadata +24 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9a2d1d14aad55bdd2eab259bafcc3c4fb8b3d148271047ce6d12525921cdb883
|
|
4
|
+
data.tar.gz: 040c70393b9c845a0d3460bb8923d321860b4d6df92213b35661826e862c5c33
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 437180a4114a560e9af549d2cb2e2a1b7d1f7786f3e9605b06f35cb79c4c536a2cf6bde1b7e17f6170ef35486863d63a233a461bdaee4738027a31cdfad4bd1c
|
|
7
|
+
data.tar.gz: 6dbcc74ea00978b4534edba9ce1f10dcd9d1befe8112ace3160e843b222619e80812163ea09eb68ae90fc62d7147209f6e140763ee74acd7cb1a1dc8a9b33ada
|
data/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# pura-ico
|
|
2
2
|
|
|
3
|
-
A pure Ruby ICO decoder/encoder
|
|
3
|
+
A pure Ruby ICO decoder/encoder without additional image-processing libraries.
|
|
4
4
|
|
|
5
5
|
Part of the **pura-*** series — pure Ruby image codec gems.
|
|
6
6
|
|
|
@@ -10,7 +10,7 @@ Part of the **pura-*** series — pure Ruby image codec gems.
|
|
|
10
10
|
- Handles both BMP-style and PNG-style icon entries
|
|
11
11
|
- Multiple icon sizes in a single file
|
|
12
12
|
- Image resizing (bilinear / nearest-neighbor / fit / fill)
|
|
13
|
-
- No native
|
|
13
|
+
- No image-specific native extension or FFI dependency
|
|
14
14
|
- CLI tool included
|
|
15
15
|
|
|
16
16
|
## Installation
|
|
@@ -47,7 +47,6 @@ pura-ico decode favicon.ico --info
|
|
|
47
47
|
## Why pure Ruby?
|
|
48
48
|
|
|
49
49
|
- **`gem install` and go** — no `brew install`, no `apt install`, no C compiler needed
|
|
50
|
-
- **Works everywhere Ruby works** — CRuby, ruby.wasm, JRuby, TruffleRuby
|
|
51
50
|
- **Both BMP and PNG entries** — handles all common ICO formats
|
|
52
51
|
- **Part of pura-\*** — convert between JPEG, PNG, BMP, GIF, TIFF, WebP, ICO seamlessly
|
|
53
52
|
|
|
@@ -64,6 +63,12 @@ pura-ico decode favicon.ico --info
|
|
|
64
63
|
| [pura-webp](https://github.com/komagata/pura-webp) | WebP | ✅ Available |
|
|
65
64
|
| [pura-image](https://github.com/komagata/pura-image) | All formats | ✅ Available |
|
|
66
65
|
|
|
66
|
+
## Pixel model and limitations
|
|
67
|
+
|
|
68
|
+
Images contain 8-bit RGB pixels. Decoded pixels are RGB and do not retain transparency. CUR input can be decoded, but the encoder writes ICO only and has no CUR hotspot API.
|
|
69
|
+
|
|
70
|
+
`crop(x, y, width, height)` requires integer coordinates, positive dimensions, and a region entirely inside the image; invalid regions raise `ArgumentError`.
|
|
71
|
+
|
|
67
72
|
## License
|
|
68
73
|
|
|
69
74
|
MIT
|
data/lib/pura/ico/image.rb
CHANGED
|
@@ -81,6 +81,11 @@ module Pura
|
|
|
81
81
|
end
|
|
82
82
|
|
|
83
83
|
def crop(x, y, w, h)
|
|
84
|
+
unless [x, y, w, h].all?(Integer) &&
|
|
85
|
+
x >= 0 && y >= 0 && w.positive? && h.positive? && x + w <= @width && y + h <= @height
|
|
86
|
+
raise ArgumentError, "crop must be a positive integer region within the image"
|
|
87
|
+
end
|
|
88
|
+
|
|
84
89
|
out = String.new(encoding: Encoding::BINARY, capacity: w * h * 3)
|
|
85
90
|
h.times do |row|
|
|
86
91
|
src_offset = (((y + row) * @width) + x) * 3
|
data/lib/pura/ico/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: pura-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
|
- komagata
|
|
@@ -9,6 +9,26 @@ bindir: bin
|
|
|
9
9
|
cert_chain: []
|
|
10
10
|
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: pura-png
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
- - "~>"
|
|
17
|
+
- !ruby/object:Gem::Version
|
|
18
|
+
version: '0.1'
|
|
19
|
+
- - ">="
|
|
20
|
+
- !ruby/object:Gem::Version
|
|
21
|
+
version: 0.1.1
|
|
22
|
+
type: :runtime
|
|
23
|
+
prerelease: false
|
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
25
|
+
requirements:
|
|
26
|
+
- - "~>"
|
|
27
|
+
- !ruby/object:Gem::Version
|
|
28
|
+
version: '0.1'
|
|
29
|
+
- - ">="
|
|
30
|
+
- !ruby/object:Gem::Version
|
|
31
|
+
version: 0.1.1
|
|
12
32
|
- !ruby/object:Gem::Dependency
|
|
13
33
|
name: minitest
|
|
14
34
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -37,7 +57,7 @@ dependencies:
|
|
|
37
57
|
- - "~>"
|
|
38
58
|
- !ruby/object:Gem::Version
|
|
39
59
|
version: '13.0'
|
|
40
|
-
description: A
|
|
60
|
+
description: A Ruby ICO/CUR decoder and ICO encoder using pura-png for PNG entries.
|
|
41
61
|
Supports BMP and PNG icon entries, multiple bit depths, and multi-size ICO files.
|
|
42
62
|
executables:
|
|
43
63
|
- pura-ico
|
|
@@ -52,7 +72,7 @@ files:
|
|
|
52
72
|
- lib/pura/ico/encoder.rb
|
|
53
73
|
- lib/pura/ico/image.rb
|
|
54
74
|
- lib/pura/ico/version.rb
|
|
55
|
-
homepage: https://github.com/komagata/
|
|
75
|
+
homepage: https://github.com/komagata/pura-ico
|
|
56
76
|
licenses:
|
|
57
77
|
- MIT
|
|
58
78
|
metadata: {}
|
|
@@ -72,5 +92,5 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
72
92
|
requirements: []
|
|
73
93
|
rubygems_version: 3.6.9
|
|
74
94
|
specification_version: 4
|
|
75
|
-
summary: Pure Ruby ICO/CUR decoder
|
|
95
|
+
summary: Pure Ruby ICO encoder and ICO/CUR decoder
|
|
76
96
|
test_files: []
|