png 1.2.1 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- checksums.yaml.gz.sig +0 -0
- data/History.txt +15 -0
- data/README.txt +11 -9
- data/Rakefile +4 -0
- data/lib/png/font.rb +0 -2
- data/lib/png/pie.rb +0 -2
- data/lib/png/reader.rb +0 -2
- data/lib/png.rb +9 -23
- data/test/test_png.rb +17 -33
- data/test/test_png_font.rb +0 -8
- data/test/test_png_reader.rb +1 -9
- data.tar.gz.sig +0 -0
- metadata +37 -44
- metadata.gz.sig +2 -1
- data/.gemtest +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: ed4cb5ea785c269b2b1528b2630d99b24a3bc99a06c4a50961dc3c681959a169
|
4
|
+
data.tar.gz: f0a06a6423b7159878cbf5ed844e3600e32fec055e9fa46ace12e7d2329a474d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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
|
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
|
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
|
42
|
+
+ sudo gem install png
|
41
43
|
|
42
44
|
== LICENSE
|
43
45
|
|
44
46
|
(The MIT License)
|
45
47
|
|
46
|
-
Copyright (c)
|
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
data/lib/png/font.rb
CHANGED
data/lib/png/pie.rb
CHANGED
data/lib/png/reader.rb
CHANGED
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.
|
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=
|
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(
|
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),
|
298
|
-
((
|
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
|
483
|
+
def assert_angle expect, x, y
|
494
484
|
actual = PNG.angle(x, y)
|
495
|
-
|
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
|
-
|
489
|
+
assert_angle 0, 0, 0
|
506
490
|
(25..500).step(25) do |n|
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
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
|
-
|
514
|
-
|
515
|
-
|
497
|
+
assert_angle 359.5, -1, 250
|
498
|
+
assert_angle 0.0, 0, 250
|
499
|
+
assert_angle 0.2292, 1, 250
|
516
500
|
|
517
|
-
|
518
|
-
|
519
|
-
|
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
|
data/test/test_png_font.rb
CHANGED
@@ -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"
|
data/test/test_png_reader.rb
CHANGED
@@ -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.
|
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
|
-
|
13
|
+
MIIDPjCCAiagAwIBAgIBCDANBgkqhkiG9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6Y+8N9+fZESsjtWMykA+WXWeGUScHqiU+gH8
|
29
|
+
S7043fq9EbQdBr2AXdj92+CDwuTfHI6/Hj5FVBDULufrJaan4xUgL70Hvc6pTTeW
|
30
|
+
deKfBjgVAq7EYHu1AczzlUly
|
31
31
|
-----END CERTIFICATE-----
|
32
|
-
date:
|
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: '
|
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: '
|
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:
|
109
|
+
homepage: https://github.com/seattlerb/png
|
119
110
|
licenses:
|
120
111
|
- MIT
|
121
|
-
metadata:
|
122
|
-
|
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
|
-
|
140
|
-
|
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
|
-
|
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
|