Yield each row from an interlaced PNG.
()
| 1819 | if self.interlace: |
| 1820 | |
| 1821 | def rows_from_interlace(): |
| 1822 | """Yield each row from an interlaced PNG.""" |
| 1823 | # It's important that this iterator doesn't read |
| 1824 | # IDAT chunks until it yields the first row. |
| 1825 | bs = bytearray(itertools.chain(*raw)) |
| 1826 | arraycode = "BH"[self.bitdepth > 8] |
| 1827 | # Like :meth:`group` but |
| 1828 | # producing an array.array object for each row. |
| 1829 | values = self._deinterlace(bs) |
| 1830 | vpr = self.width * self.planes |
| 1831 | for i in range(0, len(values), vpr): |
| 1832 | row = array(arraycode, values[i : i + vpr]) |
| 1833 | yield row |
| 1834 | |
| 1835 | rows = rows_from_interlace() |
| 1836 | else: |
nothing calls this directly
no test coverage detected