1. pygame
  2. pygame
  3. pygame

Commits

pygame  committed 11d322f

Overlay objects added

  • Participants
  • Parent commits 405796d
  • Branches default

Comments (0)

Files changed (41)

File Setup.in

View file
  • Ignore whitespace
 joystick src/joystick.c $(SDL)
 draw src/draw.c $(SDL)
 image src/image.c $(SDL)
+overlay src/overlay.c $(SDL)
 transform src/transform.c src/rotozoom.c src/scale2x.c $(SDL)
 
 

File WHATSNEW

View file
  • Ignore whitespace
     mixer.set_num_channels() no longer crashes [BUG]
     mixer.music.get_pos() properly tracks when paused
     pygame.display.get_wm_info() added, gets a dictionary
+    Overlay object, from Dmitry Borisov
 
 July 6, 2004
     Sound object newstyle types

File docs/index.html

View file
  • Ignore whitespace
 <a href=ref/Font.html>Font</a> || 
 <a href=ref/Joystick.html>Joystick</a> || 
 <a href=ref/Movie.html>Movie</a> ||<br>
-|| <a href=ref/Rect.html>Rect</a> || 
+|| <a href=ref/Overlay.html>Overlay</a> || 
+<a href=ref/Rect.html>Rect</a> || 
 <a href=ref/Sound.html>Sound</a> || 
 <a href=ref/Surface.html>Surface</a> ||<br>
 &nbsp;<br>|| <a href=ref/pygame_color.html>color</a> || 
 <a href=ref/Movie.html#skip>Movie.skip</a> - skip the movie playback position forward<br>
 <a href=ref/Movie.html#stop>Movie.stop</a> - stop movie playback<br>
 <a href=ref/Movie.html#stop>Movie.stop</a> - stop movie playback<br>
+<a href=ref/Overlay.html#display>Overlay.display</a> - display the yuv data<br>
+<a href=ref/Overlay.html#set_location>Overlay.set_location</a> - set overlay location<br>
 <a href=ref/Rect.html#clamp>Rect.clamp</a> - move rectangle inside another<br>
 <a href=ref/Rect.html#clamp_ip>Rect.clamp_ip</a> - moves the rectangle inside another<br>
 <a href=ref/Rect.html#clip>Rect.clip</a> - rectangle cropped inside another<br>
 <a href=ref/Surface.html#subsurface>Surface.subsurface</a> - create a new surface that shares pixel data<br>
 <a href=ref/Surface.html#unlock>Surface.unlock</a> - locks Surface for pixel access<br>
 <a href=ref/Surface.html#unmap_rgb>Surface.unmap_rgb</a> - convert mapped color into RGB<br>
+<a href=ref/pygame.html#Overlay>pygame.Overlay</a> - Create a new video overlay object<br>
 <a href=ref/pygame.html#Rect>pygame.Rect</a> - create a new rectangle<br>
 <a href=ref/pygame.html#Surface>pygame.Surface</a> - create a new Surface<br>
 <a href=ref/pygame.html#get_error>pygame.get_error</a> - get current error message<br>

File docs/ref/CD.html

View file
  • Ignore whitespace
 <a href=Font.html>Font</a> || 
 <a href=Joystick.html>Joystick</a> || 
 <a href=Movie.html>Movie</a> ||<br>
-|| <a href=Rect.html>Rect</a> || 
+|| <a href=Overlay.html>Overlay</a> || 
+<a href=Rect.html>Rect</a> || 
 <a href=Sound.html>Sound</a> || 
 <a href=Surface.html>Surface</a> ||<br>
 &nbsp;<br>|| <a href=pygame_color.html>color</a> || 

File docs/ref/Channel.html

View file
  • Ignore whitespace
 <a href=Font.html>Font</a> || 
 <a href=Joystick.html>Joystick</a> || 
 <a href=Movie.html>Movie</a> ||<br>
-|| <a href=Rect.html>Rect</a> || 
+|| <a href=Overlay.html>Overlay</a> || 
+<a href=Rect.html>Rect</a> || 
 <a href=Sound.html>Sound</a> || 
 <a href=Surface.html>Surface</a> ||<br>
 &nbsp;<br>|| <a href=pygame_color.html>color</a> || 

File docs/ref/Clock.html

View file
  • Ignore whitespace
 <a href=Font.html>Font</a> || 
 <a href=Joystick.html>Joystick</a> || 
 <a href=Movie.html>Movie</a> ||<br>
-|| <a href=Rect.html>Rect</a> || 
+|| <a href=Overlay.html>Overlay</a> || 
+<a href=Rect.html>Rect</a> || 
 <a href=Sound.html>Sound</a> || 
 <a href=Surface.html>Surface</a> ||<br>
 &nbsp;<br>|| <a href=pygame_color.html>color</a> || 

File docs/ref/Font.html

View file
  • Ignore whitespace
 <a href=Font.html>Font</a> || 
 <a href=Joystick.html>Joystick</a> || 
 <a href=Movie.html>Movie</a> ||<br>
