Skip to content
Yoann Berenguer edited this page Apr 4, 2022 · 24 revisions

Welcome to the PygameShader wiki!

rgb_to_bgr(object surface_) -> void:

    :param surface_    : Pygame surface or display surface compatible (image 24-32 bit with or 
                         without per-pixel transparency / alpha channel)
    :return             : void

This shader change a given pygame surface with RGB (red green, blue) pixel model to an equivalent BGR (blue, green, red) model instead. This method will also works with surface format different to RGB model, the shader will swap both channels (red & blue)
The argument surface_ represent a pygame surface object. The surface is either 24 - 32 bit with or without per-pixel transparency (Per pixel alphas are different because they store a transparency value for every pixel).

Surfaces with 8 - bit pixels are not compatible.

This "function" does not return any object (void) and the surface passed as an argument will be change inplace. Consequently, the surface will have the same attributes that the original surface/texture
The function will hold a pygame lock while processing the given surface If the surface is own by another process (locked), the function will raise an error message. Please refer to pygame documentation regarding the lock/unlock functionalities if necessary If the surface is already a BGR model then the output surface will revert to an RGB surface.

Clone this wiki locally