png 1.2.1 → 1.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 6a402194fe1cbe6b3c0046da8f2762b0eb663dfb
4
- data.tar.gz: 3abefbe75ec174dae717a1f951fb1f052fca2a4e
2
+ SHA256:
3
+ metadata.gz: ed4cb5ea785c269b2b1528b2630d99b24a3bc99a06c4a50961dc3c681959a169
4
+ data.tar.gz: f0a06a6423b7159878cbf5ed844e3600e32fec055e9fa46ace12e7d2329a474d
5
5
  SHA512:
6
- metadata.gz: 90dde7c2914c3b20dd54ff1b0bb1a358fffe9896ef5fa13663c44cc3d2dac64e9db53687b7144e7fb14806d009baea163259c51eac8d03e510b2136325f35d1b
7
- data.tar.gz: 00531adf917fae6c8cb8d082189dc40584bbc8152c93ad7d0126c740dd9d1f4e4984ac692402b69b79df378b8c30b482e29831845dac0ebcea8a97186866a833
6
+ metadata.gz: f281dfb508c5c4ccc5bd82b69e69266b8931e198fa0a8deef3b47d3d13e22ca75b66b9df0d4d37ab44b9581fe3db8b9ef74a00f75a274afa6c1da9a0e8e49f0e
7
+ data.tar.gz: 6b9c5ad8ba80a4c8ed527b56c271de1529b541c9b0f4dac533dc1568a2cf9263f3800ff51336de65e6d3aa94f2c7f7747dacbfd852108495716e69858efa95e9
checksums.yaml.gz.sig CHANGED
Binary file
data/History.txt CHANGED
@@ -1,3 +1,18 @@
1
+ === 1.3.0 / 2024-08-27
2
+
3
+ Daaaamn... another 9 years! Means it is really stable, right?
4
+
5
+ * 4 minor enhancements:
6
+
7
+ * Removed a bunch of ancient cruft: getbyte, old 1.8 compile hacks, etc.
8
+ * Removed a bunch of forced deletions of ~/.ruby_inline in test. Cargo culting?
9
+ * Removed binary encoding on all source files and called #b for the few needed binary strings.
10
+ * Removed clean as a dependency for test, speeding up tests 3x.
11
+
12
+ * 1 bug fix:
13
+
14
+ * Fix errors created when string literals are frozen.
15
+
1
16
  === 1.2.1 / 2015-04-13
2
17
 
3
18
  WOW! SIX YEARS!!
data/README.txt CHANGED
@@ -1,6 +1,8 @@
1
1
  = PNG
2
2
 
3
- * http://seattlerb.rubyforge.org/
3
+ home :: https://github.com/seattlerb/png
4
+ bugs :: https://github.com/seattlerb/png/issues
5
+ doco :: http://docs.seattlerb.org/png
4
6
 
5
7
  == DESCRIPTION
6
8
 
@@ -16,18 +18,18 @@ without any C libraries.
16
18
 
17
19
  == SYNOPSIS
18
20
 
19
- require 'png'
20
-
21
+ require "png"
22
+
21
23
  canvas = PNG::Canvas.new 200, 200
22
-
24
+
23
25
  # Set a point to a color
24
26
  canvas[100, 100] = PNG::Color::Black
25
-
27
+
26
28
  # draw an anti-aliased line
27
29
  canvas.line 50, 50, 100, 50, PNG::Color::Blue
28
-
30
+
29
31
  png = PNG.new canvas
30
- png.save 'blah.png'
32
+ png.save "blah.png"
31
33
 
32
34
  == REQUIREMENTS
33
35
 
@@ -37,13 +39,13 @@ without any C libraries.
37
39
 
38
40
  == INSTALL
39
41
 
40
- + sudo gem install -y png
42
+ + sudo gem install png
41
43
 
42
44
  == LICENSE
43
45
 
44
46
  (The MIT License)
45
47
 
