Python pygame.BLEND_ADD Examples
The following are 30
code examples of pygame.BLEND_ADD().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
pygame
, or try the search function
.
Example #1
Source File: game054.py From eduActiv8 with GNU General Public License v3.0 | 6 votes |
def mix_circles(self): for i in range(3): self.rgb_g[i] = self.board.ships[i].grid_y self.update_sliders() self.canv[3].fill(self.col_k) ct = self.canvas_center radius = 9 * self.board.scale radius2 = 5 * self.board.scale x = 1 * self.board.scale rect = [[ct[0], ct[1] - x], [ct[0] - x, ct[1] + x], [ct[0] + x, ct[1] + x]] for i in range(3): pygame.draw.circle(self.canv[i], self.rgbx3[i], rect[i], radius, 0) self.canv[3].blit(self.canv[i], [0, 0], special_flags=pygame.BLEND_ADD) pygame.draw.circle(self.canv[3], self.picked, ct, radius2, 0) self.canvas.painting = self.canv[3].copy() self.canvas.update_me = True
Example #2
Source File: surface_test.py From fxxkpython with GNU General Public License v3.0 | 6 votes |
def test_blend(self): bitsizes = [8, 16, 24, 32] blends = ['BLEND_ADD', 'BLEND_SUB', 'BLEND_MULT', 'BLEND_MIN', 'BLEND_MAX'] for bitsize in bitsizes: surf = self._make_surface(bitsize) comp = self._make_surface(bitsize) for blend in blends: self._fill_surface(surf) self._fill_surface(comp) comp.blit(surf, (3, 0), special_flags=getattr(pygame, blend)) surf.blit(surf, (3, 0), special_flags=getattr(pygame, blend)) self._assert_same(surf, comp)
Example #3
Source File: surface_test.py From fxxkpython with GNU General Public License v3.0 | 6 votes |
def test_blend(self): bitsizes = [8, 16, 24, 32] blends = ['BLEND_ADD', 'BLEND_SUB', 'BLEND_MULT', 'BLEND_MIN', 'BLEND_MAX'] for bitsize in bitsizes: surf = self._make_surface(bitsize) comp = self._make_surface(bitsize) for blend in blends: self._fill_surface(surf) self._fill_surface(comp) comp.blit(surf, (3, 0), special_flags=getattr(pygame, blend)) surf.blit(surf, (3, 0), special_flags=getattr(pygame, blend)) self._assert_same(surf, comp)
Example #4
Source File: dialogwnd.py From eduActiv8 with GNU General Public License v3.0 | 6 votes |
def load_images(self): self.bg_tint_color = ex.hsv_to_rgb(self.wnd.mainloop.cl.color_sliders[5][0] * 16, 255, 100) if len(self.img_src1) > 0: self.img_pos = (0, 0) try: self.img1 = pygame.image.load(os.path.join('res', 'images', "dialog", self.img_src1)).convert_alpha() self.img3 = pygame.image.load(os.path.join('res', 'images', "dialog", "dialog_bg_n.png")).convert_alpha() self.img3.fill(self.bg_tint_color, special_flags=pygame.BLEND_ADD) self.img4 = pygame.image.load(os.path.join('res', 'images', "dialog", "dialog_bg_h.png")).convert_alpha() self.img4.fill(self.bg_tint_color, special_flags=pygame.BLEND_ADD) self.active_img = self.img1 except: pass self.update()
Example #5
Source File: surface_test.py From fxxkpython with GNU General Public License v3.0 | 6 votes |
def test_blend(self): bitsizes = [8, 16, 24, 32] blends = ['BLEND_ADD', 'BLEND_SUB', 'BLEND_MULT', 'BLEND_MIN', 'BLEND_MAX'] for bitsize in bitsizes: surf = self._make_surface(bitsize) comp = self._make_surface(bitsize) for blend in blends: self._fill_surface(surf) self._fill_surface(comp) comp.blit(surf, (3, 0), special_flags=getattr(pygame, blend)) surf.blit(surf, (3, 0), special_flags=getattr(pygame, blend)) self._assert_same(surf, comp)
Example #6
Source File: surface_test.py From fxxkpython with GNU General Public License v3.0 | 5 votes |
def test_fill_blend(self): destinations = [self._make_surface(8), self._make_surface(16), self._make_surface(16, srcalpha=True), self._make_surface(24), self._make_surface(32), self._make_surface(32, srcalpha=True)] blend = [('BLEND_ADD', (0, 25, 100, 255), lambda a, b: min(a + b, 255)), ('BLEND_SUB', (0, 25, 100, 255), lambda a, b: max(a - b, 0)), ('BLEND_MULT', (0, 7, 100, 255), lambda a, b: (a * b) // 256), ('BLEND_MIN', (0, 255, 0, 255), min), ('BLEND_MAX', (0, 255, 0, 255), max)] for dst in destinations: dst_palette = [dst.unmap_rgb(dst.map_rgb(c)) for c in self._test_palette] for blend_name, fill_color, op in blend: fc = dst.unmap_rgb(dst.map_rgb(fill_color)) self._fill_surface(dst) p = [] for dc in dst_palette: c = [op(dc[i], fc[i]) for i in range(3)] if dst.get_masks()[3]: c.append(dc[3]) else: c.append(255) c = dst.unmap_rgb(dst.map_rgb(c)) p.append(c) dst.fill(fill_color, special_flags=getattr(pygame, blend_name)) self._assert_surface(dst, p, ", %s" % blend_name)
Example #7
Source File: surface_test.py From fxxkpython with GNU General Public License v3.0 | 5 votes |
def test_blit_blend_big_rect(self): """ test that an oversized rect works ok. """ color = (1, 2, 3, 255) area = (1, 1, 30, 30) s1 = pygame.Surface((4, 4), 0, 32) r = s1.fill(special_flags=pygame.BLEND_ADD, color=color, rect=area) self.assertEqual(pygame.Rect((1, 1, 3, 3)), r) self.assertEqual(s1.get_at((0, 0)), (0, 0, 0, 255)) self.assertEqual(s1.get_at((1, 1)), color) black = pygame.Color("black") red = pygame.Color("red") self.assertNotEqual(black, red) surf = pygame.Surface((10, 10), 0, 32) surf.fill(black) subsurf = surf.subsurface(pygame.Rect(0, 1, 10, 8)) self.assertEqual(surf.get_at((0, 0)), black) self.assertEqual(surf.get_at((0, 9)), black) subsurf.fill(red, (0, -1, 10, 1), pygame.BLEND_RGB_ADD) self.assertEqual(surf.get_at((0, 0)), black) self.assertEqual(surf.get_at((0, 9)), black) subsurf.fill(red, (0, 8, 10, 1), pygame.BLEND_RGB_ADD) self.assertEqual(surf.get_at((0, 0)), black) self.assertEqual(surf.get_at((0, 9)), black)
Example #8
Source File: surface_test.py From fxxkpython with GNU General Public License v3.0 | 5 votes |
def test_blit_keyword_args(self): color = (1, 2, 3, 255) s1 = pygame.Surface((4, 4), 0, 32) s2 = pygame.Surface((2, 2), 0, 32) s2.fill((1, 2, 3)) s1.blit(special_flags=BLEND_ADD, source=s2, dest=(1, 1), area=s2.get_rect()) self.assertEqual(s1.get_at((0, 0)), (0, 0, 0, 255)) self.assertEqual(s1.get_at((1, 1)), color)
Example #9
Source File: surface_test.py From fxxkpython with GNU General Public License v3.0 | 5 votes |
def test_fill_keyword_args(self): """Ensure fill() accepts keyword arguments.""" color = (1, 2, 3, 255) area = (1, 1, 2, 2) s1 = pygame.Surface((4, 4), 0, 32) s1.fill(special_flags=pygame.BLEND_ADD, color=color, rect=area) self.assertEqual(s1.get_at((0, 0)), (0, 0, 0, 255)) self.assertEqual(s1.get_at((1, 1)), color) ########################################################################
Example #10
Source File: surface_test.py From fxxkpython with GNU General Public License v3.0 | 5 votes |
def test_fill(self): screen = pygame.display.set_mode((640, 480)) # Green and blue test pattern screen.fill((0, 255, 0), (0, 0, 320, 240)) screen.fill((0, 255, 0), (320, 240, 320, 240)) screen.fill((0, 0, 255), (320, 0, 320, 240)) screen.fill((0, 0, 255), (0, 240, 320, 240)) # Now apply a clip rect, such that only the left side of the # screen should be effected by blit opperations. screen.set_clip((0, 0, 320, 480)) # Test fills with each special flag, and additionaly without any. screen.fill((255, 0, 0, 127), (160, 0, 320, 30), 0) screen.fill((255, 0, 0, 127), (160, 30, 320, 30), pygame.BLEND_ADD) screen.fill((0, 127, 127, 127), (160, 60, 320, 30), pygame.BLEND_SUB) screen.fill((0, 63, 63, 127), (160, 90, 320, 30), pygame.BLEND_MULT) screen.fill((0, 127, 127, 127), (160, 120, 320, 30), pygame.BLEND_MIN) screen.fill((127, 0, 0, 127), (160, 150, 320, 30), pygame.BLEND_MAX) screen.fill((255, 0, 0, 127), (160, 180, 320, 30), pygame.BLEND_RGBA_ADD) screen.fill((0, 127, 127, 127), (160, 210, 320, 30), pygame.BLEND_RGBA_SUB) screen.fill((0, 63, 63, 127), (160, 240, 320, 30), pygame.BLEND_RGBA_MULT) screen.fill((0, 127, 127, 127), (160, 270, 320, 30), pygame.BLEND_RGBA_MIN) screen.fill((127, 0, 0, 127), (160, 300, 320, 30), pygame.BLEND_RGBA_MAX) screen.fill((255, 0, 0, 127), (160, 330, 320, 30), pygame.BLEND_RGB_ADD) screen.fill((0, 127, 127, 127), (160, 360, 320, 30), pygame.BLEND_RGB_SUB) screen.fill((0, 63, 63, 127), (160, 390, 320, 30), pygame.BLEND_RGB_MULT) screen.fill((0, 127, 127, 127), (160, 420, 320, 30), pygame.BLEND_RGB_MIN) screen.fill((255, 0, 0, 127), (160, 450, 320, 30), pygame.BLEND_RGB_MAX) # Update the display so we can see the results pygame.display.flip() # Compare colors on both sides of window for y in range(5, 480, 10): self.assertEqual(screen.get_at((10, y)), screen.get_at((330, 480 - y)))
Example #11
Source File: particles.py From pygame_tutorials with MIT License | 5 votes |
def blit(self): return self.game.screen.blit(self.image, self.rect, special_flags=pygame.BLEND_ADD)
Example #12
Source File: surface_test.py From fxxkpython with GNU General Public License v3.0 | 5 votes |
def test_fill_blend(self): destinations = [self._make_surface(8), self._make_surface(16), self._make_surface(16, srcalpha=True), self._make_surface(24), self._make_surface(32), self._make_surface(32, srcalpha=True)] blend = [('BLEND_ADD', (0, 25, 100, 255), lambda a, b: min(a + b, 255)), ('BLEND_SUB', (0, 25, 100, 255), lambda a, b: max(a - b, 0)), ('BLEND_MULT', (0, 7, 100, 255), lambda a, b: (a * b) // 256), ('BLEND_MIN', (0, 255, 0, 255), min), ('BLEND_MAX', (0, 255, 0, 255), max)] for dst in destinations: dst_palette = [dst.unmap_rgb(dst.map_rgb(c)) for c in self._test_palette] for blend_name, fill_color, op in blend: fc = dst.unmap_rgb(dst.map_rgb(fill_color)) self._fill_surface(dst) p = [] for dc in dst_palette: c = [op(dc[i], fc[i]) for i in range(3)] if dst.get_masks()[3]: c.append(dc[3]) else: c.append(255) c = dst.unmap_rgb(dst.map_rgb(c)) p.append(c) dst.fill(fill_color, special_flags=getattr(pygame, blend_name)) self._assert_surface(dst, p, ", %s" % blend_name)
Example #13
Source File: surface_test.py From fxxkpython with GNU General Public License v3.0 | 5 votes |
def todo_test_blit(self): # __doc__ (as of 2008-08-02) for pygame.surface.Surface.blit: # Surface.blit(source, dest, area=None, special_flags = 0): return Rect # draw one image onto another # # Draws a source Surface onto this Surface. The draw can be positioned # with the dest argument. Dest can either be pair of coordinates # representing the upper left corner of the source. A Rect can also be # passed as the destination and the topleft corner of the rectangle # will be used as the position for the blit. The size of the # destination rectangle does not effect the blit. # # An optional area rectangle can be passed as well. This represents a # smaller portion of the source Surface to draw. # # An optional special flags is for passing in new in 1.8.0: BLEND_ADD, # BLEND_SUB, BLEND_MULT, BLEND_MIN, BLEND_MAX new in 1.8.1: # BLEND_RGBA_ADD, BLEND_RGBA_SUB, BLEND_RGBA_MULT, BLEND_RGBA_MIN, # BLEND_RGBA_MAX BLEND_RGB_ADD, BLEND_RGB_SUB, BLEND_RGB_MULT, # BLEND_RGB_MIN, BLEND_RGB_MAX With other special blitting flags # perhaps added in the future. # # The return rectangle is the area of the affected pixels, excluding # any pixels outside the destination Surface, or outside the clipping # area. # # Pixel alphas will be ignored when blitting to an 8 bit Surface. # special_flags new in pygame 1.8. self.fail()
Example #14
Source File: surface_test.py From fxxkpython with GNU General Public License v3.0 | 5 votes |
def test_blit_keyword_args(self): color = (1, 2, 3, 255) s1 = pygame.Surface((4, 4), 0, 32) s2 = pygame.Surface((2, 2), 0, 32) s2.fill((1, 2, 3)) s1.blit(special_flags=BLEND_ADD, source=s2, dest=(1, 1), area=s2.get_rect()) self.assertEqual(s1.get_at((0, 0)), (0, 0, 0, 255)) self.assertEqual(s1.get_at((1, 1)), color)
Example #15
Source File: surface_test.py From fxxkpython with GNU General Public License v3.0 | 5 votes |
def test_fill_keyword_args(self): """Ensure fill() accepts keyword arguments.""" color = (1, 2, 3, 255) area = (1, 1, 2, 2) s1 = pygame.Surface((4, 4), 0, 32) s1.fill(special_flags=pygame.BLEND_ADD, color=color, rect=area) self.assertEqual(s1.get_at((0, 0)), (0, 0, 0, 255)) self.assertEqual(s1.get_at((1, 1)), color) ########################################################################
Example #16
Source File: surface_test.py From fxxkpython with GNU General Public License v3.0 | 5 votes |
def test_fill(self): screen = pygame.display.set_mode((640, 480)) # Green and blue test pattern screen.fill((0, 255, 0), (0, 0, 320, 240)) screen.fill((0, 255, 0), (320, 240, 320, 240)) screen.fill((0, 0, 255), (320, 0, 320, 240)) screen.fill((0, 0, 255), (0, 240, 320, 240)) # Now apply a clip rect, such that only the left side of the # screen should be effected by blit opperations. screen.set_clip((0, 0, 320, 480)) # Test fills with each special flag, and additionaly without any. screen.fill((255, 0, 0, 127), (160, 0, 320, 30), 0) screen.fill((255, 0, 0, 127), (160, 30, 320, 30), pygame.BLEND_ADD) screen.fill((0, 127, 127, 127), (160, 60, 320, 30), pygame.BLEND_SUB) screen.fill((0, 63, 63, 127), (160, 90, 320, 30), pygame.BLEND_MULT) screen.fill((0, 127, 127, 127), (160, 120, 320, 30), pygame.BLEND_MIN) screen.fill((127, 0, 0, 127), (160, 150, 320, 30), pygame.BLEND_MAX) screen.fill((255, 0, 0, 127), (160, 180, 320, 30), pygame.BLEND_RGBA_ADD) screen.fill((0, 127, 127, 127), (160, 210, 320, 30), pygame.BLEND_RGBA_SUB) screen.fill((0, 63, 63, 127), (160, 240, 320, 30), pygame.BLEND_RGBA_MULT) screen.fill((0, 127, 127, 127), (160, 270, 320, 30), pygame.BLEND_RGBA_MIN) screen.fill((127, 0, 0, 127), (160, 300, 320, 30), pygame.BLEND_RGBA_MAX) screen.fill((255, 0, 0, 127), (160, 330, 320, 30), pygame.BLEND_RGB_ADD) screen.fill((0, 127, 127, 127), (160, 360, 320, 30), pygame.BLEND_RGB_SUB) screen.fill((0, 63, 63, 127), (160, 390, 320, 30), pygame.BLEND_RGB_MULT) screen.fill((0, 127, 127, 127), (160, 420, 320, 30), pygame.BLEND_RGB_MIN) screen.fill((255, 0, 0, 127), (160, 450, 320, 30), pygame.BLEND_RGB_MAX) # Update the display so we can see the results pygame.display.flip() # Compare colors on both sides of window for y in range(5, 480, 10): self.assertEqual(screen.get_at((10, y)), screen.get_at((330, 480 - y)))
Example #17
Source File: surface_test.py From fxxkpython with GNU General Public License v3.0 | 5 votes |
def test_fill(self): screen = pygame.display.set_mode((640, 480)) # Green and blue test pattern screen.fill((0, 255, 0), (0, 0, 320, 240)) screen.fill((0, 255, 0), (320, 240, 320, 240)) screen.fill((0, 0, 255), (320, 0, 320, 240)) screen.fill((0, 0, 255), (0, 240, 320, 240)) # Now apply a clip rect, such that only the left side of the # screen should be effected by blit opperations. screen.set_clip((0, 0, 320, 480)) # Test fills with each special flag, and additionaly without any. screen.fill((255, 0, 0, 127), (160, 0, 320, 30), 0) screen.fill((255, 0, 0, 127), (160, 30, 320, 30), pygame.BLEND_ADD) screen.fill((0, 127, 127, 127), (160, 60, 320, 30), pygame.BLEND_SUB) screen.fill((0, 63, 63, 127), (160, 90, 320, 30), pygame.BLEND_MULT) screen.fill((0, 127, 127, 127), (160, 120, 320, 30), pygame.BLEND_MIN) screen.fill((127, 0, 0, 127), (160, 150, 320, 30), pygame.BLEND_MAX) screen.fill((255, 0, 0, 127), (160, 180, 320, 30), pygame.BLEND_RGBA_ADD) screen.fill((0, 127, 127, 127), (160, 210, 320, 30), pygame.BLEND_RGBA_SUB) screen.fill((0, 63, 63, 127), (160, 240, 320, 30), pygame.BLEND_RGBA_MULT) screen.fill((0, 127, 127, 127), (160, 270, 320, 30), pygame.BLEND_RGBA_MIN) screen.fill((127, 0, 0, 127), (160, 300, 320, 30), pygame.BLEND_RGBA_MAX) screen.fill((255, 0, 0, 127), (160, 330, 320, 30), pygame.BLEND_RGB_ADD) screen.fill((0, 127, 127, 127), (160, 360, 320, 30), pygame.BLEND_RGB_SUB) screen.fill((0, 63, 63, 127), (160, 390, 320, 30), pygame.BLEND_RGB_MULT) screen.fill((0, 127, 127, 127), (160, 420, 320, 30), pygame.BLEND_RGB_MIN) screen.fill((255, 0, 0, 127), (160, 450, 320, 30), pygame.BLEND_RGB_MAX) # Update the display so we can see the results pygame.display.flip() # Compare colors on both sides of window for y in range(5, 480, 10): self.assertEqual(screen.get_at((10, y)), screen.get_at((330, 480 - y)))
Example #18
Source File: surface_test.py From fxxkpython with GNU General Public License v3.0 | 5 votes |
def test_blit_blend_big_rect(self): """ test that an oversized rect works ok. """ color = (1, 2, 3, 255) area = (1, 1, 30, 30) s1 = pygame.Surface((4, 4), 0, 32) r = s1.fill(special_flags=pygame.BLEND_ADD, color=color, rect=area) self.assertEqual(pygame.Rect((1, 1, 3, 3)), r) self.assertEqual(s1.get_at((0, 0)), (0, 0, 0, 255)) self.assertEqual(s1.get_at((1, 1)), color) black = pygame.Color("black") red = pygame.Color("red") self.assertNotEqual(black, red) surf = pygame.Surface((10, 10), 0, 32) surf.fill(black) subsurf = surf.subsurface(pygame.Rect(0, 1, 10, 8)) self.assertEqual(surf.get_at((0, 0)), black) self.assertEqual(surf.get_at((0, 9)), black) subsurf.fill(red, (0, -1, 10, 1), pygame.BLEND_RGB_ADD) self.assertEqual(surf.get_at((0, 0)), black) self.assertEqual(surf.get_at((0, 9)), black) subsurf.fill(red, (0, 8, 10, 1), pygame.BLEND_RGB_ADD) self.assertEqual(surf.get_at((0, 0)), black) self.assertEqual(surf.get_at((0, 9)), black)
Example #19
Source File: surface_test.py From fxxkpython with GNU General Public License v3.0 | 5 votes |
def todo_test_blit(self): # __doc__ (as of 2008-08-02) for pygame.surface.Surface.blit: # Surface.blit(source, dest, area=None, special_flags = 0): return Rect # draw one image onto another # # Draws a source Surface onto this Surface. The draw can be positioned # with the dest argument. Dest can either be pair of coordinates # representing the upper left corner of the source. A Rect can also be # passed as the destination and the topleft corner of the rectangle # will be used as the position for the blit. The size of the # destination rectangle does not effect the blit. # # An optional area rectangle can be passed as well. This represents a # smaller portion of the source Surface to draw. # # An optional special flags is for passing in new in 1.8.0: BLEND_ADD, # BLEND_SUB, BLEND_MULT, BLEND_MIN, BLEND_MAX new in 1.8.1: # BLEND_RGBA_ADD, BLEND_RGBA_SUB, BLEND_RGBA_MULT, BLEND_RGBA_MIN, # BLEND_RGBA_MAX BLEND_RGB_ADD, BLEND_RGB_SUB, BLEND_RGB_MULT, # BLEND_RGB_MIN, BLEND_RGB_MAX With other special blitting flags # perhaps added in the future. # # The return rectangle is the area of the affected pixels, excluding # any pixels outside the destination Surface, or outside the clipping # area. # # Pixel alphas will be ignored when blitting to an 8 bit Surface. # special_flags new in pygame 1.8. self.fail()
Example #20
Source File: surface_test.py From fxxkpython with GNU General Public License v3.0 | 5 votes |
def test_blit_keyword_args(self): color = (1, 2, 3, 255) s1 = pygame.Surface((4, 4), 0, 32) s2 = pygame.Surface((2, 2), 0, 32) s2.fill((1, 2, 3)) s1.blit(special_flags=BLEND_ADD, source=s2, dest=(1, 1), area=s2.get_rect()) self.assertEqual(s1.get_at((0, 0)), (0, 0, 0, 255)) self.assertEqual(s1.get_at((1, 1)), color)
Example #21
Source File: particles.py From gamedev with MIT License | 5 votes |
def blit(self): return self.game.screen.blit(self.image, self.rect, special_flags=pygame.BLEND_ADD)
Example #22
Source File: game053.py From eduActiv8 with GNU General Public License v3.0 | 5 votes |
def mix_circles(self): for i in range(3): self.rgb_g[i] = self.board.ships[i].grid_y self.update_sliders() self.canv[3].fill(self.col_k) ct = self.canvas_center radius = 9 * self.board.scale x = 1 * self.board.scale rect = [[ct[0], ct[1] - x], [ct[0] - x, ct[1] + x], [ct[0] + x, ct[1] + x]] for i in range(3): pygame.draw.circle(self.canv[i], self.rgbx3[i], rect[i], radius, 0) self.canv[3].blit(self.canv[i], [0, 0], special_flags=pygame.BLEND_ADD) self.canvas.painting = self.canv[3].copy() self.canvas.update_me = True
Example #23
Source File: board.py From eduActiv8 with GNU General Public License v3.0 | 5 votes |
def update(self, board): if self.update_me: Unit.update(self, board) if len(self.img_src) > 0: self.image.blit(self.img, self.img_pos) if self.tint_color is not None: self.image.fill(self.tint_color, special_flags=pygame.BLEND_ADD) if self.unit_id == board.active_ship and self.outline is True: lines = [[0, 0], [self.grid_w * board.scale - 2, 0], [self.grid_w * board.scale - 2, self.grid_h * board.scale - 2], [0, self.grid_h * board.scale - 2]] pygame.draw.lines(self.image, (255, 200, 200), True, lines) if hasattr(self, "door_outline") and self.door_outline is True: self.set_outline(self.perm_outline_color, self.perm_outline_width) if self.perm_outline: self.draw_outline() self.draw_check_marks()
Example #24
Source File: info_bar.py From eduActiv8 with GNU General Public License v3.0 | 5 votes |
def load_images(self, rev): self.rev = rev self.img_pos = (0, 0) self.img_1 = pygame.image.load(os.path.join('res', 'images', "info_bar", "mask", self.img_src_1)).convert_alpha() self.img_1.fill(self.panel.mainloop.cl.info_buttons_col, special_flags=pygame.BLEND_ADD) self.img_2 = pygame.image.load(os.path.join('res', 'images', "info_bar", "mask", self.img_src_2)).convert_alpha() self.img_2.fill(self.panel.mainloop.cl.info_buttons_col, special_flags=pygame.BLEND_ADD) self.img_4 = pygame.image.load( os.path.join('res', 'images', "info_bar", "decor", self.img_src_2)).convert_alpha() if self.img_src_3 != "": self.img_3 = pygame.image.load( os.path.join('res', 'images', "info_bar", self.img_src_3)).convert_alpha() if rev: self.img_1 = pygame.transform.flip(self.img_1, 1, 0) self.img_2 = pygame.transform.flip(self.img_2, 1, 0) self.img_4 = pygame.transform.flip(self.img_4, 1, 0) self.img = self.img_2 self.hasimg = True self.update()
Example #25
Source File: dialogwnd.py From eduActiv8 with GNU General Public License v3.0 | 5 votes |
def load_images(self): self.bg_tint_color = ex.hsv_to_rgb(self.mainloop.cl.color_sliders[5][0] * 16, 255, 100) self.font_color = ex.hsv_to_rgb(self.mainloop.cl.color_sliders[5][0] * 16, 255, 100) for each in self.elements: each.load_images() self.img_pos = (40, 40) try: #self.img = pygame.image.load(os.path.join('res', 'images', "dialog_bg.png")).convert_alpha() self.img1 = pygame.image.load(os.path.join('res', 'images', "dialog", "dialog_bg.png")).convert_alpha() self.img1.fill(self.bg_tint_color, special_flags=pygame.BLEND_ADD) self.img2 = pygame.image.load(os.path.join('res', 'images', "dialog", "dialog_bg_star.png")).convert_alpha() self.img2.fill(self.bg_tint_color, special_flags=pygame.BLEND_ADD) self.img3 = pygame.image.load( os.path.join('res', 'images', "dialog", "dialog_bg_d.png")).convert_alpha() self.img4 = pygame.image.load( os.path.join('res', 'images', "dialog", "dialog_bg_star_d.png")).convert_alpha() self.img5 = pygame.image.load( os.path.join('res', 'images', "dialog", "dialog_bg_allstar_d.png")).convert_alpha() self.images = [self.img1, self.img2] self.decors = [self.img3, self.img4, self.img5] except: pass
Example #26
Source File: universal.py From eduActiv8 with GNU General Public License v3.0 | 5 votes |
def get_tinted_img(self, tint_color): tinted_img = self.img.copy() tinted_img.fill(tint_color, special_flags=pygame.BLEND_ADD) return tinted_img
Example #27
Source File: particles.py From gamedev with MIT License | 5 votes |
def blit(self): return self.game.screen.blit(self.image, self.rect, special_flags=pygame.BLEND_ADD)
Example #28
Source File: surface_test.py From fxxkpython with GNU General Public License v3.0 | 5 votes |
def test_fill_keyword_args(self): """Ensure fill() accepts keyword arguments.""" color = (1, 2, 3, 255) area = (1, 1, 2, 2) s1 = pygame.Surface((4, 4), 0, 32) s1.fill(special_flags=pygame.BLEND_ADD, color=color, rect=area) self.assertEqual(s1.get_at((0, 0)), (0, 0, 0, 255)) self.assertEqual(s1.get_at((1, 1)), color) ########################################################################
Example #29
Source File: particles.py From gamedev with MIT License | 5 votes |
def blit(self): return self.game.screen.blit(self.image, self.rect, special_flags=pygame.BLEND_ADD)
Example #30
Source File: particles.py From gamedev with MIT License | 5 votes |
def blit(self): flags = pg.BLEND_ADD flags = pg.BLEND_RGBA_ADD return self.game.game_surface.blit(self.image, self.rect, special_flags=flags)