Пример #1
0
    def writeIHDR(mem: ByteArray, width: int, height: int, bits: int,
                  colors: int):
        chunk = ByteArray()

        chunk.writeUnsignedInt(0x49484452)
        chunk.writeUnsignedInt(width)
        chunk.writeUnsignedInt(height)
        chunk.writeByte(bits)
        chunk.writeByte(colors)
        chunk.writeByte(0x00)
        chunk.writeByte(0x00)
        chunk.writeByte(0x00)

        PNGEncoder.writeChunk(mem, chunk)
Пример #2
0
 def writeSignature(mem: ByteArray):
     mem.writeUnsignedInt(0x89504E47)
     mem.writeUnsignedInt(0x0D0A1A0A)
Пример #3
0
 def writeChunk(mem: ByteArray, chunk: ByteArray):
     mem.writeUnsignedInt(len(chunk) - 4)
     mem.writeByteArray(chunk)
     mem.writeUnsignedInt(CRC32.hashBytes(chunk))