-|| <a href=Rect.html>Rect</a> || 
+|| <a href=Overlay.html>Overlay</a> || 
+<a href=Rect.html>Rect</a> || 
 <a href=Sound.html>Sound</a> || 
 <a href=Surface.html>Surface</a> ||<br>
 &nbsp;<br>|| <a href=pygame_color.html>color</a> || 

File docs/ref/Joystick.html

View file
  • Ignore whitespace
 <a href=Font.html>Font</a> || 
 <a href=Joystick.html>Joystick</a> || 
 <a href=Movie.html>Movie</a> ||<br>
-|| <a href=Rect.html>Rect</a> || 
+|| <a href=Overlay.html>Overlay</a> || 
+<a href=Rect.html>Rect</a> || 
 <a href=Sound.html>Sound</a> || 
 <a href=Surface.html>Surface</a> ||<br>
 &nbsp;<br>|| <a href=pygame_color.html>color</a> || 

File docs/ref/Movie.html

View file
  • Ignore whitespace
 <a href=Font.html>Font</a> || 
 <a href=Joystick.html>Joystick</a> || 
 <a href=Movie.html>Movie</a> ||<br>
-|| <a href=Rect.html>Rect</a> || 
+|| <a href=Overlay.html>Overlay</a> || 
+<a href=Rect.html>Rect</a> || 
 <a href=Sound.html>Sound</a> || 
 <a href=Surface.html>Surface</a> ||<br>
 &nbsp;<br>|| <a href=pygame_color.html>color</a> || 

File docs/ref/Overlay.html

View file
  • Ignore whitespace
+<html>
+<title>Overlay</title>
+<body bgcolor=#aaeebb text=#000000 link=#331111 vlink=#331111>
+
+
+<table cellspacing=3 width=100%><tr><td bgcolor=#00000>
+<table width=100%><tr><td bgcolor=c2fc20 align=center>
+    <a href=http://www.pygame.org>
+    <img src=../pygame_tiny.gif border=0 width=200 height=60></a><br>
+    <b>pygame&nbsp;&nbsp;&nbsp;documentation</b>
+</td><td bgcolor=6aee28 align=center valign=top width=100%>
+
+	||&nbsp;
+	<a href=http://www.pygame.org>Home</a> &nbsp;||&nbsp;
+	<a href=../index.html>Help Contents</a> &nbsp;||
+	<br>&nbsp;<br>
+
+|| <a href=pygame.html>pygame</a> || 
+<a href=pygame_cdrom.html>cdrom</a> || 
+<a href=pygame_constants.html>constants</a> || 
+<a href=pygame_cursor.html>cursor</a> || 
+<a href=pygame_display.html>display</a> || 
+<a href=pygame_draw.html>draw</a> ||<br>
+|| <a href=pygame_event.html>event</a> || 
+<a href=pygame_font.html>font</a> || 
+<a href=pygame_image.html>image</a> || 
+<a href=pygame_joystick.html>joystick</a> || 
+<a href=pygame_key.html>key</a> || 
+<a href=pygame_mixer.html>mixer</a> ||<br>
+|| <a href=pygame_mixer_music.html>mixer_music</a> || 
+<a href=pygame_mouse.html>mouse</a> || 
+<a href=pygame_movie.html>movie</a> || 
+<a href=pygame_sndarray.html>sndarray</a> || 
+<a href=pygame_surfarray.html>surfarray</a> || 
+<a href=pygame_time.html>time</a> ||<br>
+|| <a href=pygame_transform.html>transform</a> ||<br>
+&nbsp;<br>|| <a href=CD.html>CD</a> || 
+<a href=Channel.html>Channel</a> || 
+<a href=Clock.html>Clock</a> || 
+<a href=Font.html>Font</a> || 
+<a href=Joystick.html>Joystick</a> || 
+<a href=Movie.html>Movie</a> ||<br>
+|| <a href=Overlay.html>Overlay</a> || 
+<a href=Rect.html>Rect</a> || 
+<a href=Sound.html>Sound</a> || 
+<a href=Surface.html>Surface</a> ||<br>
+&nbsp;<br>|| <a href=pygame_color.html>color</a> || 
+<a href=pygame_cursors.html>cursors</a> || 
+<a href=pygame_sprite.html>sprite</a> ||<br>
+
+
+</td></tr></table></td></tr></table>
+<br>
+<h2 align=center>Overlay</h2>
+<a href=pygame.html#Overlay>pygame.Overlay(pixeltype, [width, height])</a> -> Overlay
+Create a new video overlay object
+<br>&nbsp;<br>
+This creates a new Overlay object. Overlays represent a basic
+interface for putting YUV image data into the graphics card's
+video overlay planes. This is a low level object intended for
+use by people who know what they are doing, and have pregenerated
+YUV image data.
+The pixeltype argument must be one of the pygame constants;
+YV12_OVERLAY, IYUV_OVERLAY, YUV2_OVERLAY, UYVY_OVERLAY, or YVYU_OVERLAY.
+<br>&nbsp;<br>
+<br>&nbsp;<br>
+
+<hr>
+
+<table>
+<tr><td><a href=#display>display</a></td><td> -
+display the yuv data</td></tr>
+
+
+<tr><td><a href=#set_location>set_location</a></td><td> -
+set overlay location</td></tr>
+
+
+</table>
+
+<hr>
+
+<a name=display><font size=+2><b>display
+</b></font><br><font size=+1><tt>
+Overlay.display(y, u, v) -> None
+</tt></font><ul>
+Display the yuv data in SDL's overlay planes. The y, u, and v
+arguments represents strings of byte data.
+</ul><br>&nbsp;<br>
+
+<a name=set_location><font size=+2><b>set_location
+</b></font><br><font size=+1><tt>
+Overlay.set_location(rectstyle) -> None
+</tt></font><ul>
+Sets location for the overlay on a screen.
+This does not move or redraw any currently displayed data,
+it only sets the position for newly <a href=#display>display()</a> calls.
+</ul><br>&nbsp;<br>
+
+
+<hr>
+</body></html>

