chunky_png 0.10.4 → 0.10.5

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- chunky_png (0.10.4)
4
+ chunky_png (0.10.5)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
data/chunky_png.gemspec CHANGED
@@ -3,8 +3,8 @@ Gem::Specification.new do |s|
3
3
 
4
4
  # Do not change the version and date fields by hand. This will be done
5
5
  # automatically by the gem release script.
6
- s.version = "0.10.4"
7
- s.date = "2010-10-18"
6
+ s.version = "0.10.5"
7
+ s.date = "2010-10-22"
8
8
 
9
9
  s.summary = "Pure ruby library for read/write, chunk-level access to PNG files"
10
10
  s.description = <<-EOT
data/lib/chunky_png.rb CHANGED
@@ -27,7 +27,7 @@ module ChunkyPNG
27
27
 
28
28
  # The current version of ChunkyPNG. This value will be updated automatically
29
29
  # by them gem:release rake task.
30
- VERSION = "0.10.4"
30
+ VERSION = "0.10.5"
31
31
 
32
32
  ###################################################
33
33
  # PNG international standard defined constants
@@ -149,8 +149,8 @@ module ChunkyPNG
149
149
  end
150
150
 
151
151
  case interlace
152
- when ChunkyPNG::INTERLACING_NONE then encode_png_image_without_interlacing(color_mode, filtering)
153
- when ChunkyPNG::INTERLACING_ADAM7 then encode_png_image_with_interlacing(color_mode, filtering)
152
+ when ChunkyPNG::INTERLACING_NONE; encode_png_image_without_interlacing(color_mode, filtering)
153
+ when ChunkyPNG::INTERLACING_ADAM7; encode_png_image_with_interlacing(color_mode, filtering)
154
154
  else raise ChunkyPNG::NotSupported, "Unknown interlacing method: #{interlace}!"
155
155
  end
156
156
  end
@@ -80,8 +80,8 @@ module ChunkyPNG
80
80
  # converted color value.
81
81
  def from_hex(str)
82
82
  case str
