Lines Matching refs:ImageChunk
597 class ImageChunk(object): class
730 if chunk_hdr_sz != struct.calcsize(ImageChunk.FORMAT):
747 header_bin = self._image.read(struct.calcsize(ImageChunk.FORMAT))
748 (chunk_type, _, chunk_sz, total_sz) = struct.unpack(ImageChunk.FORMAT,
750 data_sz = total_sz - struct.calcsize(ImageChunk.FORMAT)
752 if chunk_type == ImageChunk.TYPE_RAW:
757 self._chunks.append(ImageChunk(ImageChunk.TYPE_RAW,
765 elif chunk_type == ImageChunk.TYPE_FILL:
770 self._chunks.append(ImageChunk(ImageChunk.TYPE_FILL,
776 elif chunk_type == ImageChunk.TYPE_DONT_CARE:
780 self._chunks.append(ImageChunk(ImageChunk.TYPE_DONT_CARE,
786 elif chunk_type == ImageChunk.TYPE_CRC32:
854 self._image.write(struct.pack(ImageChunk.FORMAT,
855 ImageChunk.TYPE_DONT_CARE,
858 struct.calcsize(ImageChunk.FORMAT)))
882 self._image.write(struct.pack(ImageChunk.FORMAT,
883 ImageChunk.TYPE_RAW,
887 struct.calcsize(ImageChunk.FORMAT)))
915 self._image.write(struct.pack(ImageChunk.FORMAT,
916 ImageChunk.TYPE_FILL,
919 4 + struct.calcsize(ImageChunk.FORMAT)))
965 if chunk.chunk_type == ImageChunk.TYPE_RAW:
968 elif chunk.chunk_type == ImageChunk.TYPE_FILL:
973 assert chunk.chunk_type == ImageChunk.TYPE_DONT_CARE
1023 if chunk.chunk_type == ImageChunk.TYPE_RAW:
1025 struct.calcsize(ImageChunk.FORMAT) + num_to_keep)
1027 elif chunk.chunk_type == ImageChunk.TYPE_FILL:
1029 struct.calcsize(ImageChunk.FORMAT) + 4)
1032 assert chunk.chunk_type == ImageChunk.TYPE_DONT_CARE
1033 truncate_at = chunk.chunk_offset + struct.calcsize(ImageChunk.FORMAT)
1036 total_sz = data_sz + struct.calcsize(ImageChunk.FORMAT)
1038 self._image.write(struct.pack(ImageChunk.FORMAT,