Exemplo n.º 1
0
    def test_get_set_render_draw_blend_mode(self):
        window = video.create_window("Test", 10, 10, 10, 10,
                                     video.SDL_WINDOW_HIDDEN)
        self.assertIsInstance(window, video.SDL_Window)

        for i in range(render.get_num_render_drivers()):
            renderer = render.create_renderer(window, i,
                                              render.SDL_RENDERER_ACCELERATED)
            self.assertIsInstance(renderer, render.SDL_Renderer)

            modes = (video.SDL_BLENDMODE_NONE,
                     video.SDL_BLENDMODE_ADD,
                     video.SDL_BLENDMODE_BLEND,
                     video.SDL_BLENDMODE_MOD,
                     )
            for mode in modes:
                render.set_render_draw_blend_mode(renderer, mode)
                bmode = render.get_render_draw_blend_mode(renderer)
                self.assertEqual(bmode, mode)
            render.destroy_renderer(renderer)
            self.assertRaises(sdl.SDLError, render.set_render_draw_blend_mode,
                              renderer, video.SDL_BLENDMODE_ADD)
            self.assertRaises(sdl.SDLError, render.get_render_draw_blend_mode,
                              renderer)
        video.destroy_window(window)
Exemplo n.º 2
0
 def blendmode(self, value):
     """The blend mode used for drawing operations (fill and line)."""
     render.set_render_draw_blend_mode(self.renderer, value)