File docs/ref/Rect.html

View file
  • Ignore whitespace
 <a href=Font.html>Font</a> || 
 <a href=Joystick.html>Joystick</a> || 
 <a href=Movie.html>Movie</a> ||<br>
-|| <a href=Rect.html>Rect</a> || 
+|| <a href=Overlay.html>Overlay</a> || 
+<a href=Rect.html>Rect</a> || 
 <a href=Sound.html>Sound</a> || 
 <a href=Surface.html>Surface</a> ||<br>
 &nbsp;<br>|| <a href=pygame_color.html>color</a> || 

File docs/ref/Sound.html

View file
  • Ignore whitespace
 <a href=Font.html>Font</a> || 
 <a href=Joystick.html>Joystick</a> || 
 <a href=Movie.html>Movie</a> ||<br>
-|| <a href=Rect.html>Rect</a> || 
+|| <a href=Overlay.html>Overlay</a> || 
+<a href=Rect.html>Rect</a> || 
 <a href=Sound.html>Sound</a> || 
 <a href=Surface.html>Surface</a> ||<br>
 &nbsp;<br>|| <a href=pygame_color.html>color</a> || 

File docs/ref/Surface.html

View file
  • Ignore whitespace
 <a href=Font.html>Font</a> || 
 <a href=Joystick.html>Joystick</a> || 
 <a href=Movie.html>Movie</a> ||<br>
-|| <a href=Rect.html>Rect</a> || 
+|| <a href=Overlay.html>Overlay</a> || 
+<a href=Rect.html>Rect</a> || 
 <a href=Sound.html>Sound</a> || 
 <a href=Surface.html>Surface</a> ||<br>
 &nbsp;<br>|| <a href=pygame_color.html>color</a> || 

File docs/ref/pygame.html

View file
  • Ignore whitespace
 <a href=Font.html>Font</a> || 
 <a href=Joystick.html>Joystick</a> || 
 <a href=Movie.html>Movie</a> ||<br>
-|| <a href=Rect.html>Rect</a> || 
+|| <a href=Overlay.html>Overlay</a> || 
+<a href=Rect.html>Rect</a> || 
 <a href=Sound.html>Sound</a> || 
 <a href=Surface.html>Surface</a> ||<br>
 &nbsp;<br>|| <a href=pygame_color.html>color</a> || 
 <hr>
 
 <table>
+<tr><td><a href=#Overlay>Overlay</a></td><td> -
+Create a new video overlay object</td></tr>
+
+
 <tr><td><a href=#Rect>Rect</a></td><td> -
 create a new rectangle</td></tr>
 
 
 <hr>
 
+<a name=Overlay><font size=+2><b>Overlay
+</b></font><br><font size=+1><tt>
+pygame.Overlay(pixeltype, [width, height]) -> Overlay
+</tt></font><ul>
+This creates a new Overlay object. Overlays represent a basic
+interface for putting YUV image data into the graphics card's
+video overlay planes. This is a low level object intended for
+use by people who know what they are doing, and have pregenerated
+YUV image data.
+The pixeltype argument must be one of the pygame constants;
+YV12_OVERLAY, IYUV_OVERLAY, YUV2_OVERLAY, UYVY_OVERLAY, or YVYU_OVERLAY.
+<br>&nbsp;<br>
+</ul><br>&nbsp;<br>
+
 <a name=Rect><font size=+2><b>Rect
 </b></font><br><font size=+1><tt>
 pygame.Rect(rectstyle) -> Rect

File docs/ref/pygame_cdrom.html

View file
  • Ignore whitespace
 <a href=Font.html>Font</a> || 
 <a href=Joystick.html>Joystick</a> || 
 <a href=Movie.html>Movie</a> ||<br>
-|| <a href=Rect.html>Rect</a> || 
+|| <a href=Overlay.html>Overlay</a> || 
+<a href=Rect.html>Rect</a> || 
 <a href=Sound.html>Sound</a> || 
 <a href=Surface.html>Surface</a> ||<br>
 &nbsp;<br>|| <a href=pygame_color.html>color</a> || 

File docs/ref/pygame_color.html

