pygame.Overlay
pygame object for video overlay graphics
Overlay(format, (width, height)) -> Overlay

pygame.Overlay.display

set the overlay pixel data

pygame.Overlay.set_location

control where the overlay is displayed

pygame.Overlay.get_hardware

test if the Overlay is hardware accelerated

The Overlay objects provide support for accessing hardware video overlays. Video overlays do not use standard RGB pixel formats, and can use multiple resolutions of data to create a single image.

The Overlay objects represent lower level access to the display hardware. To use the object you must understand the technical details of video overlays.

The Overlay format determines the type of pixel data used. Not all hardware will support all types of overlay formats. Here is a list of available format types:

YV12_OVERLAY, IYUV_OVERLAY, YUY2_OVERLAY, UYVY_OVERLAY, YVYU_OVERLAY

The width and height arguments control the size for the overlay image data. The overlay image can be displayed at any size, not just the resolution of the overlay.

The overlay objects are always visible, and always show above the regular display contents.

display()
set the overlay pixel data
display((y, u, v)) -> None
display() -> None

Display the YUV data in SDL's overlay planes. The y, u, and v arguments are strings of binary data. The data must be in the correct format used to create the Overlay.

If no argument is passed in, the Overlay will simply be redrawn with the current data. This can be useful when the Overlay is not really hardware accelerated.

The strings are not validated, and improperly sized strings could crash the program.

set_location()
control where the overlay is displayed
set_location(rect) -> None

Set the location for the overlay. The overlay will always be shown relative to the main display Surface. This does not actually redraw the overlay, it will be updated on the next call to Overlay.display().

get_hardware()
test if the Overlay is hardware accelerated
get_hardware(rect) -> int

Returns a True value when the Overlay is hardware accelerated. If the platform does not support acceleration, software rendering is used.




Edit on GitHub