W3cubDocs

/Pygame

pygame.Overlay

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

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((y, u, v)) -> None
display() -> None

set the overlay pixel data

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(rect) -> None

control where the overlay is displayed

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(rect) -> int

test if the Overlay is hardware accelerated

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




Edit on GitHub

© Pygame Developers.
Licensed under the GNU LGPL License version 2.1.
https://www.pygame.org/docs/ref/overlay.html