View file
  • Ignore whitespace
 <a href=Font.html>Font</a> || 
 <a href=Joystick.html>Joystick</a> || 
 <a href=Movie.html>Movie</a> ||<br>
-|| <a href=Rect.html>Rect</a> || 
+|| <a href=Overlay.html>Overlay</a> || 
+<a href=Rect.html>Rect</a> || 
 <a href=Sound.html>Sound</a> || 
 <a href=Surface.html>Surface</a> ||<br>
 &nbsp;<br>|| <a href=pygame_color.html>color</a> || 

File docs/ref/pygame_constants.html

View file
  • Ignore whitespace
 <a href=Font.html>Font</a> || 
 <a href=Joystick.html>Joystick</a> || 
 <a href=Movie.html>Movie</a> ||<br>
-|| <a href=Rect.html>Rect</a> || 
+|| <a href=Overlay.html>Overlay</a> || 
+<a href=Rect.html>Rect</a> || 
 <a href=Sound.html>Sound</a> || 
 <a href=Surface.html>Surface</a> ||<br>
 &nbsp;<br>|| <a href=pygame_color.html>color</a> || 

File docs/ref/pygame_cursors.html

View file
  • Ignore whitespace
 <a href=Font.html>Font</a> || 
 <a href=Joystick.html>Joystick</a> || 
 <a href=Movie.html>Movie</a> ||<br>
-|| <a href=Rect.html>Rect</a> || 
+|| <a href=Overlay.html>Overlay</a> || 
+<a href=Rect.html>Rect</a> || 
 <a href=Sound.html>Sound</a> || 
 <a href=Surface.html>Surface</a> ||<br>
 &nbsp;<br>|| <a href=pygame_color.html>color</a> || 

File docs/ref/pygame_display.html

View file
  • Ignore whitespace
 <a href=Font.html>Font</a> || 
 <a href=Joystick.html>Joystick</a> || 
 <a href=Movie.html>Movie</a> ||<br>
-|| <a href=Rect.html>Rect</a> || 
+|| <a href=Overlay.html>Overlay</a> || 
+<a href=Rect.html>Rect</a> || 
 <a href=Sound.html>Sound</a> || 
 <a href=Surface.html>Surface</a> ||<br>
 &nbsp;<br>|| <a href=pygame_color.html>color</a> || 

File docs/ref/pygame_draw.html

View file
  • Ignore whitespace
 <a href=Font.html>Font</a> || 
 <a href=Joystick.html>Joystick</a> || 
 <a href=Movie.html>Movie</a> ||<br>
-|| <a href=Rect.html>Rect</a> || 
+|| <a href=Overlay.html>Overlay</a> || 
+<a href=Rect.html>Rect</a> || 
 <a href=Sound.html>Sound</a> || 
 <a href=Surface.html>Surface</a> ||<br>
 &nbsp;<br>|| <a href=pygame_color.html>color</a> || 

File docs/ref/pygame_event.html

View file
  • Ignore whitespace
 <a href=Font.html>Font</a> || 
 <a href=Joystick.html>Joystick</a> || 
 <a href=Movie.html>Movie</a> ||<br>
-|| <a href=Rect.html>Rect</a> || 
+|| <a href=Overlay.html>Overlay</a> || 
+<a href=Rect.html>Rect</a> || 
 <a href=Sound.html>Sound</a> || 
 <a href=Surface.html>Surface</a> ||<br>
 &nbsp;<br>|| <a href=pygame_color.html>color</a> || 

File docs/ref/pygame_font.html

View file
  • Ignore whitespace
 <a href=Font.html>Font</a> || 
 <a href=Joystick.html>Joystick</a> || 
 <a href=Movie.html>Movie</a> ||<br>
-|| <a href=Rect.html>Rect</a> || 
+|| <a href=Overlay.html>Overlay</a> || 
+<a href=Rect.html>Rect</a> || 
 <a href=Sound.html>Sound</a> || 
 <a href=Surface.html>Surface</a> ||<br>
 &nbsp;<br>|| <a href=pygame_color.html>color</a> || 

File docs/ref/pygame_image.html

View file
  • Ignore whitespace
 <a href=Font.html>Font</a> || 
 <a href=Joystick.html>Joystick</a> || 
 <a href=Movie.html>Movie</a> ||<br>
-|| <a href=Rect.html>Rect</a> || 
+|| <a href=Overlay.html>Overlay</a> || 
+<a href=Rect.html>Rect</a> || 
 <a href=Sound.html>Sound</a> || 
 <a href=Surface.html>Surface</a> ||<br>
 &nbsp;<br>|| <a href=pygame_color.html>color</a> || 

File docs/ref/pygame_joystick.html

View file
  • Ignore whitespace
 <a href=Font.html>Font</a> || 
 <a href=Joystick.html>Joystick</a> || 
 <a href=Movie.html>Movie</a> ||<br>
-|| <a href=Rect.html>Rect</a> || 
+|| <a href=Overlay.html>Overlay</a> || 
+<a href=Rect.html>Rect</a> || 
 <a href=Sound.html>Sound</a> || 
 <a href=Surface.html>Surface</a> ||<br>
 &nbsp;<br>|| <a href=pygame_color.html>color</a> || 

