Utils
brighten(image, amount)
Use brighten_color
to brighten all pixels in an image by amount
.
Parameters: |
|
---|
robingame/image/utils.py
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 |
|
brighten_color(color, amount)
Increase all channels to brighten a colour. Does not allow values greater than 255.
Parameters: |
|
---|
Returns: |
|
---|
robingame/image/utils.py
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
|
empty_image(*args, **kwargs)
Generate an empty Surface with .convert_alpha()
already called.
Returns: |
|
---|
robingame/image/utils.py
65 66 67 68 69 70 71 72 73 74 |
|
flip_image(image, flip_x=False, flip_y=False)
Return a flipped copy of an image.
Parameters: |
|
---|
Returns: |
|
---|
robingame/image/utils.py
170 171 172 173 174 175 176 177 178 179 180 181 182 |
|
flip_images(images, flip_x=False, flip_y=False)
Apply flip_image
to a list of images.
robingame/image/utils.py
185 186 187 188 189 |
|
init_display()
Make sure the pygame display is initialised (required for loading images). If the display already exists, return it. If not, generate a new 1x1 pixel display.
Returns: |
|
---|
robingame/image/utils.py
11 12 13 14 15 16 17 18 19 20 21 22 23 |
|
load_image(filename, colorkey=None)
Load an image. Abstracts away some of the pygame pitfalls.
Parameters: |
|
---|
Returns: |
|
---|
robingame/image/utils.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
|
load_image_sequence(pattern, colorkey=None, num_images=0)
Load a sequence of images.
Parameters: |
|
---|
Returns: |
|
---|
robingame/image/utils.py
277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 |
|
load_spritesheet(filename, image_size=None, colorkey=None, num_images=0)
Load the image file. Don't call this until pygame.display has been initiated. Split the spritesheet into images and return a list of images.
If image_size is None, load the whole spritesheet as one sprite.
Parameters: |
|
---|
Returns: |
|
---|
robingame/image/utils.py
233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 |
|
not_empty(surface)
Check if a surface has any non-zero pixels. Surface.get_bounding_rect()
returns the
smallest rectangle on the surface containing data. If the surface is empty, it will return
Rect(0, 0, 0, 0), for which any
returns False.
robingame/image/utils.py
56 57 58 59 60 61 62 |
|
pad_alpha(colour_tuple)
Add the 4th (alpha) channel to a length 3 color tuple. By default it sets the new alpha channel to full opacity (255).
Parameters: |
|
---|
Returns: |
|
---|
robingame/image/utils.py
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
|
recolor_image(surface, color_mapping)
Return a recolored copy of an image.
Parameters: |
|
---|
Returns: |
|
---|
robingame/image/utils.py
192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 |
|
recolor_images(images, colormap)
Apply recolor_image
to a list of images.
robingame/image/utils.py
226 227 228 229 230 |
|
scale_image(image, scale)
Return a scaled copy of an image.
Parameters: |
|
---|
Returns: |
|
---|
robingame/image/utils.py
147 148 149 150 151 152 153 154 155 156 157 158 159 160 |
|
scale_images(images, scale)
Apply scale_image
to a list of images.
robingame/image/utils.py
163 164 165 166 167 |
|