46
- Copyright (c) 2006-2007 Ryan Davis, Eric Hodel, Zen Spider Software
48
+ Copyright (c) Ryan Davis, Eric Hodel, Zen Spider Software
47
49
 
48
50
  Permission is hereby granted, free of charge, to any person obtaining
49
51
  a copy of this software and associated documentation files (the
data/Rakefile CHANGED
@@ -6,6 +6,10 @@ Hoe.plugin :isolate
6
6
 
7
7
  Hoe.spec "png" do
8
8
  developer "Ryan Davis", "ryand-ruby@zenspider.com"
9
+
10
+ license "MIT"
9
11
  end
10
12
 
13
+ task(:test).prerequisites.delete "clean" # TODO: consider removing from hoe?
14
+
11
15
  # vim: syntax=Ruby
data/lib/png/font.rb CHANGED
@@ -1,5 +1,3 @@
1
- # encoding: BINARY
2
-
3
1
  require "png/reader"
4
2
 
5
3
  ##
data/lib/png/pie.rb CHANGED
@@ -1,5 +1,3 @@
1
- # encoding: BINARY
2
-
3
1
  require "png"
4
2
 
5
3
  class PNG
data/lib/png/reader.rb CHANGED
@@ -1,5 +1,3 @@
1
- # encoding: BINARY
2
-
3
1
  require "png"
4
2
  require "enumerator"
5
3
 
data/lib/png.rb CHANGED
@@ -1,15 +1,6 @@
1
- # encoding: BINARY
2
-
3
- require "rubygems"
4
1
  require "zlib"
5
2
  require "inline"
6
3
 
7
- unless "".respond_to? :getbyte then
8
- class String
9
- alias :getbyte :[]
10
- end
11
- end
12
-
13
4
  class String # :nodoc: # ZenTest SKIP
14
5
  inline do |builder|
15
6
  builder.c <<-EOM
@@ -98,7 +89,7 @@ end
98
89
  # bottom left.
99
90
 
100
91
  class PNG
101
- VERSION = "1.2.1"
92
+ VERSION = "1.3.0"
102
93
  SIGNATURE = [137, 80, 78, 71, 13, 10, 26, 10].pack("C*")
103
94
 
104
95
  # Color Types:
@@ -117,13 +108,6 @@ class PNG
117
108
 
118
109
  begin
119
110
  inline do |builder|
120
- if RUBY_VERSION < "1.8.6" then
121
- builder.prefix <<-EOM
122
- #define RARRAY_PTR(s) (RARRAY(s)->ptr)
123
- #define RARRAY_LEN(s) (RARRAY(s)->len)
124
- EOM
125
- end
126
-
127
111
  builder.c <<-EOM
128
112
  VALUE png_join() {
129
113
  size_t i, j;
@@ -153,7 +137,7 @@ class PNG
153
137
  end
154
138
  rescue CompilationError
155
139
  def png_join
156
- @data.map { |row| "\0" + row.map(&:values).join }.join
140
+ @data.map { |row| "\0".b + row.map(&:values).join }.join
157
141
  end
158
142
  end
159
143
 
@@ -204,7 +188,7 @@ class PNG
204
188
 
205
189
  class Color
206
190
 
207
- MAX=255
191
+ MAX = 0xFF
208
192
 
209
193
  attr_reader :values
210
194
 
@@ -214,7 +198,7 @@ class PNG
214
198
 
215
199
  def self.from str, name = nil
216
200
  str = "%08x" % str if Integer === str
217
- colors = str.scan(/[\da-f][\da-f]/i).map(&:hex)
201
+ colors = str.scan(/\h\h/i).map(&:hex)
218
202
  colors << name
219
203
  self.new(*colors)
220
204
  end
@@ -223,7 +207,7 @@ class PNG
223
207
  # Creates a new color with values +red+, +green+, +blue+, and +alpha+.
224
208
 
225
209
  def initialize red, green, blue, alpha = MAX, name = nil
226
- @values = "%c%c%c%c" % [red, green, blue, alpha]
210
+ @values = "%c%c%c%c" % [red, green, blue, alpha].map(&:chr)
227
211
  @name = name
228
212
  end
229
213
 
@@ -294,8 +278,10 @@ class PNG
294
278
  # Blends +color+ into this color returning a new blended color.
295
279
 
296
280
  def blend color
297
- Color.new(((r + color.r) / 2), ((g + color.g) / 2),
298
- ((b + color.b) / 2), ((a + color.a) / 2))
281
+ Color.new(((r + color.r) / 2),
282
+ ((g + color.g) / 2),
283
+ ((b + color.b) / 2),
284
+ ((a + color.a) / 2))
299
285
  end
300
286
 
301
287
  ##
data/test/test_png.rb CHANGED
@@ -1,13 +1,3 @@
1
- # encoding: ascii-8bit
2
-
3
- dir = File.expand_path "~/.ruby_inline"
4
- if File.directory? dir then
5
- require "fileutils"
6
- puts "nuking #{dir}"
7
- # force removal, Windoze is bitching at me, something to hunt later...
8
- FileUtils.rm_r dir, :force => true
9
- end
10
-
11
1
  require "minitest/autorun"
12
2
  require "rubygems"
13
3
  require "png"
@@ -28,10 +18,10 @@ jwUwDGVBALuJxzlQugpEAAAAAElFTkSuQmCC
28
18
  def test_class_chunk
29
19
  chunk = PNG.chunk "IHDR", [10, 10, 8, 6, 0, 0, 0].pack("N2C5")
30
20
 
31
- header_crc = "\2152\317\275"
32
- header_data = "\000\000\000\n\000\000\000\n\b\006\000\000\000"
33
- header_length = "\000\000\000\r"
34
- header_chunk = "#{header_length}IHDR#{header_data}#{header_crc}"
21
+ header_crc = "\2152\317\275".b
22
+ header_data = "\000\000\000\n\000\000\000\n\b\006\000\000\000".b
23
+ header_length = "\000\000\000\r".b
24
+ header_chunk = "#{header_length}IHDR#{header_data}#{header_crc}".b
35
25
 
36
26
  assert_equal header_chunk, chunk
37
27
  end
@@ -490,32 +480,26 @@ class TestPng::TestPie < Minitest::Test
490
480
  assert_equal expected, actual.to_s
491
481
  end
492
482
 
493
- def util_angle expect, x, y
483
+ def assert_angle expect, x, y
494
484
  actual = PNG.angle(x, y)
495
- case expect
496
- when Integer then
497
- assert_equal(expect, actual,
498
- "[#{x}, #{y}] should be == #{expect}, was #{actual}")
499
- else
500
- assert_in_delta(expect, actual, 0.5)
501
- end
485
+ assert_in_epsilon expect, actual
502
486
  end
503
487
 
504
488
  def test_math_is_hard_lets_go_shopping
505
- util_angle 0, 0, 0
489
+ assert_angle 0, 0, 0
506
490
  (25..500).step(25) do |n|
507
- util_angle 0, 0, n
508
- util_angle 90, n, 0
509
- util_angle 180, 0, -n
510
- util_angle 270, -n, 0
491
+ assert_angle 0, 0, n
492
+ assert_angle 90, n, 0
493
+ assert_angle 180, 0, -n
494
+ assert_angle 270, -n, 0
511
495
  end
512
496
 
513
- util_angle 359.5, -1, 250
514
- util_angle 0.0, 0, 250
515
- util_angle 0.5, 1, 250
497
+ assert_angle 359.5, -1, 250
498
+ assert_angle 0.0, 0, 250
499
+ assert_angle 0.2292, 1, 250
516
500
 
517
- util_angle 89.5, 250, 1
518
- util_angle 90.0, 250, 0
519
- util_angle 90.5, 250, -1
501
+ assert_angle 89.77, 250, 1
502
+ assert_angle 90.0, 250, 0
503
+ assert_angle 90.23, 250, -1
520
504
  end
521
505
  end
@@ -1,11 +1,3 @@
1
- dir = File.expand_path "~/.ruby_inline"
2
- if File.directory? dir then
3
- require "fileutils"
4
- puts "nuking #{dir}"
5
- # force removal, Windoze is bitching at me, something to hunt later...
6
- FileUtils.rm_r dir, :force => true
7
- end
8
-
9
1
  require "rubygems"
10
2
  require "minitest/autorun"
11
3
  require "png/font"
@@ -1,11 +1,3 @@
1
- dir = File.expand_path "~/.ruby_inline"
2
- if File.directory? dir then
3
- require "fileutils"
4
- puts "nuking #{dir}"
5
- # force removal, Windoze is bitching at me, something to hunt later...
6
- FileUtils.rm_r dir, :force => true
7
- end
8
-
9
1
  require "rubygems"
10
2
  require "minitest/autorun"
11
3
  require "png/reader"
@@ -41,7 +33,7 @@ jwUwDGVBALuJxzlQugpEAAAAAElFTkSuQmCC
41
33
  end
42
34
 
43
35
  def test_class_read_chunk
44
- data = PNG.read_chunk "IHDR", @IHDR_chunk
36
+ data = PNG.read_chunk "IHDR", @IHDR_chunk.dup
45
37
 
46
38
  assert_equal @IHDR_data, data
47
39
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,18 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: png
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Davis
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain:
11
11
  - |
12
12
  -----BEGIN CERTIFICATE-----
13
- MIIDPjCCAiagAwIBAgIBAjANBgkqhkiG9w0BAQUFADBFMRMwEQYDVQQDDApyeWFu
13
+ MIIDPjCCAiagAwIBAgIBCDANBgkqhkiG9w0BAQsFADBFMRMwEQYDVQQDDApyeWFu
14
14
  ZC1ydWJ5MRkwFwYKCZImiZPyLGQBGRYJemVuc3BpZGVyMRMwEQYKCZImiZPyLGQB
15
- GRYDY29tMB4XDTE0MDkxNzIzMDcwN1oXDTE1MDkxNzIzMDcwN1owRTETMBEGA1UE
15
+ GRYDY29tMB4XDTI0MDEwMjIxMjEyM1oXDTI1MDEwMTIxMjEyM1owRTETMBEGA1UE
16
16
  AwwKcnlhbmQtcnVieTEZMBcGCgmSJomT8ixkARkWCXplbnNwaWRlcjETMBEGCgmS
17
17
  JomT8ixkARkWA2NvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALda
18
18
  b9DCgK+627gPJkB6XfjZ1itoOQvpqH1EXScSaba9/S2VF22VYQbXU1xQXL/WzCkx
@@ -21,72 +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TTeW
30
+ deKfBjgVAq7EYHu1AczzlUly
31
31
  -----END CERTIFICATE-----
32
- date: 2015-04-13 00:00:00.000000000 Z
32
+ date: 2024-08-27 00:00:00.000000000 Z
33
33
  dependencies:
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: RubyInline
36
36
  requirement: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '3.9'
41
41
  type: :runtime
42
42
  prerelease: false
43
43
  version_requirements: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '3.9'
48
- - !ruby/object:Gem::Dependency
49
- name: minitest
50
- requirement: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ~>
53
- - !ruby/object:Gem::Version
54
- version: '5.6'
55
- type: :development
56
- prerelease: false
57
- version_requirements: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - ~>
60
- - !ruby/object:Gem::Version
61
- version: '5.6'
62
48
  - !ruby/object:Gem::Dependency
63
49
  name: rdoc
64
50
  requirement: !ruby/object:Gem::Requirement
65
51
  requirements:
66
- - - ~>
52
+ - - ">="
67
53
  - !ruby/object:Gem::Version
68
54
  version: '4.0'
55
+ - - "<"
56
+ - !ruby/object:Gem::Version
57
+ version: '7'
69
58
  type: :development
70
59
  prerelease: false
71
60
  version_requirements: !ruby/object:Gem::Requirement
72
61
  requirements:
73
- - - ~>
62
+ - - ">="
74
63
  - !ruby/object:Gem::Version
75
64
  version: '4.0'
65
+ - - "<"
66
+ - !ruby/object:Gem::Version
67
+ version: '7'
76
68
  - !ruby/object:Gem::Dependency
77
69
  name: hoe
78
70
  requirement: !ruby/object:Gem::Requirement
79
71
  requirements:
80
- - - ~>
72
+ - - "~>"
81
73
  - !ruby/object:Gem::Version
82
- version: '3.13'
74
+ version: '4.2'
83
75
  type: :development
84
76
  prerelease: false
85
77
  version_requirements: !ruby/object:Gem::Requirement
86
78
  requirements:
87
- - - ~>
79
+ - - "~>"
88
80
  - !ruby/object:Gem::Version
89
- version: '3.13'
81
+ version: '4.2'
90
82
  description: |-
91
83
  PNG is an almost-pure-ruby PNG library. It lets you write a PNG
92
84
  without any C libraries.
@@ -99,7 +91,6 @@ extra_rdoc_files:
99
91
  - Manifest.txt
100
92
  - README.txt
101
93
  files:
102
- - .gemtest
103
94
  - History.txt
104
95
  - Manifest.txt
105
96
  - README.txt
@@ -115,30 +106,32 @@ files:
115
106
  - test/test_png.rb
116
107
  - test/test_png_font.rb
117
108
  - test/test_png_reader.rb
118
- homepage: http://seattlerb.rubyforge.org/
109
+ homepage: https://github.com/seattlerb/png
119
110
  licenses:
120
111
  - MIT
121
- metadata: {}
122
- post_install_message:
112
+ metadata:
113
+ homepage_uri: https://github.com/seattlerb/png
114
+ bug_tracker_uri: https://github.com/seattlerb/png/issues
115
+ documentation_uri: http://docs.seattlerb.org/png
116
+ post_install_message:
123
117
  rdoc_options:
124
- - --main
118
+ - "--main"
125
119
  - README.txt
126
120
  require_paths:
127
121
  - lib
128
122
  required_ruby_version: !ruby/object:Gem::Requirement
129
123
  requirements:
130
- - - '>='
124
+ - - ">="
131
125
  - !ruby/object:Gem::Version
132
126
  version: '0'
133
127
  required_rubygems_version: !ruby/object:Gem::Requirement
134
128
  requirements:
135
- - - '>='
129
+ - - ">="
136
130
  - !ruby/object:Gem::Version
137
131
  version: '0'
138
132
  requirements: []
139
- rubyforge_project:
140
- rubygems_version: 2.4.5
141
- signing_key:
133
+ rubygems_version: 3.5.15
134
+ signing_key:
142
135
  specification_version: 4
143
136
  summary: PNG is an almost-pure-ruby PNG library
144
137
  test_files: []
metadata.gz.sig CHANGED
@@ -1 +1,2 @@
1
- v������e�\�&9uO�f�4YgkS����[K�R���`�4���k��y�+���G綘�j���C/c�L|S�B3.Zp��2��I����[����ER��%vy&�k.� ���XV ��'}�o�o��xo
1
+
2
+ ��4KvD�A�k�����s�wV��4x�m�~��U_���`%�;&�;��% nL��l}��Cq�r�!J�2R�����?�mIwa�6�{"�|�����.p�`8gjb�Hd�an(y��pzF?��3��x��z`����#�=�A��������^����C3���Sg�2�.O(�O���d�5C�e(1
data/.gemtest DELETED
File without changes