chunky_png 1.3.12 → 1.3.13

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
  SHA256:
3
- metadata.gz: e3886829e15fc95fe5233136b1f7ecd373b6996aa7d272ea23a7118b2f686da9
4
- data.tar.gz: f43c2996448bce3e0dd614b19e228ead043be3f1fbc60ca128d7a242f4f74692
3
+ metadata.gz: 3700be7193fc5c0b3d545244b775b347ab31a3d87b41833eb9130bfb333350e3
4
+ data.tar.gz: 910e7069e1a5a5d55df088a27d65a88abb04d0f631641f96665e46eb9c6af633
5
5
  SHA512:
6
- metadata.gz: 610eacb3d1e369c824bd4b7e9305358790be1837281be84f44ff12e4020bced6fd9ef44b10391578eb74b50a0e28b24595ac0aa64b82433477a05b43a37bd491
7
- data.tar.gz: e4857a8bb6217e5416b93bcd125dd7e99a90f0bb2714628016d6e44af9b34a03230913e30955a4f72ff2005fb9b9e6f50d1087d6cb89d9370cc735288d98193b
6
+ metadata.gz: 5e1779c275eb27fdbf03ffdd94859ab3a781206e16ad71638aa43d7912e520ca34385e815117801752038bd6027fec87660931b8ed596685c41ee65993276b19
7
+ data.tar.gz: 75ea37b5c3995bf899ee17bfca07983366a8311e64da2261aa6a67573ddf6d21270e2b3a5b9051c79a8c08ee4220ab184722ee32fd4215adbe30cd39e3fb8709
@@ -0,0 +1,35 @@
1
+ # This workflow uses actions that are not certified by GitHub.
2
+ # They are provided by a third-party and are governed by
3
+ # separate terms of service, privacy policy, and support
4
+ # documentation.
5
+ # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
+ # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
+
8
+ name: Ruby
9
+
10
+ on:
11
+ push:
12
+ branches: ["master"]
13
+ pull_request:
14
+ branches: ["master"]
15
+
16
+ jobs:
17
+ test:
18
+ runs-on: ubuntu-latest
19
+ strategy:
20
+ matrix:
21
+ ruby: [ '2.5', '2.6', '2.7' ]
22
+
23
+ steps:
24
+ - uses: actions/checkout@v2
25
+ - name: Set up Ruby
26
+ uses: ruby/setup-ruby@v1
27
+ with:
28
+ ruby-version: ${{ matrix.ruby }}
29
+ - name: Install dependencies
30
+ run: bundle install
31
+ - name: Run tests
32
+ run: bin/rake
33
+ # Skip the linter for now.
34
+ # - name: Lint Ruby code
35
+ # run: bin/standardrb
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen-string-literal: true
2
+
1
3
  source "https://rubygems.org"
2
4
  gemspec
3
5
 
data/Rakefile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen-string-literal: true
2
+
1
3
  require "bundler/gem_tasks"
2
4
  require "rspec/core/rake_task"
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen-string-literal: true
2
+
1
3
  lib = File.expand_path("../lib", __FILE__)
2
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
5
  require "chunky_png/version"
@@ -1,3 +1,5 @@
1
+ # frozen-string-literal: true
2
+
1
3
  # Basic requirements from standard library
2
4
  require "set"
3
5
  require "zlib"
@@ -138,16 +140,10 @@ module ChunkyPNG
138
140
  class UnitsUnknown < ChunkyPNG::Exception
139
141
  end
140
142
 
141
- # Empty byte array. This basically is an empty string, but with the encoding
142
- # set correctly to ASCII-8BIT (binary) in Ruby 1.9.
143
- # @return [String] An empty string, with encoding set to binary in Ruby 1.9
144
- # @private
145
- EMPTY_BYTEARRAY = "".force_encoding(Encoding::BINARY).freeze
146
-
147
143
  # Null-byte, with the encoding set correctly to ASCII-8BIT (binary) in Ruby 1.9.
148
144
  # @return [String] A binary string, consisting of one NULL-byte.
149
145
  # @private
150
- EXTRA_BYTE = "\0".force_encoding(Encoding::BINARY).freeze
146
+ EXTRA_BYTE = "\0".b
151
147
  end
152
148
 
153
149
  require "chunky_png/version"
@@ -1,3 +1,5 @@
1
+ # frozen-string-literal: true
2
+
1
3
  require "chunky_png/canvas/png_encoding"
2
4
  require "chunky_png/canvas/png_decoding"
3
5
  require "chunky_png/canvas/adam7_interlacing"
@@ -1,3 +1,5 @@
1
+ # frozen-string-literal: true
2
+
1
3
  module ChunkyPNG
2
4
  class Canvas
3
5
  # Methods for decoding and encoding Adam7 interlacing.
@@ -1,3 +1,5 @@
1
+ # frozen-string-literal: true
2
+
1
3
  module ChunkyPNG
2
4
  class Canvas
3
5
  # Methods to export a canvas to a PNG data URL.
@@ -1,3 +1,5 @@
1
+ # frozen-string-literal: true
2
+
1
3
  module ChunkyPNG
