overlay - Pygame Documentation

pygame documentation | || Pygame Home || Help Contents || Reference Index || Camera || Cdrom || Color || Cursors || Display || Draw || Event || Examples || Font || Gfxdraw || Image || Joystick || Key || Locals || Mask || Midi || Mixer || Mouse || Movie || Music || Overlay || Pixelarray || Pygame || Rect || Scrap || Sndarray || Sprite || Surface || Surfarray || Tests || Time || Transform

pygame.Overlay

pygame object for video overlay graphics
`pygame.Overlay(format, (width, height)): return Overlay`

Overlay.display - set the overlay pixel data | set the overlay pixel data
Overlay.set_location - control where the overlay is displayed | control where the overlay is displayed
Overlay.get_hardware - test if the Overlay is hardware accelerated | 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, YUV2_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.

Overlay.display

set the overlay pixel data
`Overlay.display((y, u, v)): return None`
`Overlay.display(): return 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.

Overlay.set_location

control where the overlay is displayed
`Overlay.set_location(rect): return 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 - set the overlay pixel data`.

Overlay.get_hardware

test if the Overlay is hardware accelerated
`Overlay.get_hardware(rect): return int`

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