Overlayオブジェクトを使用することで、ハードウェアのビデオオーバーレイ機能を制御することができます。 ビデオオーバーレイ機能では標準的なRGB形式の描写方法は使用せず、データの複数の解像度を使用して一枚の画像を描写します。
Overlayオブジェクトは、画面表示処理におけるハードウェア寄りの低級領域を操作することができます。このオブジェクトを使いこなすには、ビデオオーバーレイ機能の技術的な詳細を理解しなければなりません。
オーバーレイの形式によって、使用されるピクセルデータの種類も変わります。ハードウェアによってはサポートされていないオーバーレイ形式もあります。なお、pygameで使用できるオーバーレイ形式は下記の通りです。:
YV12_OVERLAY, IYUV_OVERLAY, YUV2_OVERLAY, UYVY_OVERLAY, YVYU_OVERLAY
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, 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.
SDLのオーバーレイプレーンにyuv形式のデータを表示します。y引数、u引数、v引数には、バイナリデータの文字列を設定します。引数として設定する値は、オーバーレイを作るのに正常に使用できる形式のものでなければなりません。
引数を設定しなかった場合、オーバーレイは単に現在設定されている色で再描写されます。この命令は、オーバーレイでハードウェアアクセラレーションが行えない場合に有効です.
引数のチェックは行われないのため、不適切な値を設定した場合はプログラムがクラッシュしてしまうこともあります。
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.
オーバーレイの位置を設定します。設定される位置は、メインの画面表示Surface上での描写位置となります。この命令を実行しても自動的に再描写が行われるわけではないので、後からOverlay.display命令を実行してオーバーレイの更新をしてください。
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.
オーバーレイで、ハードウェア側での高速な描写処理が行える場合はTrueが戻り値として返ります。行えない環境の場合は、ソフトウェア側での描写処理が行われます。
Returns a True value when the Overlay is hardware accelerated. If the platform does not support acceleration, software rendering is used.