83
- when /^(?:#|0x)?([0-9a-f]{6})$/i then ($1.hex << 8) | 0xff
84
- when /^(?:#|0x)?([0-9a-f]{8})$/i then $1.hex
83
+ when /^(?:#|0x)?([0-9a-f]{6})$/i; ($1.hex << 8) | 0xff
84
+ when /^(?:#|0x)?([0-9a-f]{8})$/i; $1.hex
85
85
  else raise ChunkyPNG::ExpectationFailed, "Not a valid hex color notation: #{str.inspect}!"
86
86
  end
87
87
  end
@@ -391,11 +391,11 @@ module ChunkyPNG
391
391
  # @return [Integer] The number of bytes used per pixel in a datastream.
392
392
  def bytesize(color_mode)
393
393
  case color_mode
394
- when ChunkyPNG::COLOR_INDEXED then 1
395
- when ChunkyPNG::COLOR_TRUECOLOR then 3
396
- when ChunkyPNG::COLOR_TRUECOLOR_ALPHA then 4
397
- when ChunkyPNG::COLOR_GRAYSCALE then 1
398
- when ChunkyPNG::COLOR_GRAYSCALE_ALPHA then 2
394
+ when ChunkyPNG::COLOR_INDEXED; 1
395
+ when ChunkyPNG::COLOR_TRUECOLOR; 3
396
+ when ChunkyPNG::COLOR_TRUECOLOR_ALPHA; 4
397
+ when ChunkyPNG::COLOR_GRAYSCALE; 1
398
+ when ChunkyPNG::COLOR_GRAYSCALE_ALPHA; 2
399
399
  else raise ChunkyPNG::NotSupported, "Don't know the bytesize of pixels in this colormode: #{color_mode}!"
400
400
  end
401
401
  end
@@ -77,11 +77,11 @@ module ChunkyPNG
77
77
  until io.eof?
78
78
  chunk = ChunkyPNG::Chunk.read(io)
79
79
  case chunk
80
- when ChunkyPNG::Chunk::Header then ds.header_chunk = chunk
81
- when ChunkyPNG::Chunk::Palette then ds.palette_chunk = chunk
82
- when ChunkyPNG::Chunk::Transparency then ds.transparency_chunk = chunk
83
- when ChunkyPNG::Chunk::ImageData then ds.data_chunks << chunk
84
- when ChunkyPNG::Chunk::End then ds.end_chunk = chunk
80
+ when ChunkyPNG::Chunk::Header; ds.header_chunk = chunk
81
+ when ChunkyPNG::Chunk::Palette; ds.palette_chunk = chunk
82
+ when ChunkyPNG::Chunk::Transparency; ds.transparency_chunk = chunk
83
+ when ChunkyPNG::Chunk::ImageData; ds.data_chunks << chunk
84
+ when ChunkyPNG::Chunk::End; ds.end_chunk = chunk
85
85
  else ds.other_chunks << chunk
86
86
  end
87
87
  end
@@ -71,9 +71,9 @@ module ChunkyPNG
71
71
  end
72
72
 
73
73
  # Checks whether the size of this palette is suitable for indexed storage.
74
- # @return [true, false] True if the number of colors in this palette is less than 256.
74
+ # @return [true, false] True if the number of colors in this palette is at most 256.
75
75
  def indexable?
76
- size < 256
76
+ size <= 256
77
77
  end
78
78
 
79
79
  # Check whether this pelette only contains opaque colors.
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 10
8
- - 4
9
- version: 0.10.4
8
+ - 5
9
+ version: 0.10.5
10
10
  platform: ruby
11
11
  authors:
12
12
  - Willem van Bergen
@@ -14,26 +14,25 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-10-18 00:00:00 +02:00
17
+ date: 2010-10-22 00:00:00 +02:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
- name: rake
22
- requirement: &id001 !ruby/object:Gem::Requirement
23
- none: false
21
+ prerelease: false
22
+ type: :development
23
+ version_requirements: &id001 !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - ">="
26
26
  - !ruby/object:Gem::Version
27
27
  segments:
28
28
  - 0
29
29
  version: "0"
30
- type: :development
31
- prerelease: false
32
- version_requirements: *id001
30
+ requirement: *id001
31
+ name: rake
33
32
  - !ruby/object:Gem::Dependency
34
- name: rspec
35
- requirement: &id002 !ruby/object:Gem::Requirement
36
- none: false
33
+ prerelease: false
34
+ type: :development
35
+ version_requirements: &id002 !ruby/object:Gem::Requirement
37
36
  requirements:
38
37
  - - ~>
39
38
  - !ruby/object:Gem::Version
@@ -41,9 +40,8 @@ dependencies:
41
40
  - 2
42
41
  - 0
43
42
  version: "2.0"
44
- type: :development
45
- prerelease: false
46
- version_requirements: *id002
43
+ requirement: *id002
44
+ name: rspec
47
45
  description: " This pure Ruby library can read and write PNG images without depending on an external \n image library, like RMagick. It tries to be memory efficient and reasonably fast.\n \n It supports reading and writing all PNG variants that are defined in the specification, \n with one limitation: only 8-bit color depth is supported. It supports all transparency, \n interlacing and filtering options the PNG specifications allows. It can also read and \n write textual metadata from PNG files. Low-level read/write access to PNG chunks is\n also possible.\n \n This library supports simple drawing on the image canvas and simple operations like\n alpha composition and cropping. Finally, it can import from and export to RMagick for \n interoperability.\n \n Also, have a look at OilyPNG at http://github.com/wvanbergen/oily_png. OilyPNG is a \n drop in mixin module that implements some of the ChunkyPNG algorithms in C, which \n provides a massive speed boost to encoding and decoding.\n"
48
46
  email:
49
47
  - willem@railsdoctors.com
@@ -147,27 +145,23 @@ rdoc_options:
147
145
  require_paths:
148
146
  - lib
149
147
  required_ruby_version: !ruby/object:Gem::Requirement
150
- none: false
151
148
  requirements:
152
149
  - - ">="
153
150
  - !ruby/object:Gem::Version
154
- hash: -1708180723927543177
155
151
  segments:
156
152
  - 0
157
153
  version: "0"
158
154
  required_rubygems_version: !ruby/object:Gem::Requirement
159
- none: false
160
155
  requirements:
161
156
  - - ">="
162
157
  - !ruby/object:Gem::Version
163
- hash: -1708180723927543177
164
158
  segments:
165
159
  - 0
166
160
  version: "0"
167
161
  requirements: []
168
162
 
169
163
  rubyforge_project:
170
- rubygems_version: 1.3.7
164
+ rubygems_version: 1.3.6
171
165
  signing_key:
172
166
  specification_version: 3
173
167
  summary: Pure ruby library for read/write, chunk-level access to PNG files