Module: Tessel::PNG::Chunk
- Defined in:
- lib/tessel.rb
Class Method Summary collapse
Class Method Details
.write(io, type, data) ⇒ Object
307 308 309 310 311 312 313 |
# File 'lib/tessel.rb', line 307 def write(io, type, data) type = String(type).b data = String(data).b raise ArgumentError, "PNG chunk type must be four bytes" unless type.bytesize == 4 io << [data.bytesize].pack("N") << type << data << [Zlib.crc32(type + data)].pack("N") end |