png 1.2.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- checksums.yaml.gz.sig +4 -0
- data.tar.gz.sig +4 -2
- data/.gemtest +0 -0
- data/History.txt +14 -1
- data/README.txt +1 -1
- data/Rakefile +4 -11
- data/example/lines.rb +4 -4
- data/example/profile.rb +1 -1
- data/example/profile_lines.rb +1 -1
- data/lib/png.rb +54 -54
- data/lib/png/font.rb +7 -7
- data/lib/png/pie.rb +12 -11
- data/lib/png/reader.rb +13 -13
- data/test/test_png.rb +95 -107
- data/test/test_png_font.rb +15 -15
- data/test/test_png_reader.rb +19 -21
- metadata +92 -57
- metadata.gz.sig +0 -0
data/test/test_png_font.rb
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
dir = File.expand_path "~/.ruby_inline"
|
2
|
-
if
|
3
|
-
require
|
2
|
+
if File.directory? dir then
|
3
|
+
require "fileutils"
|
4
4
|
puts "nuking #{dir}"
|
5
5
|
# force removal, Windoze is bitching at me, something to hunt later...
|
6
6
|
FileUtils.rm_r dir, :force => true
|
7
7
|
end
|
8
8
|
|
9
|
-
require
|
10
|
-
require
|
11
|
-
require
|
9
|
+
require "rubygems"
|
10
|
+
require "minitest/autorun"
|
11
|
+
require "png/font"
|
12
12
|
|
13
|
-
class TestPngFont <
|
13
|
+
class TestPngFont < Minitest::Test
|
14
14
|
|
15
15
|
def setup
|
16
16
|
@font = PNG::Font.default
|
@@ -25,13 +25,13 @@ class TestPngFont < MiniTest::Unit::TestCase
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def test_coordinates
|
28
|
-
assert_equal [
|
29
|
-
assert_equal [
|
30
|
-
assert_equal [
|
31
|
-
assert_equal [
|
28
|
+
assert_equal [0, 0, 5, 5], @font.coordinates("(")
|
29
|
+
assert_equal [0, 6, 5, 11], @font.coordinates("0")
|
30
|
+
assert_equal [0, 12, 5, 17], @font.coordinates("a")
|
31
|
+
assert_equal [0, 18, 5, 23], @font.coordinates("A")
|
32
32
|
|
33
|
-
assert_equal [42, 12, 47, 17], @font.coordinates(
|
34
|
-
assert_equal [42, 18, 47, 23], @font.coordinates(
|
33
|
+
assert_equal [42, 12, 47, 17], @font.coordinates("h")
|
34
|
+
assert_equal [42, 18, 47, 23], @font.coordinates("H")
|
35
35
|
end
|
36
36
|
|
37
37
|
def test_index
|
@@ -44,7 +44,7 @@ class TestPngFont < MiniTest::Unit::TestCase
|
|
44
44
|
000000000000
|
45
45
|
".strip + "\n"
|
46
46
|
|
47
|
-
assert_equal expected, @font[
|
47
|
+
assert_equal expected, @font["A"].to_s
|
48
48
|
|
49
49
|
expected = "
|
50
50
|
00000000..00
|
@@ -55,11 +55,11 @@ class TestPngFont < MiniTest::Unit::TestCase
|
|
55
55
|
000000000000
|
56
56
|
".strip + "\n"
|
57
57
|
|
58
|
-
assert_equal expected, @font[
|
58
|
+
assert_equal expected, @font["l"].to_s
|
59
59
|
end
|
60
60
|
|
61
61
|
def test_index_identity
|
62
|
-
assert_same @font[
|
62
|
+
assert_same @font["A"], @font["A"]
|
63
63
|
end
|
64
64
|
|
65
65
|
def test_annotate
|
data/test/test_png_reader.rb
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
dir = File.expand_path "~/.ruby_inline"
|
2
|
-
if
|
3
|
-
require
|
2
|
+
if File.directory? dir then
|
3
|
+
require "fileutils"
|
4
4
|
puts "nuking #{dir}"
|
5
5
|
# force removal, Windoze is bitching at me, something to hunt later...
|
6
6
|
FileUtils.rm_r dir, :force => true
|
7
7
|
end
|
8
8
|
|
9
|
-
require
|
10
|
-
require
|
11
|
-
require
|
9
|
+
require "rubygems"
|
10
|
+
require "minitest/autorun"
|
11
|
+
require "png/reader"
|
12
12
|
|
13
|
-
class TestPngReader <
|
13
|
+
class TestPngReader < Minitest::Test
|
14
14
|
|
15
15
|
def setup
|
16
16
|
@canvas = PNG::Canvas.new 5, 10, PNG::Color::White
|
@@ -18,32 +18,30 @@ class TestPngReader < MiniTest::Unit::TestCase
|
|
18
18
|
|
19
19
|
@IHDR_length = "\000\000\000\r"
|
20
20
|
@IHDR_crc = "\2152\317\275"
|
21
|
-
@IHDR_crc_value = @IHDR_crc.unpack(
|
21
|
+
@IHDR_crc_value = @IHDR_crc.unpack("N").first
|
22
22
|
@IHDR_data = "\000\000\000\n\000\000\000\n\b\006\000\000\000"
|
23
23
|
@IHDR_chunk = "#{@IHDR_length}IHDR#{@IHDR_data}#{@IHDR_crc}"
|
24
24
|
|
25
|
-
@blob = <<-EOF.unpack(
|
25
|
+
@blob = <<-EOF.unpack("m*").first
|
26
26
|
iVBORw0KGgoAAAANSUhEUgAAAAUAAAAKCAYAAAB8OZQwAAAAD0lEQVR4nGP4
|
27
27
|
jwUwDGVBALuJxzlQugpEAAAAAElFTkSuQmCC
|
28
28
|
EOF
|
29
29
|
end
|
30
30
|
|
31
31
|
def test_class_check_crc
|
32
|
-
assert PNG.check_crc(
|
32
|
+
assert PNG.check_crc("IHDR", @IHDR_data, @IHDR_crc_value)
|
33
33
|
end
|
34
34
|
|
35
35
|
def test_class_check_crc_exception
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
flunk "exception wasn't raised"
|
42
|
-
end
|
36
|
+
PNG.check_crc("IHDR", @IHDR_data, @IHDR_crc_value + 1)
|
37
|
+
rescue ArgumentError => e
|
38
|
+
assert_equal "Invalid CRC encountered in IHDR chunk", e.message
|
39
|
+
else
|
40
|
+
flunk "exception wasn't raised"
|
43
41
|
end
|
44
42
|
|
45
43
|
def test_class_read_chunk
|
46
|
-
data = PNG.read_chunk
|
44
|
+
data = PNG.read_chunk "IHDR", @IHDR_chunk
|
47
45
|
|
48
46
|
assert_equal @IHDR_data, data
|
49
47
|
end
|
@@ -51,8 +49,8 @@ jwUwDGVBALuJxzlQugpEAAAAAElFTkSuQmCC
|
|
51
49
|
def test_class_read_IDAT
|
52
50
|
canvas = PNG::Canvas.new 5, 10, PNG::Color::White
|
53
51
|
|
54
|
-
data = ([
|
55
|
-
data = data.flatten.map
|
52
|
+
data = ([0, [255] * (4*5)] * 10)
|
53
|
+
data = data.flatten.map(&:chr).join
|
56
54
|
data = Zlib::Deflate.deflate(data)
|
57
55
|
|
58
56
|
PNG.read_IDAT data, 8, PNG::RGBA, canvas
|
@@ -61,13 +59,13 @@ jwUwDGVBALuJxzlQugpEAAAAAElFTkSuQmCC
|
|
61
59
|
end
|
62
60
|
|
63
61
|
def test_class_read_IHDR
|
64
|
-
|
62
|
+
_, _, width, height = PNG.read_IHDR @IHDR_data
|
65
63
|
assert_equal 10, width
|
66
64
|
assert_equal 10, height
|
67
65
|
end
|
68
66
|
|
69
67
|
def test_class_load_metadata
|
70
|
-
png,
|
68
|
+
png, _ = util_png
|
71
69
|
|
72
70
|
width, height, bit_depth = PNG.load(png.to_blob, :metadata)
|
73
71
|
|
metadata
CHANGED
@@ -1,19 +1,18 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: png
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.2.1
|
5
5
|
platform: ruby
|
6
|
-
authors:
|
6
|
+
authors:
|
7
7
|
- Ryan Davis
|
8
|
-
- Eric Hodel
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
|
-
cert_chain:
|
10
|
+
cert_chain:
|
12
11
|
- |
|
13
12
|
-----BEGIN CERTIFICATE-----
|
14
|
-
|
13
|
+
MIIDPjCCAiagAwIBAgIBAjANBgkqhkiG9w0BAQUFADBFMRMwEQYDVQQDDApyeWFu
|
15
14
|
ZC1ydWJ5MRkwFwYKCZImiZPyLGQBGRYJemVuc3BpZGVyMRMwEQYKCZImiZPyLGQB
|
16
|
-
|
15
|
+
GRYDY29tMB4XDTE0MDkxNzIzMDcwN1oXDTE1MDkxNzIzMDcwN1owRTETMBEGA1UE
|
17
16
|
AwwKcnlhbmQtcnVieTEZMBcGCgmSJomT8ixkARkWCXplbnNwaWRlcjETMBEGCgmS
|
18
17
|
JomT8ixkARkWA2NvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALda
|
19
18
|
b9DCgK+627gPJkB6XfjZ1itoOQvpqH1EXScSaba9/S2VF22VYQbXU1xQXL/WzCkx
|
@@ -23,42 +22,84 @@ cert_chain:
|
|
23
22
|
qhtV7HJxNKuPj/JFH0D2cswvzznE/a5FOYO68g+YCuFi5L8wZuuM8zzdwjrWHqSV
|
24
23
|
gBEfoTEGr7Zii72cx+sCAwEAAaM5MDcwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAw
|
25
24
|
HQYDVR0OBBYEFEfFe9md/r/tj/Wmwpy+MI8d9k/hMA0GCSqGSIb3DQEBBQUAA4IB
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
25
|
+
AQAFoDJRokCQdxFfOrmsKX41KOFlU/zjrbDVM9hgB/Ur999M6OXGSi8FitXNtMwY
|
26
|
+
FVjsiAPeU7HaWVVcZkj6IhINelTkXsxgGz/qCzjHy3iUMuZWw36cS0fiWJ5rvH+e
|
27
|
+
hD7uXxJSFuyf1riDGI1aeWbQ74WMwvNstOxLUMiV5a1fzBhlxPqb537ubDjq/M/h
|
28
|
+
zPUFPVYeL5KjDHLCqI2FwIk2sEMOQgjpXHzl+3NlD2LUgUhHDMevmgVua0e2GT1B
|
29
|
+
xJcC6UN6NHMOVMyAXsr2HR0gRRx4ofN1LoP2KhXzSr8UMvQYlwPmE0N5GQv1b5AO
|
30
|
+
VpzF30vNaJK6ZT7xlIsIlwmH
|
32
31
|
-----END CERTIFICATE-----
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
32
|
+
date: 2015-04-13 00:00:00.000000000 Z
|
33
|
+
dependencies:
|
34
|
+
- !ruby/object:Gem::Dependency
|
35
|
+
name: RubyInline
|
36
|
+
requirement: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '3.9'
|
41
|
+
type: :runtime
|
42
|
+
prerelease: false
|
43
|
+
version_requirements: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
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
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: rdoc
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ~>
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '4.0'
|
69
|
+
type: :development
|
70
|
+
prerelease: false
|
71
|
+
version_requirements: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ~>
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '4.0'
|
76
|
+
- !ruby/object:Gem::Dependency
|
38
77
|
name: hoe
|
78
|
+
requirement: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ~>
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '3.13'
|
39
83
|
type: :development
|
40
|
-
|
41
|
-
version_requirements: !ruby/object:Gem::Requirement
|
42
|
-
requirements:
|
43
|
-
- -
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
version:
|
46
|
-
version:
|
84
|
+
prerelease: false
|
85
|
+
version_requirements: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ~>
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '3.13'
|
47
90
|
description: |-
|
48
91
|
PNG is an almost-pure-ruby PNG library. It lets you write a PNG
|
49
92
|
without any C libraries.
|
50
|
-
email:
|
93
|
+
email:
|
51
94
|
- ryand-ruby@zenspider.com
|
52
|
-
- drbrain@segment7.net
|
53
95
|
executables: []
|
54
|
-
|
55
96
|
extensions: []
|
56
|
-
|
57
|
-
extra_rdoc_files:
|
97
|
+
extra_rdoc_files:
|
58
98
|
- History.txt
|
59
99
|
- Manifest.txt
|
60
100
|
- README.txt
|
61
|
-
files:
|
101
|
+
files:
|
102
|
+
- .gemtest
|
62
103
|
- History.txt
|
63
104
|
- Manifest.txt
|
64
105
|
- README.txt
|
@@ -74,36 +115,30 @@ files:
|
|
74
115
|
- test/test_png.rb
|
75
116
|
- test/test_png_font.rb
|
76
117
|
- test/test_png_reader.rb
|
77
|
-
has_rdoc: true
|
78
118
|
homepage: http://seattlerb.rubyforge.org/
|
79
|
-
licenses:
|
80
|
-
|
119
|
+
licenses:
|
120
|
+
- MIT
|
121
|
+
metadata: {}
|
81
122
|
post_install_message:
|
82
|
-
rdoc_options:
|
123
|
+
rdoc_options:
|
83
124
|
- --main
|
84
125
|
- README.txt
|
85
|
-
require_paths:
|
126
|
+
require_paths:
|
86
127
|
- lib
|
87
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
88
|
-
requirements:
|
89
|
-
- -
|
90
|
-
- !ruby/object:Gem::Version
|
91
|
-
version:
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
version: "0"
|
98
|
-
version:
|
128
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
129
|
+
requirements:
|
130
|
+
- - '>='
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: '0'
|
133
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
134
|
+
requirements:
|
135
|
+
- - '>='
|
136
|
+
- !ruby/object:Gem::Version
|
137
|
+
version: '0'
|
99
138
|
requirements: []
|
100
|
-
|
101
|
-
|
102
|
-
rubygems_version: 1.3.4
|
139
|
+
rubyforge_project:
|
140
|
+
rubygems_version: 2.4.5
|
103
141
|
signing_key:
|
104
|
-
specification_version:
|
142
|
+
specification_version: 4
|
105
143
|
summary: PNG is an almost-pure-ruby PNG library
|
106
|
-
test_files:
|
107
|
-
- test/test_png.rb
|
108
|
-
- test/test_png_font.rb
|
109
|
-
- test/test_png_reader.rb
|
144
|
+
test_files: []
|
metadata.gz.sig
CHANGED
Binary file
|