File docs/ref/pygame_key.html

View file
  • Ignore whitespace
 <a href=Font.html>Font</a> || 
 <a href=Joystick.html>Joystick</a> || 
 <a href=Movie.html>Movie</a> ||<br>
-|| <a href=Rect.html>Rect</a> || 
+|| <a href=Overlay.html>Overlay</a> || 
+<a href=Rect.html>Rect</a> || 
 <a href=Sound.html>Sound</a> || 
 <a href=Surface.html>Surface</a> ||<br>
 &nbsp;<br>|| <a href=pygame_color.html>color</a> || 

File docs/ref/pygame_mixer.html

View file
  • Ignore whitespace
 <a href=Font.html>Font</a> || 
 <a href=Joystick.html>Joystick</a> || 
 <a href=Movie.html>Movie</a> ||<br>
-|| <a href=Rect.html>Rect</a> || 
+|| <a href=Overlay.html>Overlay</a> || 
+<a href=Rect.html>Rect</a> || 
 <a href=Sound.html>Sound</a> || 
 <a href=Surface.html>Surface</a> ||<br>
 &nbsp;<br>|| <a href=pygame_color.html>color</a> || 

File docs/ref/pygame_mixer_music.html

View file
  • Ignore whitespace
 <a href=Font.html>Font</a> || 
 <a href=Joystick.html>Joystick</a> || 
 <a href=Movie.html>Movie</a> ||<br>
-|| <a href=Rect.html>Rect</a> || 
+|| <a href=Overlay.html>Overlay</a> || 
+<a href=Rect.html>Rect</a> || 
 <a href=Sound.html>Sound</a> || 
 <a href=Surface.html>Surface</a> ||<br>
 &nbsp;<br>|| <a href=pygame_color.html>color</a> || 

File docs/ref/pygame_mouse.html

View file
  • Ignore whitespace
 <a href=Font.html>Font</a> || 
 <a href=Joystick.html>Joystick</a> || 
 <a href=Movie.html>Movie</a> ||<br>
-|| <a href=Rect.html>Rect</a> || 
+|| <a href=Overlay.html>Overlay</a> || 
+<a href=Rect.html>Rect</a> || 
 <a href=Sound.html>Sound</a> || 
 <a href=Surface.html>Surface</a> ||<br>
 &nbsp;<br>|| <a href=pygame_color.html>color</a> || 

File docs/ref/pygame_movie.html

View file
  • Ignore whitespace
 <a href=Font.html>Font</a> || 
 <a href=Joystick.html>Joystick</a> || 
 <a href=Movie.html>Movie</a> ||<br>
-|| <a href=Rect.html>Rect</a> || 
+|| <a href=Overlay.html>Overlay</a> || 
+<a href=Rect.html>Rect</a> || 
 <a href=Sound.html>Sound</a> || 
 <a href=Surface.html>Surface</a> ||<br>
 &nbsp;<br>|| <a href=pygame_color.html>color</a> || 

File docs/ref/pygame_sndarray.html

View file
  • Ignore whitespace
 <a href=Font.html>Font</a> || 
 <a href=Joystick.html>Joystick</a> || 
 <a href=Movie.html>Movie</a> ||<br>
-|| <a href=Rect.html>Rect</a> || 
+|| <a href=Overlay.html>Overlay</a> || 
+<a href=Rect.html>Rect</a> || 
 <a href=Sound.html>Sound</a> || 
 <a href=Surface.html>Surface</a> ||<br>
 &nbsp;<br>|| <a href=pygame_color.html>color</a> || 

File docs/ref/pygame_sprite.html

View file
  • Ignore whitespace
 <a href=Font.html>Font</a> || 
 <a href=Joystick.html>Joystick</a> || 
 <a href=Movie.html>Movie</a> ||<br>
-|| <a href=Rect.html>Rect</a> || 
+|| <a href=Overlay.html>Overlay</a> || 
+<a href=Rect.html>Rect</a> || 
 <a href=Sound.html>Sound</a> || 
 <a href=Surface.html>Surface</a> ||<br>
 &nbsp;<br>|| <a href=pygame_color.html>color</a> || 

File docs/ref/pygame_surfarray.html

View file
  • Ignore whitespace
 <a href=Font.html>Font</a> || 
 <a href=Joystick.html>Joystick</a> || 
 <a href=Movie.html>Movie</a> ||<br>
-|| <a href=Rect.html>Rect</a> || 
+|| <a href=Overlay.html>Overlay</a> || 
+<a href=Rect.html>Rect</a> || 
 <a href=Sound.html>Sound</a> || 
 <a href=Surface.html>Surface</a> ||<br>
 &nbsp;<br>|| <a href=pygame_color.html>color</a> || 

File docs/ref/pygame_time.html

View file
  • Ignore whitespace
 <a href=Font.html>Font</a> || 
 <a href=Joystick.html>Joystick</a> || 
 <a href=Movie.html>Movie</a> ||<br>