2
4
  class Canvas
3
5
  # Methods to import a canvas from a PNG data URL.
@@ -1,3 +1,5 @@
1
+ # frozen-string-literal: true
2
+
1
3
  module ChunkyPNG
2
4
  class Canvas
3
5
  # Module that adds some primitive drawing methods to {ChunkyPNG::Canvas}.
@@ -1,3 +1,5 @@
1
+ # frozen-string-literal: true
2
+
1
3
  module ChunkyPNG
2
4
  class Canvas
3
5
  # The ChunkyPNG::Canvas::Masking module defines methods to perform masking
@@ -1,3 +1,5 @@
1
+ # frozen-string-literal: true
2
+
1
3
  module ChunkyPNG
2
4
  class Canvas
3
5
  # The ChunkyPNG::Canvas::Operations module defines methods to perform
@@ -1,3 +1,5 @@
1
+ # frozen-string-literal: true
2
+
1
3
  module ChunkyPNG
2
4
  class Canvas
3
5
  # The PNGDecoding contains methods for decoding PNG datastreams to create a
@@ -270,7 +272,7 @@ module ChunkyPNG
270
272
  # @params (see #decode_png_pixels_from_scanline_indexed_1bit)
271
273
  # @return (see #decode_png_pixels_from_scanline_indexed_1bit)
272
274
  def decode_png_pixels_from_scanline_truecolor_8bit(stream, pos, width, _decoding_palette)
273
- stream.unpack("@#{pos + 1}" << ("NX" * width)).map { |c| c | 0x000000ff }
275
+ stream.unpack("@#{pos + 1}#{"NX" * width}").map { |c| c | 0x000000ff }
274
276
  end
275
277
 
276
278
  # Decodes a scanline of a 16-bit, true color image into a row of pixels.
@@ -1,3 +1,5 @@
1
+ # frozen-string-literal: true
2
+
1
3
  module ChunkyPNG
2
4
  class Canvas
3
5
  # Methods for encoding a Canvas instance into a PNG datastream.
@@ -171,7 +173,7 @@ module ChunkyPNG
171
173
  # @param [Integer] filtering The filtering method to use.
172
174
  # @return [String] The PNG encoded canvas as string.
173
175
  def encode_png_image_without_interlacing(color_mode, bit_depth = 8, filtering = ChunkyPNG::FILTER_NONE)
174
- stream = ChunkyPNG::Datastream.empty_bytearray
176
+ stream = "".b
175
177
  encode_png_image_pass_to_stream(stream, color_mode, bit_depth, filtering)
176
178
  stream
177
179
  end
@@ -187,7 +189,7 @@ module ChunkyPNG
187
189
  # @param [Integer] filtering The filtering method to use.
188
190
  # @return [String] The PNG encoded canvas as string.
189
191
  def encode_png_image_with_interlacing(color_mode, bit_depth = 8, filtering = ChunkyPNG::FILTER_NONE)
190
- stream = ChunkyPNG::Datastream.empty_bytearray
192
+ stream = "".b
191
193
  0.upto(6) do |pass|
192
194
  subcanvas = self.class.adam7_extract_pass(pass, self)
193
195
  subcanvas.encoding_palette = encoding_palette
@@ -1,3 +1,5 @@
1
+ # frozen-string-literal: true
2
+
1
3
  module ChunkyPNG
2
4
  class Canvas
3
5
  # The ChunkyPNG::Canvas::Resampling module defines methods to perform image resampling to
@@ -1,3 +1,5 @@
1
+ # frozen-string-literal: true
2
+
1
3
  module ChunkyPNG
2
4
  class Canvas
3
5
  # Methods to save load a canvas from to stream, encoded in RGB, RGBA, BGR or ABGR format.
@@ -1,3 +1,5 @@
1
+ # frozen-string-literal: true
2
+
1
3
  module ChunkyPNG
2
4
  class Canvas
3
5
  # Methods to quickly load a canvas from a stream, encoded in RGB, RGBA, BGR or ABGR format.
@@ -51,7 +53,7 @@ module ChunkyPNG
51
53
  def from_bgr_stream(width, height, stream)
52
54
  string = ChunkyPNG::EXTRA_BYTE.dup # Add a first byte to the first BGR triple.
53
55
  string << (stream.respond_to?(:read) ? stream.read(3 * width * height) : stream.to_s[0, 3 * width * height])
54
- pixels = string.unpack("@1" << ("XV" * (width * height))).map { |color| color | 0x000000ff }
56
+ pixels = string.unpack("@1#{"XV" * (width * height)}").map { |color| color | 0x000000ff }
55
57
  new(width, height, pixels)
56
58
  end
57
59
 
@@ -1,3 +1,5 @@
1
+ # frozen-string-literal: true
2
+
1
3
  module ChunkyPNG
2
4
  # A PNG datastream consists of multiple chunks. This module, and the classes
3
5
  # contained within, help with handling these chunks. It supports both reading
@@ -186,7 +188,7 @@ module ChunkyPNG
186
188
  # Returns an empty string, because this chunk should always be empty.
