4 examples of 'pygame.surface.fill' in Python

Every line of 'pygame.surface.fill' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
256def color_surface(self, surface, original, newcolor):
257 arr = pygame.surfarray.pixels3d(surface)
258
259 r1, g1, b1 = original
260 r2, g2, b2 = newcolor
261 red, green, blue = arr[:, :, 0], arr[:, :, 1], arr[:, :, 2]
262 mask = (red >= r1) & (green >= g1) & (blue >= b1)
263 arr[:, :, :3][mask] = [r2, g2, b2]
150def show_surfaces(self, surf, pictype, x, y, x_delta, height,
151 glob_alpha, pp_rgba, mode):
152
153 yh = y + height
154 #pure surface
155 self.screen.blit(surf, (x, y))
156 self.write(x, y + height, "%s pure" % pictype)
157 # with with colorkey
158 ck_surf = surf.copy()
159 ck_surf.set_colorkey((255,255,255))
160 x = x + x_delta
161 self.screen.blit(ck_surf, (x, y))
162 self.write(x, yh, "%s colorkey" % pictype)
163 # with alpha for whole surface
164 alpha_surf = surf.copy()
165 alpha_surf.set_alpha(glob_alpha)
166 x = x + x_delta
167 self.screen.blit(alpha_surf, (x, y))
168 self.write(x, yh, "%s alpha> %d" % (pictype, glob_alpha))
169 # with per-pixel alpha
170 ppa_surf = surf.copy()
171 ppa_surf = get_alpha_surface(ppa_surf, pp_rgba, mode)
172 x = x + x_delta
173 self.screen.blit(ppa_surf, (x, y))
174 self.write(x, yh, "%s, per-pixel-alpha" % pictype)
357def draw(self, surface):
358 surface.blit(self.pic, (0, 0))
60def draw(self, surface):
61 if self._apple_image is not None:
62 surface.blit(self._apple_image, (self.x, self.y))
63 else:
64 pygame.draw.rect(surface, self.color,
65 (self.x, self.y, self.size, self.size), 0)

Related snippets