-|| <a href=Rect.html>Rect</a> || 
+|| <a href=Overlay.html>Overlay</a> || 
+<a href=Rect.html>Rect</a> || 
 <a href=Sound.html>Sound</a> || 
 <a href=Surface.html>Surface</a> ||<br>
 &nbsp;<br>|| <a href=pygame_color.html>color</a> || 

File docs/ref/pygame_transform.html

View file
  • Ignore whitespace
 <a href=Font.html>Font</a> || 
 <a href=Joystick.html>Joystick</a> || 
 <a href=Movie.html>Movie</a> ||<br>
-|| <a href=Rect.html>Rect</a> || 
+|| <a href=Overlay.html>Overlay</a> || 
+<a href=Rect.html>Rect</a> || 
 <a href=Sound.html>Sound</a> || 
 <a href=Surface.html>Surface</a> ||<br>
 &nbsp;<br>|| <a href=pygame_color.html>color</a> || 

File examples/data/yuv_1.pgm

View file
  • Ignore whitespace
Added
New image

File examples/overlay.py

View file
  • Ignore whitespace
+#! /bin/env python
+
+import sys
+import pygame
+
+SR= (800,600)
+ovl= None
+
+########################################################################
+# Simple video player 
+def vPlayer( fName ):
+    global ovl
+    f= open( fName, 'rb' )
+    fmt= f.readline().strip()
+    res= f.readline().strip()
+    col= f.readline().strip()
+    if fmt!= "P5":
+        print 'Unknown format( len %d ). Exiting...' % len( fmt )
+        return
+    
+    w,h= [ int(x) for x in res.split( ' ' ) ]
+    h= ( h* 2 )/ 3
+    # Read into strings
+    y= f.read( w*h )
+    u= []
+    v= []
+    for i in xrange( 0, h/2 ):
+        u.append( f.read( w/2 ))
+        v.append( f.read( w/2 ))
+    
+    u= ''.join(u)
+    v= ''.join(v)
+    
+    # Open overlay with the resolution specified
+    ovl= pygame.Overlay(pygame.YV12_OVERLAY, (w,h))
+    ovl.set_location(0, 0, w, h)
+    
+    ovl.display((y,u,v))
+    while 1:
+        pygame.time.wait(10)
+        for ev in pygame.event.get():
+            if ev.type in (pygame.KEYDOWN, pygame.QUIT): 
+                return
+
+
+# Test all modules
+if __name__== '__main__':
+    if len( sys.argv )!= 2:
+        print "Usage: play_file <file_pattern>"
+    else:
+        pygame.init()
+        pygame.display.set_mode(SR)
+        vPlayer(sys.argv[1])
+        pygame.quit()
+

File lib/__init__.py

View file
  • Ignore whitespace
 try: from pygame.surface import *
 except (ImportError,IOError):Surface = lambda:Missing_Function
 
+try: from pygame.overlay import *
+except (ImportError,IOError):Overlay = lambda:Missing_Function
+
 try: import pygame.time
 except (ImportError,IOError), msg:time=MissingModule("time", msg, 1)
 

File readme.html

View file
  • Ignore whitespace
     Andrew Straw, Michael Hudson, Ole Martin Bjoerndalen,
     Herv� Cauwelier, James Mazer, Lalo Martins,
     Timothy Stranex, Chad Lester, Matthias Spillers,
-    Bo Jangeborg</li>
+    Bo Jangeborg, Dmitry Borisov</li>
 <li>And our bug hunters above and beyond:
     Angus, Guillaume Proux, Frank Raiser,
     Austin Henry, Kaweh Kazemi, Arturo Aldama,

File readme.txt

View file
  • Ignore whitespace
    Tyler, Nathaniel Pryce, Dave Wallace, John Popplewell, Michael Urman,
    Andrew Straw, Michael Hudson, Ole Martin Bjoerndalen, Herv� Cauwelier,
    James Mazer, Lalo Martins, Timothy Stranex, Chad Lester, Matthias
-   Spillers, Bo Jangeborg
+   Spillers, Bo Jangeborg, Dmitry Borisov
 
      And our bug hunters above and beyond: Angus, Guillaume Proux, Frank
    Raiser, Austin Henry, Kaweh Kazemi, Arturo Aldama, Mike Mulcheck, Rene

File src/constants.c

View file
  • Ignore whitespace
 
 	module = Py_InitModule3("constants", builtins, doc_pygame_constants_MODULE);
 
+	DEC_CONST(YV12_OVERLAY);
+	DEC_CONST(IYUV_OVERLAY);
+	DEC_CONST(YUY2_OVERLAY);
+	DEC_CONST(UYVY_OVERLAY);
+	DEC_CONST(YVYU_OVERLAY);
+
 	DEC_CONST(SWSURFACE);
 	DEC_CONST(HWSURFACE);
 	DEC_CONST(RESIZABLE);

File src/overlay.c

View file
  • Ignore whitespace
