gfxdraw_test.py 文件源码

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

项目:AIFun 作者: Plottel 项目源码 文件源码
def test_bezier(self):
        """bezier(surface, points, steps, color): return None"""
        fg = self.foreground_color
        bg = self.background_color
        points = [(10, 50), (25, 15), (60, 80), (92, 30)]
        fg_test_points = [points[0], points[3]]
        bg_test_points = [(points[0][0] - 1, points[0][1]),
                          (points[3][0] + 1, points[3][1]),
                          (points[1][0], points[1][1] + 3),
                          (points[2][0], points[2][1] - 3)]
        for surf in self.surfaces:
            fg_adjusted = surf.unmap_rgb(surf.map_rgb(fg))
            bg_adjusted = surf.unmap_rgb(surf.map_rgb(bg))
            pygame.gfxdraw.bezier(surf, points, 30, fg)
            for posn in fg_test_points:
                self.check_at(surf, posn, fg_adjusted)
            for posn in bg_test_points:
                self.check_at(surf, posn, bg_adjusted)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号