chunky_png 1.3.14 → 1.3.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +1 -1
- data/Gemfile +0 -4
- data/chunky_png.gemspec +2 -0
- data/lib/chunky_png/palette.rb +7 -5
- data/lib/chunky_png/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2e1b3725cfd19b4f97dc6064df132f90f7dd68205a6a1b9dee7d516cbe2add90
|
4
|
+
data.tar.gz: 9f968c18ab17e1b2f66e9613b5368e0c5afdd368de3448384556c8422620efe6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9f7ce3e53cf79c7dd34bb6b9c5da6420dd2d0d7814975a3cd35bc563cb95963355a29af0b3823cfa65667408a8d9173e18c1b5f0460b3abdfe5376c1d7cbb932
|
7
|
+
data.tar.gz: 9ecf4c44876ddfa9acc9fbfdc0d074abdeee3fb148c2e96036a9d1722f123664ac20bfa5a29f4a3c551961db69c63e9b4ca70e2d1eed857a8f5842b9548707d3
|
data/.github/workflows/ruby.yml
CHANGED
data/Gemfile
CHANGED
data/chunky_png.gemspec
CHANGED
data/lib/chunky_png/palette.rb
CHANGED
@@ -12,7 +12,7 @@ module ChunkyPNG
|
|
12
12
|
# explicit palette (stores as PLTE & tRNS chunks in a PNG file).
|
13
13
|
#
|
14
14
|
# @see ChunkyPNG::Color
|
15
|
-
class Palette <
|
15
|
+
class Palette < Set
|
16
16
|
# Builds a new palette given a set (Enumerable instance) of colors.
|
17
17
|
#
|
18
18
|
# @param enum [Enumerable<Integer>] The set of colors to include in this
|
@@ -21,8 +21,10 @@ module ChunkyPNG
|
|
21
21
|
# which they appeared in the palette chunk, so that this array can be
|
22
22
|
# used for decoding.
|
23
23
|
def initialize(enum, decoding_map = nil)
|
24
|
-
super(enum)
|
24
|
+
super(enum.sort.freeze)
|
25
25
|
@decoding_map = decoding_map if decoding_map
|
26
|
+
@encoding_map = {}
|
27
|
+
freeze
|
26
28
|
end
|
27
29
|
|
28
30
|
# Builds a palette instance from a PLTE chunk and optionally a tRNS chunk
|
@@ -135,7 +137,7 @@ module ChunkyPNG
|
|
135
137
|
# @return [true, false] True if a encoding map was built when this palette
|
136
138
|
# was loaded.
|
137
139
|
def can_encode?
|
138
|
-
!@encoding_map.
|
140
|
+
!@encoding_map.empty?
|
139
141
|
end
|
140
142
|
|
141
143
|
# Returns a color, given the position in the original palette chunk.
|
@@ -176,8 +178,8 @@ module ChunkyPNG
|
|
176
178
|
# @return [ChunkyPNG::Chunk::Palette] The PLTE chunk.
|
177
179
|
# @see ChunkyPNG::Palette#can_encode?
|
178
180
|
def to_plte_chunk
|
179
|
-
@encoding_map
|
180
|
-
colors
|
181
|
+
@encoding_map.clear
|
182
|
+
colors = []
|
181
183
|
|
182
184
|
each_with_index do |color, index|
|
183
185
|
@encoding_map[color] = index
|
data/lib/chunky_png/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chunky_png
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Willem van Bergen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-12-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -446,7 +446,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
446
446
|
requirements:
|
447
447
|
- - ">="
|
448
448
|
- !ruby/object:Gem::Version
|
449
|
-
version:
|
449
|
+
version: 2.0.0
|
450
450
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
451
451
|
requirements:
|
452
452
|
- - ">="
|