Should new pygmy surfaces be .convert () ed?

When you create a new Pygame surface:

pygame.Surface((width, height), flags=0, depth=0, masks=None)

      

Do you need to call .convert()

on it to change its pixel format, or is it already done for you when you create it?

+3


source to share


2 answers


convert

only used when changing pixel formats (for example, moving from indexing to rgb). By default the surface will be created with RGB and you only need to convert it if this is not what you want (it is almost always there).



+2


source


When you create a new surface, its format always matches (as much as possible) the format of the current display surface (regardless of what you set on the last call pygame.display.set_mode()

). You won't need convert

new surfaces if their format is the same as the display surface (alpha, for a single or indexed color, as the name suggests).

Note that if the new surface has an alpha depth (with or without formatted data), you will want to use convert_alpha()

.



From the docs: http://www.pygame.org/docs/ref/surface.html (Which may have been updated within nearly twenty months of the request.)

+1


source