gifenc 0.1.0 → 0.2.0
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/.yardopts +1 -1
- data/CHANGELOG.md +36 -0
- data/README.md +7 -2
- data/lib/errors.rb +4 -0
- data/lib/extensions.rb +11 -11
- data/lib/geometry.rb +599 -23
- data/lib/gif.rb +47 -2
- data/lib/gifenc.rb +7 -0
- data/lib/image.rb +808 -115
- data/lib/util.rb +10 -0
- metadata +11 -8
data/lib/util.rb
CHANGED
|
@@ -42,5 +42,15 @@ module Gifenc
|
|
|
42
42
|
rescue
|
|
43
43
|
''.b
|
|
44
44
|
end
|
|
45
|
+
|
|
46
|
+
# Encode data using LZW compliant with GIF specification.
|
|
47
|
+
# @param data [String] Binary string containing the arbitrary data to encode.
|
|
48
|
+
# @param min_bits [Integer] Minimum bits for each LZW code. Should be enough
|
|
49
|
+
# to encode all the symbols present in the data, and at most 12.
|
|
50
|
+
# @return [String] Binary string containing the encoded data.
|
|
51
|
+
def self.lzw_encode(data, min_bits = 8)
|
|
52
|
+
lzw = LZWrb.new(preset: LZWrb::PRESET_GIF, min_bits: min_bits, verbosity: :minimal)
|
|
53
|
+
min_bits.chr + Util.blockify(lzw.encode(data))
|
|
54
|
+
end
|
|
45
55
|
end
|
|
46
56
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: gifenc
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- edelkas
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2024-
|
|
11
|
+
date: 2024-03-05 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: lzwrb
|
|
@@ -27,20 +27,22 @@ dependencies:
|
|
|
27
27
|
description: |2
|
|
28
28
|
This library provides GIF encoding, decoding and editing capabilities natively
|
|
29
29
|
within Ruby. It aims to support the complete GIF specification for both
|
|
30
|
-
encoding and decoding, as well as decent editing functionality, while
|
|
30
|
+
encoding and decoding, as well as having a decent editing functionality, while
|
|
31
31
|
maintaining a succint syntax.
|
|
32
32
|
|
|
33
|
-
The current version is still preliminar, and only encoding is working,
|
|
34
|
-
|
|
35
|
-
tuned if you're interested!
|
|
33
|
+
The current version is still preliminar, and only encoding is working, together
|
|
34
|
+
with a decent drawing suite. The gem is actively developed and decoding will
|
|
35
|
+
soon follow, so stay tuned if you're interested!
|
|
36
36
|
email:
|
|
37
37
|
executables: []
|
|
38
38
|
extensions: []
|
|
39
39
|
extra_rdoc_files:
|
|
40
40
|
- README.md
|
|
41
|
+
- CHANGELOG.md
|
|
41
42
|
- docs/Specification.md
|
|
42
43
|
files:
|
|
43
44
|
- ".yardopts"
|
|
45
|
+
- CHANGELOG.md
|
|
44
46
|
- README.md
|
|
45
47
|
- docs/Specification.md
|
|
46
48
|
- lib/color_table.rb
|
|
@@ -56,7 +58,8 @@ licenses: []
|
|
|
56
58
|
metadata:
|
|
57
59
|
homepage_uri: https://github.com/edelkas/gifenc
|
|
58
60
|
source_code_uri: https://github.com/edelkas/gifenc
|
|
59
|
-
documentation_uri: https://www.rubydoc.info/gems/gifenc
|
|
61
|
+
documentation_uri: https://www.rubydoc.info/gems/gifenc
|
|
62
|
+
changelog_uri: https://github.com/edelkas/gifenc/blob/master/CHANGELOG.md
|
|
60
63
|
post_install_message:
|
|
61
64
|
rdoc_options: []
|
|
62
65
|
require_paths:
|
|
@@ -72,7 +75,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
72
75
|
- !ruby/object:Gem::Version
|
|
73
76
|
version: '0'
|
|
74
77
|
requirements: []
|
|
75
|
-
rubygems_version: 3.1.
|
|
78
|
+
rubygems_version: 3.1.2
|
|
76
79
|
signing_key:
|
|
77
80
|
specification_version: 4
|
|
78
81
|
summary: GIF encoder, decoder and editor in pure Ruby
|