Source

pygame / docs / ref / overlay.html

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>pygame.Overlay &mdash; Pygame v1.9.2 documentation</title>
    <link rel="stylesheet" href="../_static/pygame.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '../',
        VERSION:     '1.9.2',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="../_static/jquery.js"></script>
    <script type="text/javascript" src="../_static/underscore.js"></script>
    <script type="text/javascript" src="../_static/doctools.js"></script>
    <link rel="shortcut icon" href="../_static/pygame.ico"/>
    <link rel="top" title="Pygame v1.9.2 documentation" href="../index.html" />
    <link rel="next" title="pygame.PixelArray" href="pixelarray.html" />
    <link rel="prev" title="pygame.mixer.music" href="music.html" /> 
  </head>
  <body>  

    <div class="document">

  <div class="header">
    <table>
      <tr>
	<td class="logo">
	  <a href="http://www.pygame.org/">
	    <img src="../_static/pygame_tiny.png"/>
	  </a>
	  <h5>pygame documentation</h5>
	</td>
	<td class="pagelinks">
	  <p class="top">
	    ||
	    <a href="http://www.pygame.org/">Pygame Home</a> ||
	    <a href="../index.html">Help Contents</a> ||
	    <a href="../genindex.html">Reference Index</a> ||
	  </p>
	  <p class="bottom">
	    <a href="camera.html">camera</a> || 
	    <a href="cdrom.html">cdrom</a> || 
	    <a href="color.html">Color</a> || 
	    <a href="cursors.html">cursors</a> || 
	    <a href="display.html">display</a> || 
	    <a href="draw.html">draw</a> || 
	    <a href="event.html">event</a> || 
	    <a href="examples.html">examples</a> || 
	    <a href="font.html">font</a> || 
	    <a href="freetype.html">freetype</a> || 
	    <a href="gfxdraw.html">gfxdraw</a> || 
	    <a href="image.html">image</a> || 
	    <a href="joystick.html">joystick</a> || 
	    <a href="key.html">key</a> || 
	    <a href="locals.html">locals</a> || 
	    <a href="mask.html">mask</a> || 
	    <a href="math.html">math</a> || 
	    <a href="midi.html">midi</a> || 
	    <a href="mixer.html">mixer</a> || 
	    <a href="mouse.html">mouse</a> || 
	    <a href="movie.html">movie</a> || 
	    <a href="music.html">music</a> || 
	    <a href="overlay.html">Overlay</a> || 
	    <a href="pixelarray.html">PixelArray</a> || 
	    <a href="pixelcopy.html">pixelcopy</a> || 
	    <a href="pygame.html">pygame</a> || 
	    <a href="rect.html">Rect</a> || 
	    <a href="scrap.html">scrap</a> || 
	    <a href="sndarray.html">sndarray</a> || 
	    <a href="sprite.html">sprite</a> || 
	    <a href="surface.html">Surface</a> || 
	    <a href="surfarray.html">surfarray</a> || 
	    <a href="tests.html">tests</a> || 
	    <a href="time.html">time</a> || 
	    <a href="transform.html">transform</a> || 
	    <a href="pygame.html#module-pygame.version">version</a>
	  </p>
	</td>
      </tr>
    </table>
  </div>

      <div class="documentwrapper">
          <div class="body">
            
  <div class="sectionwrapper">
<div class="section" id="pygame-overlay">
<dl class="definition class">
<dt class="title" id="pygame.Overlay">
<em class="property">class </em><tt class="descclassname">pygame.</tt><tt class="descname">Overlay</tt><a class="headerlink" href="#pygame.Overlay" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">pygame object for video overlay graphics</span></div>
<div class="line"><span class="signature">Overlay(format, (width, height)) -&gt; Overlay</span></div>
</div>
<table border="1" class="toc docutils">
<colgroup>
<col width="35%" />
<col width="1%" />
<col width="64%" />
</colgroup>
<tbody valign="top">
<tr><td><a class="toc reference external" href="overlay.html#pygame.Overlay.display">pygame.Overlay.display</a></td>
<td></td>
<td>set the overlay pixel data</td>
</tr>
<tr><td><a class="toc reference external" href="overlay.html#pygame.Overlay.set_location">pygame.Overlay.set_location</a></td>
<td></td>
<td>control where the overlay is displayed</td>
</tr>
<tr><td><a class="toc reference external" href="overlay.html#pygame.Overlay.get_hardware">pygame.Overlay.get_hardware</a></td>
<td></td>
<td>test if the Overlay is hardware accelerated</td>
</tr>
</tbody>
</table>
<p>The Overlay objects provide support for accessing hardware video overlays.
Video overlays do not use standard <tt class="docutils literal"><span class="pre">RGB</span></tt> pixel formats, and can use
multiple resolutions of data to create a single image.</p>
<p>The Overlay objects represent lower level access to the display hardware. To
use the object you must understand the technical details of video overlays.</p>
<p>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:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">YV12_OVERLAY</span><span class="p">,</span> <span class="n">IYUV_OVERLAY</span><span class="p">,</span> <span class="n">YUV2_OVERLAY</span><span class="p">,</span> <span class="n">UYVY_OVERLAY</span><span class="p">,</span> <span class="n">YVYU_OVERLAY</span>
</pre></div>
</div>
<p>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.</p>
<p>The overlay objects are always visible, and always show above the regular
display contents.</p>
<dl class="definition method">
<dt class="title" id="pygame.Overlay.display">
<tt class="descname">display</tt><big>(</big><big>)</big><a class="headerlink" href="#pygame.Overlay.display" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">set the overlay pixel data</span></div>
<div class="line"><span class="signature">display((y, u, v)) -&gt; None</span></div>
<div class="line"><span class="signature">display() -&gt; None</span></div>
</div>
<p>Display the yuv data in SDL&#8217;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.</p>
<p>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.</p>
<p>The strings are not validated, and improperly sized strings could crash
the program.</p>
</dd></dl>

<dl class="definition method">
<dt class="title" id="pygame.Overlay.set_location">
<tt class="descname">set_location</tt><big>(</big><big>)</big><a class="headerlink" href="#pygame.Overlay.set_location" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">control where the overlay is displayed</span></div>
<div class="line"><span class="signature">set_location(rect) -&gt; None</span></div>
</div>
<p>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 <tt class="docutils literal"><span class="pre">Overlay.display()</span></tt>.</p>
</dd></dl>

<dl class="definition method">
<dt class="title" id="pygame.Overlay.get_hardware">
<tt class="descname">get_hardware</tt><big>(</big><big>)</big><a class="headerlink" href="#pygame.Overlay.get_hardware" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">test if the Overlay is hardware accelerated</span></div>
<div class="line"><span class="signature">get_hardware(rect) -&gt; int</span></div>
</div>
<p>Returns a True value when the Overlay is hardware accelerated. If the
platform does not support acceleration, software rendering is used.</p>
</dd></dl>

</dd></dl>

</div>

  </div>
          </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="pixelarray.html" title="pygame.PixelArray"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="music.html" title="pygame.mixer.music"
             accesskey="P">previous</a> |</li>
        <li><a href="../index.html">Pygame v1.9.2 documentation</a> &raquo;</li>
    <script type="text/javascript" src="jquery.plugin.docscomments.js"></script>

      </ul>
    </div>
    <div class="footer">
        &copy; Copyright 2011, Pygame Developers.
    </div>
  </body>
</html>
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.