187
189
  # @return [""] An empty string.
188
190
  def content
189
- ChunkyPNG::Datastream.empty_bytearray
191
+ "".b
190
192
  end
191
193
  end
192
194
 
@@ -1,3 +1,5 @@
1
+ # frozen-string-literal: true
2
+
1
3
  module ChunkyPNG
2
4
  # Factory method to return a color value, based on the arguments given.
3
5
  #
@@ -1,3 +1,5 @@
1
+ # frozen-string-literal: true
2
+
1
3
  module ChunkyPNG
2
4
  # The Datastream class represents a PNG formatted datastream. It supports
3
5
  # both reading from and writing to strings, streams and files.
@@ -9,7 +11,7 @@ module ChunkyPNG
9
11
  # @see ChunkyPNG::Chunk
10
12
  class Datastream
11
13
  # The signature that each PNG file or stream should begin with.
12
- SIGNATURE = [137, 80, 78, 71, 13, 10, 26, 10].pack("C8").force_encoding(Encoding::BINARY).freeze
14
+ SIGNATURE = [137, 80, 78, 71, 13, 10, 26, 10].pack("C8").force_encoding(::Encoding::BINARY).freeze
13
15
 
14
16
  # The header chunk of this datastream.
15
17
  # @return [ChunkyPNG::Chunk::Header]
@@ -72,7 +74,7 @@ module ChunkyPNG
72
74
  # @param [IO] io The stream to read from.
73
75
  # @return [ChunkyPNG::Datastream] The loaded datastream instance.
74
76
  def from_io(io)
75
- io.set_encoding(Encoding::BINARY)
77
+ io.set_encoding(::Encoding::BINARY)
76
78
  verify_signature!(io)
77
79
 
78
80
  ds = new
@@ -156,12 +158,6 @@ module ChunkyPNG
156
158
  # WRITING DATASTREAMS
157
159
  ##################################################################################
158
160
 
159
- # Returns an empty stream using binary encoding that can be used as stream to encode to.
160
- # @return [String] An empty, binary string.
161
- def self.empty_bytearray
162
- ChunkyPNG::EMPTY_BYTEARRAY.dup
163
- end
164
-
165
161
  # Writes the datastream to the given output stream.
166
162
  # @param [IO] io The output stream to write to.
167
163
  def write(io)
@@ -1,3 +1,5 @@
1
+ # frozen-string-literal: true
2
+
1
3
  module ChunkyPNG
2
4
  # Creates a {ChunkyPNG::Dimension} instance using arguments that can be interpreted
3
5
  # as width and height.
@@ -1,3 +1,5 @@
1
+ # frozen-string-literal: true
2
+
1
3
  module ChunkyPNG
2
4
  # ChunkyPNG::Image is an extension of the {ChunkyPNG::Canvas} class, that
3
5
  # also includes support for metadata.
@@ -1,3 +1,5 @@
1
+ # frozen-string-literal: true
2
+
1
3
  module ChunkyPNG
2
4
  # A palette describes the set of colors that is being used for an image.
3
5
  #
@@ -1,3 +1,5 @@
1
+ # frozen-string-literal: true
2
+
1
3
  module ChunkyPNG
2
4
  # Factory method to create {ChunkyPNG::Point} instances.
3
5
  #
@@ -1,3 +1,5 @@
1
+ # frozen-string-literal: true
2
+
1
3
  require "rmagick"
2
4
 
3
5
  module ChunkyPNG
@@ -1,3 +1,5 @@
1
+ # frozen-string-literal: true
2
+
1
3
  module ChunkyPNG
2
4
  # Factory method for {ChunkyPNG::Vector} instances.
3
5
  #
@@ -1,5 +1,7 @@
1
+ # frozen-string-literal: true
2
+
1
3
  module ChunkyPNG
2
4
  # The current version of ChunkyPNG.
3
5
  # Set it and commit the change this before running rake release.
4
- VERSION = "1.3.12"
6
+ VERSION = "1.3.13"
5
7
  end
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.12
4
+ version: 1.3.13
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-08-03 00:00:00.000000000 Z
11
+ date: 2020-10-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -93,9 +93,9 @@ extra_rdoc_files:
93
93
  - CONTRIBUTING.rdoc
94
94
  - CHANGELOG.rdoc
95
95
  files:
96
+ - ".github/workflows/ruby.yml"
96
97
  - ".gitignore"
97
98
  - ".standard.yml"
98
- - ".travis.yml"
99
99
  - ".yardopts"
100
100
  - BENCHMARKING.rdoc
101
101
  - CHANGELOG.rdoc
@@ -1,18 +0,0 @@
1
- language: ruby
2
-
3
- script:
4
- - bin/rake
5
- - bin/standardrb
6
-
7
- rvm:
8
- - "2.2"
9
- - "2.3"
10
- - "2.4"
11
- - "2.5"
12
- - "2.6"
13
- - ruby-head
14
- - jruby-19mode
15
-
16
- matrix:
17
- allow_failures:
18
- - rvm: ruby-head