+/*
+ *			A part of the pydfb module. Provides interface for basic overlay
+ *			manipulation functions.
+ *      In this implementation overlay can use only one layer out of maximum
+ *      possible. After getting overlay, no overlay can be created.
+ *
+ *					Copyright (C) 2002-2003  Dmitry Borisov
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * Dmitry Borisov
+*/
+
+
+#include <Python.h>
+#include "pygame.h"
+
+typedef struct
+{
+  PyObject_HEAD
+	SDL_Overlay *cOverlay;
+	GAME_Rect cRect;
+} PyGameOverlay;
+
+
+static void
+overlay_dealloc(PyGameOverlay *self)
+{
+	if(SDL_WasInit(SDL_INIT_VIDEO) && self->cOverlay)
+		SDL_FreeYUVOverlay(self->cOverlay);
+
+	PyObject_Free((PyObject*)self);
+}
+
+
+
+    /*DOC*/ static char doc_Overlay_SetLocation[] =
+    /*DOC*/    "Overlay.set_location(rectstyle) -> None\n"
+    /*DOC*/    "set overlay location\n"
+    /*DOC*/    "\n"
+    /*DOC*/    "Sets location for the overlay on a screen.\n"
+    /*DOC*/    "This does not move or redraw any currently displayed data,\n"
+    /*DOC*/    "it only sets the position for newly display() calls.\n"
+    /*DOC*/ ;
+
+static PyObject* Overlay_SetLocation(PyGameOverlay *self, PyObject *args)
+{
+        GAME_Rect *rect, temp;
+    
+        rect = GameRect_FromObject(args, &temp);
+        if(!rect)
+            return RAISE(PyExc_TypeError, "Invalid rectstyle argument");
+        
+        self->cRect.x = rect->x;
+        self->cRect.y = rect->y;
+        self->cRect.w = rect->w;
+        self->cRect.h = rect->h;
+
+	RETURN_NONE
+}
+
+
+
+    /*DOC*/ static char doc_Overlay_Display[] =
+    /*DOC*/    "Overlay.display(y, u, v) -> None\n"
+    /*DOC*/    "display the yuv data\n"
+    /*DOC*/    "\n"
+    /*DOC*/    "Display the yuv data in SDL's overlay planes. The y, u, and v\n"
+    /*DOC*/    "arguments represents strings of byte data.\n"
+    /*DOC*/ ;
+
+static PyObject* Overlay_Display(PyGameOverlay *self, PyObject *args)
+{
+	// Parse data params for frame
+	int ls_y, ls_u, ls_v, y;
+	unsigned char *dst_y, *dst_u, *dst_v, *src_y, *src_u, *src_v;
+	if(!PyArg_ParseTuple(args, "(s#s#s#)", &src_y, &ls_y, &src_u, &ls_u, &src_v, &ls_v))
+		return NULL;
+
+	{
+		SDL_Rect cRect= { self->cRect.x, self->cRect.y, self->cRect.w, self->cRect.h };
+		SDL_LockYUVOverlay( self->cOverlay );
+
+		// No clipping at this time( only support for YUV420 )
+		dst_y = (char*)self->cOverlay->pixels[ 0 ];
+		dst_v = (char*)self->cOverlay->pixels[ 1 ];
+		dst_u = (char*)self->cOverlay->pixels[ 2 ];
+		for (y=0; y< self->cOverlay->h; y++)
+		{
+			memcpy( dst_y, src_y, self->cOverlay->w );
+
+			src_y += ls_y / self->cOverlay->h;
+			dst_y += self->cOverlay->pitches[ 0 ];
+
+			if (y & 1) {
+				src_u += ( ls_u* 2 )/self->cOverlay->h;
+				src_v += ( ls_v* 2 )/self->cOverlay->h;
+				dst_u += self->cOverlay->pitches[ 1 ];
+				dst_v += self->cOverlay->pitches[ 2 ];
+			}
+			else
+			{
+				memcpy( dst_u, src_u, ( ls_u* 2 )/self->cOverlay->h );
+				memcpy( dst_v, src_v, ( ls_v* 2 )/self->cOverlay->h );
+			}
+		}
+
+		SDL_UnlockYUVOverlay( self->cOverlay );
+                SDL_DisplayYUVOverlay( self->cOverlay, &cRect);
+	}
+	RETURN_NONE
+}
+
+
+
+PyObject* Overlay_New(PyTypeObject *type, PyObject *args, PyObject *kwds)
+{
+	int pixelformat;
+	PyGameOverlay *self;
+	int w, h;
+        SDL_Surface *screen;
+	if(!PyArg_ParseTuple(args, "i(ii)", &pixelformat, &w, &h))
+		return NULL;
+
+	if(!SDL_WasInit(SDL_INIT_VIDEO))
+		return RAISE(PyExc_SDLError, "cannot create overlay without pygame.display initialized");
+
+        screen = SDL_GetVideoSurface();
+        if(!screen)
+            return RAISE(PyExc_SDLError, "Display mode not set");
+        
+	// Create new Overlay object
+	self= (PyGameOverlay *)type->tp_alloc(type, 0);
+        if( !self )
+		return NULL;
+
+	// Create layer with desired format
+	self->cOverlay = SDL_CreateYUVOverlay(w, h, pixelformat, screen);
+	if( !self->cOverlay )
+		return RAISE(PyExc_SDLError, "Cannot create overlay");
+
+	self->cRect.x= 0;
+	self->cRect.y= 0;
+	self->cRect.w= w;
+	self->cRect.h= h;
+
+	return (PyObject*)self;
+}
+
+
+static PyMethodDef Overlay_methods[] = {
+  {"set_location", (PyCFunction)Overlay_SetLocation, METH_VARARGS, doc_Overlay_SetLocation},
+  {"display", (PyCFunction)Overlay_Display, METH_VARARGS, doc_Overlay_Display},
+	{NULL}  /* Sentinel */
+};
+
+
+    /*DOC*/ static char doc_Overlay[] =
+    /*DOC*/    "pygame.Overlay(pixeltype, [width, height]) -> Overlay\n"
+    /*DOC*/    "Create a new video overlay object\n"
+    /*DOC*/    "\n"
+    /*DOC*/    "This creates a new Overlay object. Overlays represent a basic\n"
+    /*DOC*/    "interface for putting YUV image data into the graphics card's\n"
+    /*DOC*/    "video overlay planes. This is a low level object intended for\n"
+    /*DOC*/    "use by people who know what they are doing, and have pregenerated\n"
+    /*DOC*/    "YUV image data.\n"
+    /*DOC*/    "The pixeltype argument must be one of the pygame constants;\n"
+    /*DOC*/    "YV12_OVERLAY, IYUV_OVERLAY, YUV2_OVERLAY, UYVY_OVERLAY, or YVYU_OVERLAY.\n"
+    /*DOC*/    "\n"
+    /*DOC*/ ;
+
+#if 0
+    /*DOC*/ static char doc_Overlay_MODULE[] =
+    /*DOC*/    "pygame.Overlay(pixeltype, [width, height]) -> Overlay\n"
+    /*DOC*/    "Create a new video overlay object\n"
+    /*DOC*/    "\n"
+    /*DOC*/    "This creates a new Overlay object. Overlays represent a basic\n"
+    /*DOC*/    "interface for putting YUV image data into the graphics card's\n"
+    /*DOC*/    "video overlay planes. This is a low level object intended for\n"
+    /*DOC*/    "use by people who know what they are doing, and have pregenerated\n"
+    /*DOC*/    "YUV image data.\n"
+    /*DOC*/    "The pixeltype argument must be one of the pygame constants;\n"
+    /*DOC*/    "YV12_OVERLAY, IYUV_OVERLAY, YUV2_OVERLAY, UYVY_OVERLAY, or YVYU_OVERLAY.\n"
+    /*DOC*/    "\n"
+    /*DOC*/    "\n"
+    /*DOC*/ ;
+#endif
+
+PyTypeObject PyOverlay_Type =
+{
+	PyObject_HEAD_INIT(NULL)
+    0,                         /*ob_size*/
+    "pygame.overlay",        /*tp_name*/
+    sizeof(PyGameOverlay),      /*tp_basicsize*/
+    0,                         /*tp_itemsize*/
+    (destructor)overlay_dealloc,												/*tp_dealloc*/
+		0,                         /*tp_print*/
+    0,                         /*tp_getattr*/
+    0,                         /*tp_setattr*/
+    0,                         /*tp_compare*/
+    0,                         /*tp_repr*/
+    0,                         /*tp_as_number*/
+    0,                         /*tp_as_sequence*/
+    0,                         /*tp_as_mapping*/
+    0,                         /*tp_hash */
+    0,                         /*tp_call*/
+    0,                         /*tp_str*/
+    PyObject_GenericGetAttr,   /*tp_getattro*/
+    0,                         /*tp_setattro*/
+    0,                         /*tp_as_buffer*/
+    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
+    doc_Overlay,           /* tp_doc */
+    0,		               /* tp_traverse */
+    0,		               /* tp_clear */
+    0,		               /* tp_richcompare */
+    0,		               /* tp_weaklistoffset */
+    0,		               /* tp_iter */
+    0,		               /* tp_iternext */
+    Overlay_methods,             /* tp_methods */
+    0,             /* tp_members */
+    0,                         /* tp_getset */
+    0,                         /* tp_base */
+    0,                         /* tp_dict */
+    0,                         /* tp_descr_get */
+    0,                         /* tp_descr_set */
+    0,                         /* tp_dictoffset */
+    0,    /* tp_init */
+    PyType_GenericAlloc,       /* tp_alloc */
+    Overlay_New,			   /* tp_new */
+};
+
+static PyMethodDef overlay_methods[] =
+{
+	{ NULL, NULL }
+};
+
+
+PYGAME_EXPORT
+void initoverlay(void)
+{
+	PyObject *module;
+	module = Py_InitModule("overlay", overlay_methods );
+
+	PyOverlay_Type.ob_type = &PyType_Type;
+	Py_INCREF((PyObject *)&PyOverlay_Type);
+	PyType_Init(PyOverlay_Type);
+
+    /* create the module reference */
+	PyModule_AddObject(module, "Overlay", (PyObject *)&PyOverlay_Type);
+
+	import_pygame_base();
+	import_pygame_rect();    
+}