Sprite.py 文件源码

python
阅读 34 收藏 0 点赞 0 评论 0

项目:cps2-gfx-editor 作者: goosechooser 项目源码 文件源码
def toarray(self):
        """Unpacks the tiles and fills in pixel color.

        Returns an array.
        """
        pic_array = []

        tiles = self.tiles2d()
        for tile_row in tiles:
            row = []
            for tile in tile_row:
                interleaved_tile = tile.interleave_subtiles()
                tile_fmt = interleaved_tile.dimensions * 'c'
                tile_iter = struct.iter_unpack(tile_fmt, interleaved_tile.unpack())
                subtiles = [subtile for subtile in tile_iter]

                row.append(self._colortile(subtiles))

            pic_array.append(row)

        array_rows = []
        for row in np.array(pic_array):
            array_rows.append(np.concatenate(row, axis=1))
        assembled = np.concatenate(array_rows, axis=0)

        return assembled
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号