server_messages.py 文件源码

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

项目:universe 作者: openai 项目源码 文件源码
def parse_rectangle(cls, client, x, y, width, height, data):
        split = width * height * client.framebuffer.bypp
        image = np.frombuffer(data[:split], np.uint8).reshape((height, width, 4))[:, :, [0, 1, 2]]

        # Turn raw bytes into uint8 array
        mask = np.frombuffer(data[split:], np.uint8)
        # Turn uint8 array into bit array, and go over the scanlines
        mask = np.unpackbits(mask).reshape((height, -1 if mask.size else 0))[:, :width]

        encoding = cls(image, mask)
        return Rectangle(x, y, width, height, encoding)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号