Commits

Anonymous committed db41625

Merged trunk 1948->1985

Comments (0)

Files changed (32)

 _camera src/_camera.c src/camera_v4l2.c src/camera_v4l.c $(SDL) $(DEBUG)
 pypm src/pypm.c $(SDL) $(PORTMIDI) $(PORTTIME) $(DEBUG)
 
+#proposed SDL_gfx module backported from pgreloaded. requires SDL_gfx.
+#if accepted, then move GFX def to StartConfig section and add SDL_gfx
+#search to configure modules for Unix, Darwin and Windows.
+#GFX = -lSDL_gfx
+#gfxdraw src/gfxdraw.c $(SDL) $(GFX) $(DEBUG)
+
+#GFX = src/SDL_gfx/SDL_gfxPrimitives.c 
+#GFX = src/SDL_gfx/SDL_gfxBlitFunc.c src/SDL_gfx/SDL_gfxPrimitives.c 
+#gfxdraw src/gfxdraw.c $(SDL) src/SDL_gfx/SDL_gfxPrimitives.c $(DEBUG)
+
+
+
 #experimental new movie movie. requires libavcodec and libavformat.
 #add any necessary compile flags to this line and uncomment.
 #movieext src/movie.c  src/ffmovie.c $(SDL) -lavcodec -lavformat
 
-
 #these modules are required for pygame to run. they only require
 #SDL as a dependency. these should not be altered
 
 # BUG    = fixed a bug that was (or could have been) crashing
 #
 #
+[SVN 1952] Feb 22, 2009
+    Added Surface.scroll method along with the scroll.py example.
+
+[SVN 1947] Feb 21, 2009
+    Made colorkey and blanket alpha blits properly handle a surface blit
+    to itself. This addresses Bugzilla bug 19.
+
 [SVN 1820] Jan 11, 2009
     The Pygame documents and examples are now part of the Pygame package,
     directories docs and examples respectively.
         Dependency('SCRAP', '', 'libX11', ['X11']),
         Dependency('PORTMIDI', 'portmidi.h', 'libportmidi.so', ['portmidi']),
         Dependency('PORTTIME', 'porttime.h', 'libporttime.so', ['porttime']),
+        #Dependency('GFX', 'SDL_gfxPrimitives.h', 'libSDL_gfx.so', ['SDL_gfx']),
     ]
 
     if not DEPS[0].found:

docs/ref/camera.html

   <tr><td><a href="camera.html#pygame.camera.Camera">pygame.camera.Camera</a> - <font size=-1>load a camera</font></td><td>load a camera</td></tr>
 </table></small></ul>
 <p>Pygame currently supports only Linux and v4l2 cameras. </p>
+<p>The Bayer to <tt>RGB</tt> function is based on: </p>
+<pre> Sonix SN9C101 based webcam basic I/F routines
+ Copyright (C) 2004 Takafumi Mizuno <taka-qce@ls-a.jp>
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+ 1. Redistributions of source code must retain the above copyright
+    notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions and the following disclaimer in the
+    documentation and/or other materials provided with the distribution.
+ THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ SUCH DAMAGE.
+</pre>
 <!--COMMENTS:pygame.camera--> &nbsp;<br> 
 
 

docs/ref/examples.html

   <tr><td><a href="examples.html#pygame.examples.pixelarray.main">pygame.examples.pixelarray.main</a> - <font size=-1>display various pixelarray generated effects</font></td><td>display various pixelarray generated effects</td></tr>
   <tr><td><a href="examples.html#pygame.examples.scaletest.main">pygame.examples.scaletest.main</a> - <font size=-1>interactively scale an image using smoothscale</font></td><td>interactively scale an image using smoothscale</td></tr>
   <tr><td><a href="examples.html#pygame.examples.midi.main">pygame.examples.midi.main</a> - <font size=-1>run a midi example</font></td><td>run a midi example</td></tr>
+  <tr><td><a href="examples.html#pygame.examples.scroll.main">pygame.examples.scroll.main</a> - <font size=-1>run a Surface.scroll example that shows a magnified image</font></td><td>run a Surface.scroll example that shows a magnified image</td></tr>
 </table></small></ul>
 <p>These examples should help get you started with pygame. Here is a brief rundown of what you get. The source code for these examples is in the public domain. Feel free to use for your own projects. </p>
 <p>These examples can be run as stand-alone programs, or as described below, by importing the module and calling its main(). </p>
 <p>new to pygame <tt>1.9.0</tt> </p>
 <!--COMMENTS:pygame.examples.midi.main--> &nbsp;<br> 
 <br></ul>
+
+
+<a name="pygame.examples.scroll.main">
+<big><b>pygame.examples.scroll.main</big></b><br><ul>
+  <i>run a Surface.scroll example that shows a magnified image</i><br>
+  <tt>pygame.examples.scroll.main(image_file=None): return None</tt><br>
+<p>This example shows a scrollable image that has a zoom factor of eight. It uses the <tt>Surface.scroll</tt> function to shift the image on the display surface. <tt>A</tt> clip rectangle protects a margin area. If called as a function, the example accepts an optional image file path. If run as a program it takes an optional file path command line argument. If no file is provided a default image file is used. </p>
+<p>When running click on a black triangle to move one pixel in the direction the triangle points. Or use the arrow keys. Close the window or press <tt>ESC</tt> to quit. </p>
+<!--COMMENTS:pygame.examples.scroll.main--> &nbsp;<br> 
+<br></ul>
 <br></ul>
 
 </body></html>

docs/ref/gfxdraw.html

+
+<html>
+<title>gfxdraw - Pygame Documentation</title>
+<body bgcolor=#aaeebb text=#000000 link=#331111 vlink=#331111>
+
+
+<table cellpadding=0 cellspacing=0 border=0 style='border: 3px solid black;' width='100%'>
+<tr>
+<td bgcolor='#c2fc20' style='padding: 6px;' align=center valign=center><a href='http://www.pygame.org/'><img src='../pygame_tiny.gif' border=0 width=200 height=60></a><br><b>pygame documentation</b></td>
+<td bgcolor='#6aee28' style='border-left: 3px solid black; padding: 6px;' align=center valign=center>
+	||&nbsp;
+	<a href=http://www.pygame.org>Pygame Home</a> &nbsp;||&nbsp;
+	<a href=../index.html>Help Contents</a> &nbsp;||
+	<a href=index.html>Reference Index</a> &nbsp;||
+	<br>&nbsp;<br>
+	
+<a href="camera.html">Camera</a>&nbsp;||&nbsp;
+<a href="cdrom.html">Cdrom</a>&nbsp;||&nbsp;
+<a href="color.html">Color</a>&nbsp;||&nbsp;
+<a href="cursors.html">Cursors</a>&nbsp;||&nbsp;
+<a href="display.html">Display</a>&nbsp;||&nbsp;
+<a href="draw.html">Draw</a>&nbsp;||&nbsp;
+<a href="event.html">Event</a>&nbsp;||&nbsp;
+<a href="examples.html">Examples</a>&nbsp;||&nbsp;
+<a href="font.html">Font</a>&nbsp;||&nbsp;
+<a href="gfxdraw.html">Gfxdraw</a>&nbsp;||&nbsp;
+<a href="image.html">Image</a>&nbsp;||&nbsp;
+<a href="joystick.html">Joystick</a>&nbsp;||&nbsp;
+<a href="key.html">Key</a>&nbsp;||&nbsp;
+<a href="locals.html">Locals</a>&nbsp;||&nbsp;
+<a href="mask.html">Mask</a>&nbsp;||&nbsp;
+<a href="mixer.html">Mixer</a>&nbsp;||&nbsp;
+<a href="mouse.html">Mouse</a>&nbsp;||&nbsp;
+<a href="movie.html">Movie</a>&nbsp;||&nbsp;
+<a href="music.html">Music</a>&nbsp;||&nbsp;
+<a href="overlay.html">Overlay</a>&nbsp;||&nbsp;
+<a href="pixelarray.html">Pixelarray</a>&nbsp;||&nbsp;
+<a href="pygame.html">Pygame</a>&nbsp;||&nbsp;
+<a href="rect.html">Rect</a>&nbsp;||&nbsp;
+<a href="scrap.html">Scrap</a>&nbsp;||&nbsp;
+<a href="sndarray.html">Sndarray</a>&nbsp;||&nbsp;
+<a href="sprite.html">Sprite</a>&nbsp;||&nbsp;
+<a href="surface.html">Surface</a>&nbsp;||&nbsp;
+<a href="surfarray.html">Surfarray</a>&nbsp;||&nbsp;
+<a href="tests.html">Tests</a>&nbsp;||&nbsp;
+<a href="time.html">Time</a>&nbsp;||&nbsp;
+<a href="transform.html">Transform</a>
+</td></tr></table>
+<br>
+
+
+<a name="pygame.gfxdraw">
+<big><b>pygame.gfxdraw</big></b><br><ul>
+  <i>pygame module for drawing shapes</i><br>
+<ul><small><table>
+  <tr><td><a href="gfxdraw.html#pygame.gfxdraw.pixel">pygame.gfxdraw.pixel</a> - <font size=-1>place a pixel</font></td><td>place a pixel</td></tr>
+  <tr><td><a href="gfxdraw.html#pygame.gfxdraw.hline">pygame.gfxdraw.hline</a> - <font size=-1>draw a horizontal line</font></td><td>draw a horizontal line</td></tr>
+  <tr><td><a href="gfxdraw.html#pygame.gfxdraw.vline">pygame.gfxdraw.vline</a> - <font size=-1>draw a vertical line</font></td><td>draw a vertical line</td></tr>
+  <tr><td><a href="gfxdraw.html#pygame.gfxdraw.rectangle">pygame.gfxdraw.rectangle</a> - <font size=-1>draw a rectangle</font></td><td>draw a rectangle</td></tr>
+  <tr><td><a href="gfxdraw.html#pygame.gfxdraw.box">pygame.gfxdraw.box</a> - <font size=-1>draw a box</font></td><td>draw a box</td></tr>
+  <tr><td><a href="gfxdraw.html#pygame.gfxdraw.line">pygame.gfxdraw.line</a> - <font size=-1>draw a line</font></td><td>draw a line</td></tr>
+  <tr><td><a href="gfxdraw.html#pygame.gfxdraw.circle">pygame.gfxdraw.circle</a> - <font size=-1>draw a circle</font></td><td>draw a circle</td></tr>
+  <tr><td><a href="gfxdraw.html#pygame.gfxdraw.arc">pygame.gfxdraw.arc</a> - <font size=-1>draw an arc</font></td><td>draw an arc</td></tr>
+  <tr><td><a href="gfxdraw.html#pygame.gfxdraw.aacircle">pygame.gfxdraw.aacircle</a> - <font size=-1>draw an anti-aliased circle</font></td><td>draw an anti-aliased circle</td></tr>
+  <tr><td><a href="gfxdraw.html#pygame.gfxdraw.filled_circle">pygame.gfxdraw.filled_circle</a> - <font size=-1>draw a filled circle</font></td><td>draw a filled circle</td></tr>
+  <tr><td><a href="gfxdraw.html#pygame.gfxdraw.ellipse">pygame.gfxdraw.ellipse</a> - <font size=-1>draw an ellipse</font></td><td>draw an ellipse</td></tr>
+  <tr><td><a href="gfxdraw.html#pygame.gfxdraw.aaellipse">pygame.gfxdraw.aaellipse</a> - <font size=-1>draw an anti-aliased ellipse</font></td><td>draw an anti-aliased ellipse</td></tr>
+  <tr><td><a href="gfxdraw.html#pygame.gfxdraw.filled_ellipse">pygame.gfxdraw.filled_ellipse</a> - <font size=-1>draw a filled ellipse</font></td><td>draw a filled ellipse</td></tr>
+  <tr><td><a href="gfxdraw.html#pygame.gfxdraw.pie">pygame.gfxdraw.pie</a> - <font size=-1>draw a pie</font></td><td>draw a pie</td></tr>
+  <tr><td><a href="gfxdraw.html#pygame.gfxdraw.trigon">pygame.gfxdraw.trigon</a> - <font size=-1>draw a triangle</font></td><td>draw a triangle</td></tr>
+  <tr><td><a href="gfxdraw.html#pygame.gfxdraw.aatrigon">pygame.gfxdraw.aatrigon</a> - <font size=-1>draw an anti-aliased triangle</font></td><td>draw an anti-aliased triangle</td></tr>
+  <tr><td><a href="gfxdraw.html#pygame.gfxdraw.filled_trigon">pygame.gfxdraw.filled_trigon</a> - <font size=-1>draw a filled trigon</font></td><td>draw a filled trigon</td></tr>
+  <tr><td><a href="gfxdraw.html#pygame.gfxdraw.polygon">pygame.gfxdraw.polygon</a> - <font size=-1>draw a polygon</font></td><td>draw a polygon</td></tr>
+  <tr><td><a href="gfxdraw.html#pygame.gfxdraw.aapolygon">pygame.gfxdraw.aapolygon</a> - <font size=-1>draw an anti-aliased polygon</font></td><td>draw an anti-aliased polygon</td></tr>
+  <tr><td><a href="gfxdraw.html#pygame.gfxdraw.filled_polygon">pygame.gfxdraw.filled_polygon</a> - <font size=-1>draw a filled polygon</font></td><td>draw a filled polygon</td></tr>
+  <tr><td><a href="gfxdraw.html#pygame.gfxdraw.textured_polygon">pygame.gfxdraw.textured_polygon</a> - <font size=-1>draw a textured polygon</font></td><td>draw a textured polygon</td></tr>
+  <tr><td><a href="gfxdraw.html#pygame.gfxdraw.bezier">pygame.gfxdraw.bezier</a> - <font size=-1>draw a bezier curve</font></td><td>draw a bezier curve</td></tr>
+</table></small></ul>
+<p>Wraps SDL_gfx primatives. </p>
+<p>Most of the functions accept a color argument that is an <tt>RGB</tt> triplet. These can also accept an <tt>RGBA</tt> quadruplet. The color argument can also be an integer pixel value that is already mapped to the Surface's pixel format. </p>
+<p>For all functions the arguments are strictly positional. Only integers are accepted for coordinates and radii. </p>
+<!--COMMENTS:pygame.gfxdraw--> &nbsp;<br> 
+
+
+<a name="pygame.gfxdraw.pixel">
+<big><b>pygame.gfxdraw.pixel</big></b><br><ul>
+  <i>place a pixel</i><br>
+  <tt>pygame.gfxdraw.pixel(surface, x, y, color): return None</tt><br>
+ &nbsp;<br> 
+<!--COMMENTS:pygame.gfxdraw.pixel--> &nbsp;<br> 
+<br></ul>
+
+
+<a name="pygame.gfxdraw.hline">
+<big><b>pygame.gfxdraw.hline</big></b><br><ul>
+  <i>draw a horizontal line</i><br>
+  <tt>pygame.gfxdraw.hline(surface, x1, x2, y, color): return None</tt><br>
+ &nbsp;<br> 
+<!--COMMENTS:pygame.gfxdraw.hline--> &nbsp;<br> 
+<br></ul>
+
+
+<a name="pygame.gfxdraw.vline">
+<big><b>pygame.gfxdraw.vline</big></b><br><ul>
+  <i>draw a vertical line</i><br>
+  <tt>pgyame.gfxdraw.vline(surface, x, y1, y2, color): return None</tt><br>
+ &nbsp;<br> 
+<!--COMMENTS:pygame.gfxdraw.vline--> &nbsp;<br> 
+<br></ul>
+
+
+<a name="pygame.gfxdraw.rectangle">
+<big><b>pygame.gfxdraw.rectangle</big></b><br><ul>
+  <i>draw a rectangle</i><br>
+  <tt>pgyame.gfxdraw.rectangle(surface, rect, color): return None</tt><br>
+ &nbsp;<br> 
+<!--COMMENTS:pygame.gfxdraw.rectangle--> &nbsp;<br> 
+<br></ul>
+
+
+<a name="pygame.gfxdraw.box">
+<big><b>pygame.gfxdraw.box</big></b><br><ul>
+  <i>draw a box</i><br>
+  <tt>pgyame.gfxdraw.box(surface, rect, color): return None</tt><br>
+ &nbsp;<br> 
+<!--COMMENTS:pygame.gfxdraw.box--> &nbsp;<br> 
+<br></ul>
+
+
+<a name="pygame.gfxdraw.line">
+<big><b>pygame.gfxdraw.line</big></b><br><ul>
+  <i>draw a line</i><br>
+  <tt>pgyame.gfxdraw.line(surface, x1, y1, x2, y2, color): return None</tt><br>
+ &nbsp;<br> 
+<!--COMMENTS:pygame.gfxdraw.line--> &nbsp;<br> 
+<br></ul>
+
+
+<a name="pygame.gfxdraw.circle">
+<big><b>pygame.gfxdraw.circle</big></b><br><ul>
+  <i>draw a circle</i><br>
+  <tt>pgyame.gfxdraw.circle(surface, x, y, r, color): return None</tt><br>
+ &nbsp;<br> 
+<!--COMMENTS:pygame.gfxdraw.circle--> &nbsp;<br> 
+<br></ul>
+
+
+<a name="pygame.gfxdraw.arc">
+<big><b>pygame.gfxdraw.arc</big></b><br><ul>
+  <i>draw an arc</i><br>
+  <tt>pgyame.gfxdraw.arc(surface, x, y, r, start, end, color): return None</tt><br>
+ &nbsp;<br> 
+<!--COMMENTS:pygame.gfxdraw.arc--> &nbsp;<br> 
+<br></ul>
+
+
+<a name="pygame.gfxdraw.aacircle">
+<big><b>pygame.gfxdraw.aacircle</big></b><br><ul>
+  <i>draw an anti-aliased circle</i><br>
+  <tt>pgyame.gfxdraw.aacircle(surface, x, y, r, color): return None</tt><br>
+ &nbsp;<br> 
+<!--COMMENTS:pygame.gfxdraw.aacircle--> &nbsp;<br> 
+<br></ul>
+
+
+<a name="pygame.gfxdraw.filled_circle">
+<big><b>pygame.gfxdraw.filled_circle</big></b><br><ul>
+  <i>draw a filled circle</i><br>
+  <tt>pgyame.gfxdraw.filled_circle(surface, x, y, r, color): return None</tt><br>
+ &nbsp;<br> 
+<!--COMMENTS:pygame.gfxdraw.filled_circle--> &nbsp;<br> 
+<br></ul>
+
+
+<a name="pygame.gfxdraw.ellipse">
+<big><b>pygame.gfxdraw.ellipse</big></b><br><ul>
+  <i>draw an ellipse</i><br>
+  <tt>pgyame.gfxdraw.ellipse(surface, x, y, rx, ry, color): return None</tt><br>
+ &nbsp;<br> 
+<!--COMMENTS:pygame.gfxdraw.ellipse--> &nbsp;<br> 
+<br></ul>
+
+
+<a name="pygame.gfxdraw.aaellipse">
+<big><b>pygame.gfxdraw.aaellipse</big></b><br><ul>
+  <i>draw an anti-aliased ellipse</i><br>
+  <tt>pgyame.gfxdraw.aaellipse(surface, x, y, rx, ry, color): return None</tt><br>
+ &nbsp;<br> 
+<!--COMMENTS:pygame.gfxdraw.aaellipse--> &nbsp;<br> 
+<br></ul>
+
+
+<a name="pygame.gfxdraw.filled_ellipse">
+<big><b>pygame.gfxdraw.filled_ellipse</big></b><br><ul>
+  <i>draw a filled ellipse</i><br>
+  <tt>pgyame.gfxdraw.filled_ellipse(surface, x, y, rx, ry, color): return None</tt><br>
+ &nbsp;<br> 
+<!--COMMENTS:pygame.gfxdraw.filled_ellipse--> &nbsp;<br> 
+<br></ul>
+
+
+<a name="pygame.gfxdraw.pie">
+<big><b>pygame.gfxdraw.pie</big></b><br><ul>
+  <i>draw a pie</i><br>
+  <tt>pgyame.gfxdraw.pie(surface, x, y, r, start, end, color): return None</tt><br>
+ &nbsp;<br> 
+<!--COMMENTS:pygame.gfxdraw.pie--> &nbsp;<br> 
+<br></ul>
+
+
+<a name="pygame.gfxdraw.trigon">
+<big><b>pygame.gfxdraw.trigon</big></b><br><ul>
+  <i>draw a triangle</i><br>
+  <tt>pgyame.gfxdraw.trigon(surface, x1, y1, x2, y2, x3, y3, color): return None</tt><br>
+ &nbsp;<br> 
+<!--COMMENTS:pygame.gfxdraw.trigon--> &nbsp;<br> 
+<br></ul>
+
+
+<a name="pygame.gfxdraw.aatrigon">
+<big><b>pygame.gfxdraw.aatrigon</big></b><br><ul>
+  <i>draw an anti-aliased triangle</i><br>
+  <tt>pgyame.gfxdraw.aatrigon(surface, x1, y1, x2, y2, x3, y3, color): return None</tt><br>
+ &nbsp;<br> 
+<!--COMMENTS:pygame.gfxdraw.aatrigon--> &nbsp;<br> 
+<br></ul>
+
+
+<a name="pygame.gfxdraw.filled_trigon">
+<big><b>pygame.gfxdraw.filled_trigon</big></b><br><ul>
+  <i>draw a filled trigon</i><br>
+  <tt>pgyame.gfxdraw.filled_trigon(surface, x1, y1, x3, y2, x3, y3, color): return None</tt><br>
+ &nbsp;<br> 
+<!--COMMENTS:pygame.gfxdraw.filled_trigon--> &nbsp;<br> 
+<br></ul>
+
+
+<a name="pygame.gfxdraw.polygon">
+<big><b>pygame.gfxdraw.polygon</big></b><br><ul>
+  <i>draw a polygon</i><br>
+  <tt>pgyame.gfxdraw.polygon(surface, points, color): return None</tt><br>
+ &nbsp;<br> 
+<!--COMMENTS:pygame.gfxdraw.polygon--> &nbsp;<br> 
+<br></ul>
+
+
+<a name="pygame.gfxdraw.aapolygon">
+<big><b>pygame.gfxdraw.aapolygon</big></b><br><ul>
+  <i>draw an anti-aliased polygon</i><br>
+  <tt>pgyame.gfxdraw.aapolygon(surface, points, color): return None</tt><br>
+ &nbsp;<br> 
+<!--COMMENTS:pygame.gfxdraw.aapolygon--> &nbsp;<br> 
+<br></ul>
+
+
+<a name="pygame.gfxdraw.filled_polygon">
+<big><b>pygame.gfxdraw.filled_polygon</big></b><br><ul>
+  <i>draw a filled polygon</i><br>
+  <tt>pgyame.gfxdraw.filled_polygon(surface, points, color): return None</tt><br>
+ &nbsp;<br> 
+<!--COMMENTS:pygame.gfxdraw.filled_polygon--> &nbsp;<br> 
+<br></ul>
+
+
+<a name="pygame.gfxdraw.textured_polygon">
+<big><b>pygame.gfxdraw.textured_polygon</big></b><br><ul>
+  <i>draw a textured polygon</i><br>
+  <tt>pgyame.gfxdraw.textured_polygon(surface, points, texture, tx, ty): return None</tt><br>
+ &nbsp;<br> 
+<!--COMMENTS:pygame.gfxdraw.textured_polygon--> &nbsp;<br> 
+<br></ul>
+
+
+<a name="pygame.gfxdraw.bezier">
+<big><b>pygame.gfxdraw.bezier</big></b><br><ul>
+  <i>draw a bezier curve</i><br>
+  <tt>pgyame.gfxdraw.bezier(surface, points, steps, color): return None</tt><br>
+ &nbsp;<br> 
+<!--COMMENTS:pygame.gfxdraw.bezier--> &nbsp;<br> 
+<br></ul>
+<br></ul>
+
+</body></html>

docs/ref/index.html

 <li><a href="examples.html#pygame.examples.pixelarray.main">pygame.examples.pixelarray.main</a> - <font size=-1>display various pixelarray generated effects</font></li>
 <li><a href="examples.html#pygame.examples.scaletest.main">pygame.examples.scaletest.main</a> - <font size=-1>interactively scale an image using smoothscale</font></li>
 <li><a href="examples.html#pygame.examples.scrap_clipboard.main">pygame.examples.scrap_clipboard.main</a> - <font size=-1>access the clipboard</font></li>
+<li><a href="examples.html#pygame.examples.scroll.main">pygame.examples.scroll.main</a> - <font size=-1>run a Surface.scroll example that shows a magnified image</font></li>
 <li><a href="examples.html#pygame.examples.sound.main">pygame.examples.sound.main</a> - <font size=-1>load and play a sound</font></li>
 <li><a href="examples.html#pygame.examples.sound_array_demos.main">pygame.examples.sound_array_demos.main</a> - <font size=-1>play various sndarray effects</font></li>
 <li><a href="examples.html#pygame.examples.stars.main">pygame.examples.stars.main</a> - <font size=-1>run a simple starfield example</font></li>
 <li><a href="surface.html#Surface.lock">Surface.lock</a> - <font size=-1>lock the Surface memory for pixel access</font></li>
 <li><a href="surface.html#Surface.map_rgb">Surface.map_rgb</a> - <font size=-1>convert a color into a mapped color value</font></li>
 <li><a href="surface.html#Surface.mustlock">Surface.mustlock</a> - <font size=-1>test if the Surface requires locking</font></li>
+<li><a href="surface.html#Surface.scroll">Surface.scroll</a> - <font size=-1>Shift the surface image in place</font></li>
 <li><a href="surface.html#Surface.set_alpha">Surface.set_alpha</a> - <font size=-1>set the alpha value for the full Surface image</font></li>
 <li><a href="surface.html#Surface.set_at">Surface.set_at</a> - <font size=-1>set the color value for a single pixel</font></li>
 <li><a href="surface.html#Surface.set_clip">Surface.set_clip</a> - <font size=-1>set the current clipping area of the Surface</font></li>

docs/ref/surface.html

   <tr><td><a href="surface.html#Surface.convert_alpha">Surface.convert_alpha</a> - <font size=-1>change the pixel format of an image including per pixel alphas</font></td><td>change the pixel format of an image including per pixel alphas</td></tr>
   <tr><td><a href="surface.html#Surface.copy">Surface.copy</a> - <font size=-1>create a new copy of a Surface</font></td><td>create a new copy of a Surface</td></tr>
   <tr><td><a href="surface.html#Surface.fill">Surface.fill</a> - <font size=-1>fill Surface with a solid color</font></td><td>fill Surface with a solid color</td></tr>
+  <tr><td><a href="surface.html#Surface.scroll">Surface.scroll</a> - <font size=-1>Shift the surface image in place</font></td><td>Shift the surface image in place</td></tr>
   <tr><td><a href="surface.html#Surface.set_colorkey">Surface.set_colorkey</a> - <font size=-1>Set the transparent colorkey</font></td><td>Set the transparent colorkey</td></tr>
   <tr><td><a href="surface.html#Surface.get_colorkey">Surface.get_colorkey</a> - <font size=-1>Get the current transparent colorkey</font></td><td>Get the current transparent colorkey</td></tr>
   <tr><td><a href="surface.html#Surface.set_alpha">Surface.set_alpha</a> - <font size=-1>set the alpha value for the full Surface image</font></td><td>set the alpha value for the full Surface image</td></tr>
 <br></ul>
 
 
+<a name="Surface.scroll">
+<big><b>Surface.scroll</big></b><br><ul>
+  <i>Shift the surface image in place</i><br>
+  <tt>Surface.scroll(dx=0, dy=0): return None</tt><br>
+<p>Move the image by dx pixels right and dy pixels down. dx and dy may be negative for left and up scrolls respectively. Areas of the surface that are not overwritten retain their original pixel values. Scrolling is contained by the Surface clip area. It is safe to have dx and dy values that exceed the surface size. </p>
+<!--COMMENTS:Surface.scroll--> &nbsp;<br> 
+<br></ul>
+
+
 <a name="Surface.set_colorkey">
 <big><b>Surface.set_colorkey</big></b><br><ul>
   <i>Set the transparent colorkey</i><br>

examples/aacircle.py

+"""Proof of concept gfxdraw example"""
+
+import pygame
+import pygame.gfxdraw
+
+def main():
+    pygame.init()
+    screen = pygame.display.set_mode((500,500))
+    screen.fill((255, 0, 0))
+    s = pygame.Surface(screen.get_size(), pygame.SRCALPHA, 32)
+    pygame.gfxdraw.aacircle(s, 250, 250, 200, (0, 0, 0))
+    screen.blit(s, (0, 0))
+    pygame.display.flip()
+    try:
+        while 1:
+            event = pygame.event.wait()
+            if event.type == pygame.QUIT:
+                break
+            pygame.display.flip()
+    finally:
+        pygame.quit()
+
+if __name__ == '__main__':
+    main()

examples/macosx/aliens_app_example/README.txt

  THESE INSTRUCTIONS ARE ONLY FOR MAC OS X 10.3, AND WILL ONLY CREATE 
  STANDALONE BUNDLES FOR MAC OS X 10.3.  THERE IS NO SUPPORT FOR 
  MAC OS X 10.2.
+
+Also works on 10.4 and 10.5
 *********************************************************************
 
-You will need the following packages installed to use this example:
-    macholib v2.0a0 or later
-        http://undefined.org/python/#macholib
-        (or http://undefined.org/python/macholib-v2.0a0.tgz if not listed)
 
-    PyProtocols v0.9.2 or later
-        http://peak.telecommunity.com/PyProtocols.html
-        
-    Both of these should eventually be in the PackageManager repository at:
-        http://undefined.org/python/pimp/
+Install py2app and its dependencies.
+
+easy_install py2app
+
+
 
 To create the bundle:
-    pythonw ./buildapp.py --semi-standalone build
+    python setup.py py2app

examples/macosx/aliens_app_example/aliens.py

     #load the sound effects
     boom_sound = load_sound('boom.wav')
     shoot_sound = load_sound('car_door.wav')
-    if pygame.mixer:
+    if pygame.mixer and pygame.mixer.music:
         music = os.path.join('data', 'house_lo.wav')
         pygame.mixer.music.load(music)
         pygame.mixer.music.play(-1)
         #cap the framerate
         clock.tick(40)
 
-    if pygame.mixer:
+    if pygame.mixer and pygame.mixer.music:
         pygame.mixer.music.fadeout(1000)
     pygame.time.wait(1000)
 

examples/macosx/aliens_app_example/aliens_bootstrap.py

-from Foundation import NSBundle
-from AppKit import NSTerminateNow, NSApp, NSRunAlertPanel
-from PyObjCTools import NibClassBuilder, AppHelper
-
-def exception_handler():
-    import traceback, sys, os
-    typ, info, trace = sys.exc_info()
-    if typ in (KeyboardInterrupt, SystemExit):
-        return
-    tracetop = traceback.extract_tb(trace)[-1]
-    tracetext = 'File %s, Line %d' % tracetop[:2]
-    if tracetop[2] != '?':
-        tracetext += ', Function %s' % tracetop[2]
-    exception_message = '%s:\n%s\n\n%s\n"%s"'
-    message = exception_message % (str(type), str(info), tracetext, tracetop[3])
-    title = os.path.splitext(os.path.basename(sys.argv[0]))[0]
-    title = title.capitalize() + ' Error'
-    NSRunAlertPanel(title, message, None, None, None)
-
-NibClassBuilder.extractClasses("MainMenu")
-class PygameAppDelegate(NibClassBuilder.AutoBaseClass):
-    def applicationDidFinishLaunching_(self, aNotification):
-        try:
-            import aliens
-            aliens.main()
-        except:
-            exception_handler()
-        NSApp().terminate_(self)
-
-    def applicationShouldTerminate_(self, app):
-        import pygame, pygame.event
-        pygame.event.post(pygame.event.Event(pygame.QUIT))
-        return NSTerminateNow
-
-if __name__ == '__main__':
-    AppHelper.runEventLoop()

examples/macosx/aliens_app_example/setup.py

 setup(
     data_files=['English.lproj', '../../data'],
     app=[
-        dict(script="aliens_bootstrap.py", plist=plist),
+        #dict(script="aliens_bootstrap.py", plist=plist),
+        dict(script="aliens.py", plist=plist),
     ],
 )

examples/scroll.py

+"""An zoomed image viewer that demonstrates Surface.scroll
+
+This example shows a scrollable image that has a zoom factor of eight.
+It uses the Surface.scroll function to shift the image on the display
+surface. A clip rectangle protects a margin area. If called as a function,
+the example accepts an optional image file path. If run as a program
+it takes an optional file path command line argument. If no file
+is provided a default image file is used.
+
+When running click on a black triangle to move one pixel in the direction
+the triangle points. Or use the arrow keys. Close the window or press ESC
+to quit.
+
+"""
+
+import sys
+import os
+
+import pygame
+from pygame.transform import scale
+from pygame.locals import *
+
+main_dir = os.path.dirname(os.path.abspath(__file__))
+
+DIR_UP = 1
+DIR_DOWN = 2
+DIR_LEFT = 3
+DIR_RIGHT = 4
+
+zoom_factor = 8
+
+def draw_arrow(surf, color, posn, direction):
+    x, y = posn
+    if direction == DIR_UP:
+        pointlist = ((x - 29, y + 30), (x + 30, y + 30),
+                     (x + 1, y - 29), (x, y - 29))
+    elif direction == DIR_DOWN:
+        pointlist = ((x - 29, y - 29), (x + 30, y - 29),
+                     (x + 1, y + 30), (x, y + 30))
+    elif direction == DIR_LEFT:
+        pointlist = ((x + 30, y - 29), (x + 30, y + 30),
+                     (x - 29, y + 1), (x - 29, y))
+    else:
+        pointlist = ((x - 29, y - 29), (x - 29, y + 30),
+                     (x + 30, y + 1), (x + 30, y))
+    pygame.draw.polygon(surf, color, pointlist)
+
+def add_arrow_button(screen, regions, posn, direction):
+    draw_arrow(screen, Color('black'), posn, direction)
+    draw_arrow(regions, (direction, 0, 0), posn, direction)
+
+def scroll_view(screen, image, direction, view_rect):
+    dx = dy = 0
+    src_rect = None
+    zoom_view_rect = screen.get_clip()
+    image_w, image_h = image.get_size()
+    if direction == DIR_UP:
+        if view_rect.top > 0:
+            screen.scroll(dy=zoom_factor)
+            view_rect.move_ip(0, -1)
+            src_rect = view_rect.copy()
+            src_rect.h = 1
+            dst_rect = zoom_view_rect.copy()
+            dst_rect.h = zoom_factor
+    elif direction == DIR_DOWN:
+        if view_rect.bottom < image_h:
+            screen.scroll(dy=-zoom_factor)
+            view_rect.move_ip(0, 1)
+            src_rect = view_rect.copy()
+            src_rect.h = 1
+            src_rect.bottom = view_rect.bottom
+            dst_rect = zoom_view_rect.copy()
+            dst_rect.h = zoom_factor
+            dst_rect.bottom = zoom_view_rect.bottom
+    elif direction == DIR_LEFT:
+        if view_rect.left > 0:
+            screen.scroll(dx=zoom_factor)
+            view_rect.move_ip(-1, 0)
+            src_rect = view_rect.copy()
+            src_rect.w = 1
+            dst_rect = zoom_view_rect.copy()
+            dst_rect.w = zoom_factor
+    elif direction == DIR_RIGHT:
+        if view_rect.right < image_w:
+            screen.scroll(dx=-zoom_factor)
+            view_rect.move_ip(1, 0)
+            src_rect = view_rect.copy()
+            src_rect.w = 1
+            src_rect.right = view_rect.right
+            dst_rect = zoom_view_rect.copy()
+            dst_rect.w = zoom_factor
+            dst_rect.right = zoom_view_rect.right
+    if src_rect is not None:
+        scale(image.subsurface(src_rect),
+              dst_rect.size,
+              screen.subsurface(dst_rect))
+        pygame.display.update(zoom_view_rect)
+
+def main(image_file=None):
+    if image_file is None:
+        image_file = os.path.join(main_dir, 'data', 'arraydemo.bmp')
+    margin = 80
+    view_size = (30, 20)
+    zoom_view_size = (view_size[0] * zoom_factor,
+                      view_size[1] * zoom_factor)
+    win_size = (zoom_view_size[0] + 2 * margin,
+                zoom_view_size[1] + 2 * margin)
+    background_color = Color('beige')
+
+    pygame.init()
+
+    # set up key repeating so we can hold down the key to scroll.
+    old_k_delay, old_k_interval = pygame.key.get_repeat ()
+    pygame.key.set_repeat (500, 30)
+
+    try:
+        screen = pygame.display.set_mode(win_size)
+        screen.fill(background_color)
+        pygame.display.flip()
+
+        image = pygame.image.load(image_file).convert()
+        image_w, image_h = image.get_size()
+
+        if image_w < view_size[0] or image_h < view_size[1]:
+            print "The source image is too small for this example."
+            print "A %i by %i or larger image is required." % zoom_view_size
+            return
+
+        regions = pygame.Surface(win_size, 0, 24)
+        add_arrow_button(screen, regions,
+                         (40, win_size[1] // 2), DIR_LEFT)
+        add_arrow_button(screen, regions,
+                         (win_size[0] - 40, win_size[1] // 2), DIR_RIGHT)
+        add_arrow_button(screen, regions,
+                         (win_size[0] // 2, 40), DIR_UP)
+        add_arrow_button(screen, regions,
+                         (win_size[0] // 2, win_size[1] - 40), DIR_DOWN)
+        pygame.display.flip()
+
+        screen.set_clip((margin, margin, zoom_view_size[0], zoom_view_size[1]))
+
+        view_rect = Rect(0, 0, view_size[0], view_size[1])
+
+        scale(image.subsurface(view_rect), zoom_view_size,
+              screen.subsurface(screen.get_clip()))
+        pygame.display.flip()
+
+
+        # the direction we will scroll in.
+        direction = None
+
+        clock = pygame.time.Clock()
+        clock.tick()
+
+        going = True
+        while going:
+            # wait for events before doing anything.
+            #events = [pygame.event.wait()] + pygame.event.get()
+            events = pygame.event.get()
+
+            for e in events:
+                if e.type == KEYDOWN:
+                    if e.key == K_ESCAPE:
+                        going = False
+                    elif e.key == K_DOWN:
+                        scroll_view(screen, image, DIR_DOWN, view_rect)
+                    elif e.key == K_UP:
+                        scroll_view(screen, image, DIR_UP, view_rect)
+                    elif e.key == K_LEFT:
+                        scroll_view(screen, image, DIR_LEFT, view_rect)
+                    elif e.key == K_RIGHT:
+                        scroll_view(screen, image, DIR_RIGHT, view_rect)
+                elif e.type == QUIT:
+                    going = False
+                elif e.type == MOUSEBUTTONDOWN:
+                    direction = regions.get_at(e.pos)[0]
+                elif e.type == MOUSEBUTTONUP:
+                    direction = None
+
+            if direction:
+                scroll_view(screen, image, direction, view_rect)
+            clock.tick(30)
+
+    finally:
+        pygame.key.set_repeat (old_k_delay, old_k_interval)
+        pygame.quit()
+
+if __name__ == '__main__':
+    if len(sys.argv) > 1:
+        image_file = sys.argv[1]
+    else:
+        image_file = None
+    main(image_file)
 pygame.examples.vgrade.main(): return None
 
 Demonstrates creating a vertical gradient with
-Numeric python. The app will create a new gradient every half
+NumPy python. The app will create a new gradient every half
 second and report the time needed to create and display the
 image. If you're not prepared to start working with the
-Numeric arrays, don't worry about the source for this one :]
+NumPy arrays, don't worry about the source for this one :]
 <END>
 
 
 values are 'numeric' or 'numpy'. Otherwise default to NumPy,
 or fall back on Numeric if NumPy is not installed.
 
-Uses sndarray and MumPy ( or Numeric) to create offset faded copies of the
+Uses sndarray and NumPy ( or Numeric) to create offset faded copies of the
 original sound. Currently it just uses hardcoded values for the
 number of echos and the delay. Easy for you to recreate as 
 needed. Run as a program sound_array_demos.py takes an optional
 on a console.
 
 new to pygame 1.9.0
-<END>
+<END>
+
+
+
+scroll.main
+run a Surface.scroll example that shows a magnified image
+pygame.examples.scroll.main(image_file=None): return None
+
+This example shows a scrollable image that has a zoom factor of eight.
+It uses the Surface.scroll function to shift the image on the display
+surface. A clip rectangle protects a margin area. If called as a function,
+the example accepts an optional image file path. If run as a program
+it takes an optional file path command line argument. If no file
+is provided a default image file is used.
+
+When running click on a black triangle to move one pixel in the direction
+the triangle points. Or use the arrow keys. Close the window or press ESC
+to quit.
+<END>
+

lib/midi.doc

Empty file added.
-"""uses portmidi for putting midi into pygame.This uses pyportmidi for now, but will probably use own bindings at somepoint."""import pygame.pypmpypm = pygame.pypmimport pygameimport pygame.localsimport atexit#MIDIIN = pygame.locals.USEREVENT + 10MIDIOUT = pygame.locals.USEREVENT + 11_init = Falsedef init():    global _init    if not _init:        pypm.Initialize()        _init = True        atexit.register(quit)def quit():    global _init    if _init:        # TODO: find all Input and Output classes and close them first?        pypm.Terminate()        _init = Falsedef get_count():    """ gets the count of devices.    """    return pypm.CountDevices()def get_default_input_device_id():    """gets the device number of the default input device.    """    return pypm.GetDefaultInputDeviceID()def get_default_output_device_id():    """get the device number of the default output device.    """    return pypm.GetDefaultOutputDeviceID()def get_device_info(an_id):    """ returns (interf, name, input, output, opened)    """    return pypm.GetDeviceInfo(an_id) class MidiException(Exception):    def __init__(self, value):        self.parameter = value    def __str__(self):        return repr(self.parameter)class Input(object):    def __init__(self, device_id, buffer_size=4096):        """        """        self._input = pypm.Input(device_id, buffer_size)        self.device_id = device_id    def read(self, length):        """ [[status,data1,data2,data3],timestamp]        """        return self._input.Read(length)    def poll(self):        """ returns true if there's data, or false if not.            Otherwise it raises a MidiException.        """        r = self._input.Poll()        if r == pypm.TRUE:            return True        elif r == pypm.FALSE:            return False        else:            err_text = GetErrorText(r)            raise MidiException( (r, err_text) )class Output(object):    def __init__(self, device_id, latency = 0):        """        """        self._output = pypm.Output(device_id, latency)        self.device_id = device_id    def write(self, data):        """        """        self._output.Write(data)    def write_short(self, status, data1 = 0, data2 = 0):        """        """        self._output.WriteShort(status, data1, data2)    def write_sys_ex(self, when, msg):        """        """        self._output.WriteSysEx(when, msg)    def note_on(self, note, velocity=None):        """        """        if velocity is None:            velocity = 0        self.write_short(0x90, note, velocity)    def note_off(self, note, velocity=None):        """        """        if velocity is None:            velocity = 0        self.write_short(0x80, note, velocity)    def set_instrument(self, instrument_id):        """        """        if not (0 <= instrument_id <= 127):            raise ValueError("Undefined instrument id: %d" % instrument_id)        self.write_short(0xc0, instrument_id)def midis2events(midis, device_id):    """ takes a sequence of midi events and returns pygame events.    """    evs = []    for midi in midis:        ((status,data1,data2,data3),timestamp) = midi        e = pygame.event.Event(MIDIIN,                               status=status,                               data1=data1,                               data2=data2,                               data3=data3,                               timestamp=timestamp,                               vice_id = device_id)        evs.append( e )    return evs
+"""
+TODO:
+    - write all docs as inline python docs.
+    - rewrite docs for pygame doc style.
+        - follow the format, and style of current docs.
+    - export docs from .py to .doc.
+    - create a background thread version for input threads.
+        - that can automatically inject input into the event queue
+          once the input object is running.  Like joysticks.
+    - generate test stubs (probably after docs are written)
+        - $ cd test/util/
+          $ python gen_stubs.py sprite.Sprite
+    - start writing tests.
+
+Uses portmidi library for putting midi into and out of pygame.
+
+This uses pyportmidi for now, but may use its own bindings at some
+point.
+"""
+
+
+
+
+import pygame
+import pygame.locals
+
+import atexit
+
+
+#
+MIDIIN = pygame.locals.USEREVENT + 10
+MIDIOUT = pygame.locals.USEREVENT + 11
+
+_init = False
+
+
+
+def init():
+    """ Call the initialisation function before using the midi module.
+    """
+    global _init, pypm
+    if not _init:
+        import pygame.pypm
+        pypm = pygame.pypm
+
+        pypm.Initialize()
+        _init = True
+        atexit.register(quit)
+
+def quit():
+    """ Call this to quit the midi module.
+
+        Called automatically atexit if you don't call it.
+    """
+    global _init, pypm
+    if _init:
+        # TODO: find all Input and Output classes and close them first?
+        pypm.Terminate()
+        _init = False
+        del pypm
+        del pygame.pypm
+
+
+
+
+def get_count():
+    """ gets the number of devices.
+        Device ids range from 0 to get_count() -1
+    """
+    return pypm.CountDevices()
+
+
+
+
+def get_default_input_device_id():
+    """gets the device number of the default input device.
+
+    Return the default device ID or -1 if there are no devices.
+    The result can be passed to the Input()/Ouput() class.
+
+    On the PC, the user can specify a default device by
+    setting an environment variable. For example, to use device #1.
+
+        set PM_RECOMMENDED_OUTPUT_DEVICE=1
+
+    The user should first determine the available device ID by using
+    the supplied application "testin" or "testout".
+
+    In general, the registry is a better place for this kind of info,
+    and with USB devices that can come and go, using integers is not
+    very reliable for device identification. Under Windows, if
+    PM_RECOMMENDED_OUTPUT_DEVICE (or PM_RECOMMENDED_INPUT_DEVICE) is
+    *NOT* found in the environment, then the default device is obtained
+    by looking for a string in the registry under:
+        HKEY_LOCAL_MACHINE/SOFTWARE/PortMidi/Recommended_Input_Device
+    and HKEY_LOCAL_MACHINE/SOFTWARE/PortMidi/Recommended_Output_Device
+    for a string. The number of the first device with a substring that
+    matches the string exactly is returned. For example, if the string
+    in the registry is "USB", and device 1 is named
+    "In USB MidiSport 1x1", then that will be the default
+    input because it contains the string "USB".
+
+    In addition to the name, get_device_info() returns "interf", which
+    is the interface name. (The "interface" is the underlying software
+	system or API used by PortMidi to access devices. Examples are
+	MMSystem, DirectX (not implemented), ALSA, OSS (not implemented), etc.)
+	At present, the only Win32 interface is "MMSystem", the only Linux
+	interface is "ALSA", and the only Max OS X interface is "CoreMIDI".
+    To specify both the interface and the device name in the registry,
+    separate the two with a comma and a space, e.g.:
+        MMSystem, In USB MidiSport 1x1
+    In this case, the string before the comma must be a substring of
+    the "interf" string, and the string after the space must be a
+    substring of the "name" name string in order to match the device.
+
+    Note: in the current release, the default is simply the first device
+	(the input or output device with the lowest PmDeviceID).
+    """
+    return pypm.GetDefaultInputDeviceID()
+
+
+
+
+def get_default_output_device_id():
+    """get the device number of the default output device.
+
+    TODO: rewrite the doc from get_default_input_device_id for here too.
+           TODO: once those docs have been rewritten.  
+    """
+    return pypm.GetDefaultOutputDeviceID()
+
+
+def get_device_info(an_id):
+    """ returns (interf, name, input, output, opened)
+
+    If the id is out of range, the function returns None.
+    """
+    return pypm.GetDeviceInfo(an_id) 
+
+
+class MidiException(Exception):
+    def __init__(self, value):
+        self.parameter = value
+    def __str__(self):
+        return repr(self.parameter)
+
+
+class Input(object):
+
+
+    def __init__(self, device_id, buffer_size=4096):
+        """
+        The buffer_size specifies the number of input events to be buffered 
+        waiting to be read using Input.read().
+        """
+        self._input = pypm.Input(device_id, buffer_size)
+        self.device_id = device_id
+
+
+    def read(self, length):
+        """ [[status,data1,data2,data3],timestamp]
+        """
+        return self._input.Read(length)
+
+    def poll(self):
+        """ returns true if there's data, or false if not.
+            Otherwise it raises a MidiException.
+        """
+        r = self._input.Poll()
+        if r == pypm.TRUE:
+            return True
+        elif r == pypm.FALSE:
+            return False
+        else:
+            err_text = GetErrorText(r)
+            raise MidiException( (r, err_text) )
+
+
+
+
+class Output(object):
+    def __init__(self, device_id, latency = 0, buffer_size = 4096):
+        """
+        The buffer_size specifies the number of output events to be 
+        buffered waiting for output.  (In some cases -- see below -- 
+        PortMidi does not buffer output at all and merely passes data 
+        to a lower-level API, in which case buffersize is ignored.)
+
+        latency is the delay in milliseconds applied to timestamps to determine
+        when the output should actually occur. (If latency is < 0, 0 is 
+        assumed.)
+
+        If latency is zero, timestamps are ignored and all output is delivered
+        immediately. If latency is greater than zero, output is delayed until
+        the message timestamp plus the latency. (NOTE: time is measured 
+        relative to the time source indicated by time_proc. Timestamps are 
+        absolute, not relative delays or offsets.) In some cases, PortMidi 
+        can obtain better timing than your application by passing timestamps 
+        along to the device driver or hardware. Latency may also help you 
+        to synchronize midi data to audio data by matching midi latency to 
+        the audio buffer latency.
+        """
+        self._output = pypm.Output(device_id, latency)
+        self.device_id = device_id
+
+    def write(self, data):
+        """
+
+        output a series of MIDI information in the form of a list:
+             write([[[status <,data1><,data2><,data3>],timestamp],
+                    [[status <,data1><,data2><,data3>],timestamp],...])
+        <data> fields are optional
+        example: choose program change 1 at time 20000 and
+        send note 65 with velocity 100 500 ms later.
+             write([[[0xc0,0,0],20000],[[0x90,60,100],20500]])
+        notes:
+          1. timestamps will be ignored if latency = 0.
+          2. To get a note to play immediately, send MIDI info with
+             timestamp read from function Time.
+          3. understanding optional data fields:
+               write([[[0xc0,0,0],20000]]) is equivalent to
+               write([[[0xc0],20000]])
+
+        Can send up to 1024 elements in your data list, otherwise an 
+         IndexError exception is raised.
+        """
+        self._output.Write(data)
+
+
+    def write_short(self, status, data1 = 0, data2 = 0):
+        """ write_short(status <, data1><, data2>)
+             output MIDI information of 3 bytes or less.
+             data fields are optional
+             status byte could be:
+                  0xc0 = program change
+                  0x90 = note on
+                  etc.
+                  data bytes are optional and assumed 0 if omitted
+             example: note 65 on with velocity 100
+                  WriteShort(0x90,65,100)
+        """
+        self._output.WriteShort(status, data1, data2)
+
+
+    def write_sys_ex(self, when, msg):
+        """ write_sys_ex(<timestamp>,<msg>)
+        writes a timestamped system-exclusive midi message.
+        <msg> can be a *list* or a *string*
+        example:
+            (assuming y is an input MIDI stream)
+            y.write_sys_ex(0,'\\xF0\\x7D\\x10\\x11\\x12\\x13\\xF7')
+                              is equivalent to
+            y.write_sys_ex(pygame.midi.Time,
+            [0xF0, 0x7D, 0x10, 0x11, 0x12, 0x13, 0xF7])
+        """
+        self._output.WriteSysEx(when, msg)
+
+
+    def note_on(self, note, velocity=None):
+        """ note_on(note, velocity=None)
+        Turn a note on in the output stream.
+        """
+        if velocity is None:
+            velocity = 0
+        self.write_short(0x90, note, velocity)
+
+    def note_off(self, note, velocity=None):
+        """ note_off(note, velocity=None)
+        Turn a note off in the output stream.
+        """
+        if velocity is None:
+            velocity = 0
+        self.write_short(0x80, note, velocity)
+
+    def set_instrument(self, instrument_id):
+        """ set_instrument(instrument_id)
+        Select an instrument, with a value between 0 and 127.
+        """
+        if not (0 <= instrument_id <= 127):
+            raise ValueError("Undefined instrument id: %d" % instrument_id)
+        self.write_short(0xc0, instrument_id)
+
+
+def time():
+    """ Returns the current time in ms of the PortMidi timer.
+    """
+    return pypm.Time()
+
+
+
+def midis2events(midis, device_id):
+    """ takes a sequence of midi events and returns a list of pygame events.
+    """
+    evs = []
+    for midi in midis:
+
+        ((status,data1,data2,data3),timestamp) = midi
+
+        e = pygame.event.Event(MIDIIN,
+                               status=status,
+                               data1=data1,
+                               data2=data2,
+                               data3=data3,
+                               timestamp=timestamp,
+                               vice_id = device_id)
+        evs.append( e )
+
+
+    return evs
+
+
+
+
+
+

msys_build_deps.py

 
 # This list includes the MSYS shell scripts to build each library. Each script
 # runs in an environment where MINGW_ROOT_DIRECTORY is defined and the MinGW
-# bin directory is in PATH. Three other environment variables are defined:
+# bin directory is in PATH. Four other environment variables are defined:
 # BDCONF, BDCOMP, BDINST and BDCLEAN. They are either '0' or '1'. They
 # represent configure, compile, install and clean respectively. When '1' the
 # corresponding action is performed. When '0' it is skipped. A final variable,
 fi
 
 if [ x$BDINST == x1 ]; then
-  # Only install the headers and import library, otherwise SDL_image will
+  # Don't install any libtools info files so SDL_image will not
   # statically link to jpeg.
   cd libtiff
   make install-data-am

src/SDL_gfx/SDL_gfxPrimitives.c

+/* 
+
+ SDL_gfxPrimitives - Graphics primitives for SDL surfaces
+
+ LGPL (c) A. Schiffler
+
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <string.h>
+
+#include "SDL_gfxPrimitives.h"
+#include "SDL_gfxPrimitives_font.h"
+
+/* -===================- */
+
+#define DEFAULT_ALPHA_PIXEL_ROUTINE
+
+/* ----- Defines for pixel clipping tests */
+
+#define clip_xmin(surface) surface->clip_rect.x
+#define clip_xmax(surface) surface->clip_rect.x+surface->clip_rect.w-1
+#define clip_ymin(surface) surface->clip_rect.y
+#define clip_ymax(surface) surface->clip_rect.y+surface->clip_rect.h-1
+
+/* ----- Pixel - fast, no blending, no locking, clipping */
+
+int fastPixelColorNolock(SDL_Surface * dst, Sint16 x, Sint16 y, Uint32 color)
+{
+    int bpp;
+    Uint8 *p;
+
+    /*
+     * Honor clipping setup at pixel level 
+     */
+    if ((x >= clip_xmin(dst)) && (x <= clip_xmax(dst)) && (y >= clip_ymin(dst)) && (y <= clip_ymax(dst))) {
+
+	/*
+	 * Get destination format 
+	 */
+	bpp = dst->format->BytesPerPixel;
+	p = (Uint8 *) dst->pixels + y * dst->pitch + x * bpp;
+	switch (bpp) {
+	case 1:
+	    *p = color;
+	    break;
+	case 2:
+	    *(Uint16 *) p = color;
+	    break;
+	case 3:
+	    if (SDL_BYTEORDER == SDL_BIG_ENDIAN) {
+		p[0] = (color >> 16) & 0xff;
+		p[1] = (color >> 8) & 0xff;
+		p[2] = color & 0xff;
+	    } else {
+		p[0] = color & 0xff;
+		p[1] = (color >> 8) & 0xff;
+		p[2] = (color >> 16) & 0xff;
+	    }
+	    break;
+	case 4:
+	    *(Uint32 *) p = color;
+	    break;
+	}			/* switch */
+
+
+    }
+
+    return (0);
+}
+
+/* ----- Pixel - fast, no blending, no locking, no clipping */
+
+/* (faster but dangerous, make sure we stay in surface bounds) */
+
+int fastPixelColorNolockNoclip(SDL_Surface * dst, Sint16 x, Sint16 y, Uint32 color)
+{
+    int bpp;
+    Uint8 *p;
+
+    /*
+     * Get destination format 
+     */
+    bpp = dst->format->BytesPerPixel;
+    p = (Uint8 *) dst->pixels + y * dst->pitch + x * bpp;
+    switch (bpp) {
+    case 1:
+	*p = color;
+	break;
+    case 2:
+	*(Uint16 *) p = color;
+	break;
+    case 3:
+	if (SDL_BYTEORDER == SDL_BIG_ENDIAN) {
+	    p[0] = (color >> 16) & 0xff;
+	    p[1] = (color >> 8) & 0xff;
+	    p[2] = color & 0xff;
+	} else {
+	    p[0] = color & 0xff;
+	    p[1] = (color >> 8) & 0xff;
+	    p[2] = (color >> 16) & 0xff;
+	}
+	break;
+    case 4:
+	*(Uint32 *) p = color;
+	break;
+    }				/* switch */
+
+    return (0);
+}
+
+/* ----- Pixel - fast, no blending, locking, clipping */
+
+int fastPixelColor(SDL_Surface * dst, Sint16 x, Sint16 y, Uint32 color)
+{
+    int result;
+
+    /*
+     * Lock the surface 
+     */
+    if (SDL_MUSTLOCK(dst)) {
+	if (SDL_LockSurface(dst) < 0) {
+	    return (-1);
+	}
+    }
+
+    result = fastPixelColorNolock(dst, x, y, color);
+
+    /*
+     * Unlock surface 
+     */
+    if (SDL_MUSTLOCK(dst)) {
+	SDL_UnlockSurface(dst);
+    }
+
+    return (result);
+}
+
+/* ----- Pixel - fast, no blending, locking, RGB input */
+
+int fastPixelRGBA(SDL_Surface * dst, Sint16 x, Sint16 y, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
+{
+    Uint32 color;
+
+    /*
+     * Setup color 
+     */
+    color = SDL_MapRGBA(dst->format, r, g, b, a);
+
+    /*
+     * Draw 
+     */
+    return (fastPixelColor(dst, x, y, color));
+
+}
+
+/* ----- Pixel - fast, no blending, no locking RGB input */
+
+int fastPixelRGBANolock(SDL_Surface * dst, Sint16 x, Sint16 y, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
+{
+    Uint32 color;
+
+    /*
+     * Setup color 
+     */
+    color = SDL_MapRGBA(dst->format, r, g, b, a);
+
+    /*
+     * Draw 
+     */
+    return (fastPixelColorNolock(dst, x, y, color));
+}
+
+/* PutPixel routine with alpha blending, input color in destination format */
+
+/* New, faster routine - default blending pixel */
+
+int _putPixelAlpha(SDL_Surface * surface, Sint16 x, Sint16 y, Uint32 color, Uint8 alpha)
+{
+    Uint32 Rmask = surface->format->Rmask, Gmask =
+	surface->format->Gmask, Bmask = surface->format->Bmask, Amask = surface->format->Amask;
+    Uint32 R = 0, G = 0, B = 0, A = 0;
+
+    if (x >= clip_xmin(surface) && x <= clip_xmax(surface)
+	&& y >= clip_ymin(surface) && y <= clip_ymax(surface)) {
+
+	switch (surface->format->BytesPerPixel) {
+	case 1:{		/* Assuming 8-bpp */
+		if (alpha == 255) {
+		    *((Uint8 *) surface->pixels + y * surface->pitch + x) = color;
+		} else {
+		    Uint8 *pixel = (Uint8 *) surface->pixels + y * surface->pitch + x;
+
+		    Uint8 dR = surface->format->palette->colors[*pixel].r;
+		    Uint8 dG = surface->format->palette->colors[*pixel].g;
+		    Uint8 dB = surface->format->palette->colors[*pixel].b;
+		    Uint8 sR = surface->format->palette->colors[color].r;
+		    Uint8 sG = surface->format->palette->colors[color].g;
+		    Uint8 sB = surface->format->palette->colors[color].b;
+
+		    dR = dR + ((sR - dR) * alpha >> 8);
+		    dG = dG + ((sG - dG) * alpha >> 8);
+		    dB = dB + ((sB - dB) * alpha >> 8);
+
+		    *pixel = SDL_MapRGB(surface->format, dR, dG, dB);
+		}
+	    }
+	    break;
+
+	case 2:{		/* Probably 15-bpp or 16-bpp */
+		if (alpha == 255) {
+		    *((Uint16 *) surface->pixels + y * surface->pitch / 2 + x) = color;
+		} else {
+		    Uint16 *pixel = (Uint16 *) surface->pixels + y * surface->pitch / 2 + x;
+		    Uint32 dc = *pixel;
+
+		    R = ((dc & Rmask) + (((color & Rmask) - (dc & Rmask)) * alpha >> 8)) & Rmask;
+		    G = ((dc & Gmask) + (((color & Gmask) - (dc & Gmask)) * alpha >> 8)) & Gmask;
+		    B = ((dc & Bmask) + (((color & Bmask) - (dc & Bmask)) * alpha >> 8)) & Bmask;
+		    if (Amask)
+			A = ((dc & Amask) + (((color & Amask) - (dc & Amask)) * alpha >> 8)) & Amask;
+
+		    *pixel = R | G | B | A;
+		}
+	    }
+	    break;
+
+	case 3:{		/* Slow 24-bpp mode, usually not used */
+		Uint8 *pix = (Uint8 *) surface->pixels + y * surface->pitch + x * 3;
+		Uint8 rshift8 = surface->format->Rshift / 8;
+		Uint8 gshift8 = surface->format->Gshift / 8;
+		Uint8 bshift8 = surface->format->Bshift / 8;
+		Uint8 ashift8 = surface->format->Ashift / 8;
+
+
+		if (alpha == 255) {
+		    *(pix + rshift8) = color >> surface->format->Rshift;
+		    *(pix + gshift8) = color >> surface->format->Gshift;
+		    *(pix + bshift8) = color >> surface->format->Bshift;
+		    *(pix + ashift8) = color >> surface->format->Ashift;
+		} else {
+		    Uint8 dR, dG, dB, dA = 0;
+		    Uint8 sR, sG, sB, sA = 0;
+
+		    pix = (Uint8 *) surface->pixels + y * surface->pitch + x * 3;
+
+		    dR = *((pix) + rshift8);
+		    dG = *((pix) + gshift8);
+		    dB = *((pix) + bshift8);
+		    dA = *((pix) + ashift8);
+
+		    sR = (color >> surface->format->Rshift) & 0xff;
+		    sG = (color >> surface->format->Gshift) & 0xff;
+		    sB = (color >> surface->format->Bshift) & 0xff;
+		    sA = (color >> surface->format->Ashift) & 0xff;
+
+		    dR = dR + ((sR - dR) * alpha >> 8);
+		    dG = dG + ((sG - dG) * alpha >> 8);
+		    dB = dB + ((sB - dB) * alpha >> 8);
+		    dA = dA + ((sA - dA) * alpha >> 8);
+
+		    *((pix) + rshift8) = dR;
+		    *((pix) + gshift8) = dG;
+		    *((pix) + bshift8) = dB;
+		    *((pix) + ashift8) = dA;
+		}
+	    }
+	    break;
+
+#ifdef DEFAULT_ALPHA_PIXEL_ROUTINE
+
+	case 4:{		/* Probably :-) 32-bpp */
+		if (alpha == 255) {
+		    *((Uint32 *) surface->pixels + y * surface->pitch / 4 + x) = color;
+		} else {
+		    Uint32 Rshift, Gshift, Bshift, Ashift;
+		    Uint32 *pixel = (Uint32 *) surface->pixels + y * surface->pitch / 4 + x;
+		    Uint32 dc = *pixel;
+
+		    Rshift = surface->format->Rshift;
+		    Gshift = surface->format->Gshift;
+		    Bshift = surface->format->Bshift;
+		    Ashift = surface->format->Ashift;
+
+		    R = ((dc & Rmask) + (((((color & Rmask) - (dc & Rmask)) >> Rshift) * alpha >> 8) << Rshift)) & Rmask;
+		    G = ((dc & Gmask) + (((((color & Gmask) - (dc & Gmask)) >> Gshift) * alpha >> 8) << Gshift)) & Gmask;
+		    B = ((dc & Bmask) + (((((color & Bmask) - (dc & Bmask)) >> Bshift) * alpha >> 8) << Bshift)) & Bmask;
+		    if (Amask)
+			A = ((dc & Amask) + (((((color & Amask) - (dc & Amask)) >> Ashift) * alpha >> 8) << Ashift)) & Amask;
+
+		    *pixel = R | G | B | A;
+		}
+	    }
+	    break;
+#endif
+
+#ifdef EXPERIMENTAL_ALPHA_PIXEL_ROUTINE
+
+	case 4:{		/* Probably :-) 32-bpp */
+		if (alpha == 255) {
+		    *((Uint32 *) surface->pixels + y * surface->pitch / 4 + x) = color;
+		} else {
+		    Uint32 Rshift, Gshift, Bshift, Ashift;
+		    Uint32 *pixel = (Uint32 *) surface->pixels + y * surface->pitch / 4 + x;
+		    Uint32 dc = *pixel;
+		    Uint32 dR = (color & Rmask), dG = (color & Gmask), dB = (color & Bmask), dA = (color & Amask);
+		    Uint32 surfaceAlpha, preMultR, preMultG, preMultB;
+		    Uint32 aTmp;
+
+		    Rshift = surface->format->Rshift;
+		    Gshift = surface->format->Gshift;
+		    Bshift = surface->format->Bshift;
+		    Ashift = surface->format->Ashift;
+
+                    preMultR = (alpha * (dR>>Rshift));
+                    preMultG = (alpha * (dG>>Gshift));
+                    preMultB = (alpha * (dB>>Bshift));
+
+                    surfaceAlpha = ((dc & Amask) >> Ashift);
+                    aTmp = (255 - alpha);
+                    if (A = 255 - ((aTmp * (255 - surfaceAlpha)) >> 8 )) {
+                      aTmp *= surfaceAlpha;
+                      R = (preMultR + ((aTmp * ((dc & Rmask) >> Rshift)) >> 8)) / A << Rshift & Rmask;
+                      G = (preMultG + ((aTmp * ((dc & Gmask) >> Gshift)) >> 8)) / A << Gshift & Gmask;
+                      B = (preMultB + ((aTmp * ((dc & Bmask) >> Bshift)) >> 8)) / A << Bshift & Bmask;
+                    }
+		    *pixel = R | G | B | (A << Ashift & Amask);
+
+		}
+	    }
+	    break;
+#endif
+	}
+    }
+
+    return (0);
+}
+
+/* ----- Pixel - pixel draw with blending enabled if a<255 */
+
+int pixelColor(SDL_Surface * dst, Sint16 x, Sint16 y, Uint32 color)
+{
+    Uint8 alpha;
+    Uint32 mcolor;
+    int result = 0;
+
+    /*
+     * Lock the surface 
+     */
+    if (SDL_MUSTLOCK(dst)) {
+	if (SDL_LockSurface(dst) < 0) {
+	    return (-1);
+	}
+    }
+
+    /*
+     * Setup color 
+     */
+    alpha = color & 0x000000ff;
+    mcolor =
+	SDL_MapRGBA(dst->format, (color & 0xff000000) >> 24,
+		    (color & 0x00ff0000) >> 16, (color & 0x0000ff00) >> 8, alpha);
+
+    /*
+     * Draw 
+     */
+    result = _putPixelAlpha(dst, x, y, mcolor, alpha);
+
+    /*
+     * Unlock the surface 
+     */
+    if (SDL_MUSTLOCK(dst)) {
+	SDL_UnlockSurface(dst);
+    }
+
+    return (result);
+}
+
+int pixelColorNolock(SDL_Surface * dst, Sint16 x, Sint16 y, Uint32 color)
+{
+    Uint8 alpha;
+    Uint32 mcolor;
+    int result = 0;
+
+    /*
+     * Setup color 
+     */
+    alpha = color & 0x000000ff;
+    mcolor =
+	SDL_MapRGBA(dst->format, (color & 0xff000000) >> 24,
+		    (color & 0x00ff0000) >> 16, (color & 0x0000ff00) >> 8, alpha);
+
+    /*
+     * Draw 
+     */
+    result = _putPixelAlpha(dst, x, y, mcolor, alpha);
+
+    return (result);
+}
+
+
+/* Filled rectangle with alpha blending, color in destination format */
+
+int _filledRectAlpha(SDL_Surface * surface, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color, Uint8 alpha)
+{
+    Uint32 Rmask = surface->format->Rmask, Gmask =
+	surface->format->Gmask, Bmask = surface->format->Bmask, Amask = surface->format->Amask;
+    Uint32 R, G, B, A = 0;
+    Sint16 x, y;
+
+    switch (surface->format->BytesPerPixel) {
+    case 1:{			/* Assuming 8-bpp */
+	    Uint8 *row, *pixel;
+	    Uint8 dR, dG, dB;
+
+	    Uint8 sR = surface->format->palette->colors[color].r;
+	    Uint8 sG = surface->format->palette->colors[color].g;
+	    Uint8 sB = surface->format->palette->colors[color].b;
+
+	    for (y = y1; y <= y2; y++) {
+		row = (Uint8 *) surface->pixels + y * surface->pitch;
+		for (x = x1; x <= x2; x++) {
+		    pixel = row + x;
+
+		    dR = surface->format->palette->colors[*pixel].r;
+		    dG = surface->format->palette->colors[*pixel].g;
+		    dB = surface->format->palette->colors[*pixel].b;
+
+		    dR = dR + ((sR - dR) * alpha >> 8);
+		    dG = dG + ((sG - dG) * alpha >> 8);
+		    dB = dB + ((sB - dB) * alpha >> 8);
+
+		    *pixel = SDL_MapRGB(surface->format, dR, dG, dB);
+		}
+	    }
+	}
+	break;
+
+    case 2:{			/* Probably 15-bpp or 16-bpp */
+	    Uint16 *row, *pixel;
+	    Uint32 dR = (color & Rmask), dG = (color & Gmask), dB = (color & Bmask), dA = (color & Amask);
+
+	    for (y = y1; y <= y2; y++) {
+		row = (Uint16 *) surface->pixels + y * surface->pitch / 2;
+		for (x = x1; x <= x2; x++) {
+		    pixel = row + x;
+
+		    R = ((*pixel & Rmask) + ((dR - (*pixel & Rmask)) * alpha >> 8)) & Rmask;
+		    G = ((*pixel & Gmask) + ((dG - (*pixel & Gmask)) * alpha >> 8)) & Gmask;
+		    B = ((*pixel & Bmask) + ((dB - (*pixel & Bmask)) * alpha >> 8)) & Bmask;
+		    if (Amask)
+			A = ((*pixel & Amask) + ((dA - (*pixel & Amask)) * alpha >> 8)) & Amask;
+
+		    *pixel = R | G | B | A;
+		}
+	    }
+	}
+	break;
+
+    case 3:{			/* Slow 24-bpp mode, usually not used */
+	    Uint8 *row, *pix;
+	    Uint8 dR, dG, dB, dA;
+	    Uint8 rshift8 = surface->format->Rshift / 8;
+	    Uint8 gshift8 = surface->format->Gshift / 8;
+	    Uint8 bshift8 = surface->format->Bshift / 8;
+	    Uint8 ashift8 = surface->format->Ashift / 8;
+
+	    Uint8 sR = (color >> surface->format->Rshift) & 0xff;
+	    Uint8 sG = (color >> surface->format->Gshift) & 0xff;
+	    Uint8 sB = (color >> surface->format->Bshift) & 0xff;
+	    Uint8 sA = (color >> surface->format->Ashift) & 0xff;
+
+	    for (y = y1; y <= y2; y++) {
+		row = (Uint8 *) surface->pixels + y * surface->pitch;
+		for (x = x1; x <= x2; x++) {
+		    pix = row + x * 3;
+
+		    dR = *((pix) + rshift8);
+		    dG = *((pix) + gshift8);
+		    dB = *((pix) + bshift8);
+		    dA = *((pix) + ashift8);
+
+		    dR = dR + ((sR - dR) * alpha >> 8);
+		    dG = dG + ((sG - dG) * alpha >> 8);
+		    dB = dB + ((sB - dB) * alpha >> 8);
+		    dA = dA + ((sA - dA) * alpha >> 8);
+
+		    *((pix) + rshift8) = dR;
+		    *((pix) + gshift8) = dG;
+		    *((pix) + bshift8) = dB;
+		    *((pix) + ashift8) = dA;
+		}
+	    }
+
+	}
+	break;
+
+#ifdef DEFAULT_ALPHA_PIXEL_ROUTINE
+    case 4:{			/* Probably :-) 32-bpp */
+	    Uint32 Rshift, Gshift, Bshift, Ashift;
+	    Uint32 *row, *pixel;
+	    Uint32 dR = (color & Rmask), dG = (color & Gmask), dB = (color & Bmask), dA = (color & Amask);
+
+	    Rshift = surface->format->Rshift;
+	    Gshift = surface->format->Gshift;
+	    Bshift = surface->format->Bshift;
+	    Ashift = surface->format->Ashift;
+
+	    for (y = y1; y <= y2; y++) {
+		row = (Uint32 *) surface->pixels + y * surface->pitch / 4;
+		for (x = x1; x <= x2; x++) {
+		    pixel = row + x;
+
+		    R = ((*pixel & Rmask) + ((((dR - (*pixel & Rmask)) >> Rshift) * alpha >> 8) << Rshift)) & Rmask;
+		    G = ((*pixel & Gmask) + ((((dG - (*pixel & Gmask)) >> Gshift) * alpha >> 8) << Gshift)) & Gmask;
+		    B = ((*pixel & Bmask) + ((((dB - (*pixel & Bmask)) >> Bshift) * alpha >> 8) << Bshift)) & Bmask;
+		    if (Amask)
+			A = ((*pixel & Amask) + ((((dA - (*pixel & Amask)) >> Ashift) * alpha >> 8) << Ashift)) & Amask;
+
+		    *pixel = R | G | B | A;
+		}
+	    }
+	}
+	break;
+#endif
+
+#ifdef EXPERIMENTAL_ALPHA_PIXEL_ROUTINE
+    case 4:{			/* Probably :-) 32-bpp */
+	    Uint32 Rshift, Gshift, Bshift, Ashift;
+	    Uint32 *row, *pixel;
+	    Uint32 dR = (color & Rmask), dG = (color & Gmask), dB = (color & Bmask), dA = (color & Amask);
+            Uint32 dc;
+            Uint32 surfaceAlpha, preMultR, preMultG, preMultB;
+            Uint32 aTmp;
+
+	    Rshift = surface->format->Rshift;
+	    Gshift = surface->format->Gshift;
+	    Bshift = surface->format->Bshift;
+	    Ashift = surface->format->Ashift;
+
+            preMultR = (alpha * (dR>>Rshift));
+            preMultG = (alpha * (dG>>Gshift));
+            preMultB = (alpha * (dB>>Bshift));
+
+	    for (y = y1; y <= y2; y++) {
+		row = (Uint32 *) surface->pixels + y * surface->pitch / 4;
+		for (x = x1; x <= x2; x++) {
+		    pixel = row + x;
+		    dc = *pixel;
+
+                    surfaceAlpha = ((dc & Amask) >> Ashift);
+                    aTmp = (255 - alpha);
+                    if (A = 255 - ((aTmp * (255 - surfaceAlpha)) >> 8 )) {
+                      aTmp *= surfaceAlpha;
+                      R = (preMultR + ((aTmp * ((dc & Rmask) >> Rshift)) >> 8)) / A << Rshift & Rmask;
+                      G = (preMultG + ((aTmp * ((dc & Gmask) >> Gshift)) >> 8)) / A << Gshift & Gmask;
+                      B = (preMultB + ((aTmp * ((dc & Bmask) >> Bshift)) >> 8)) / A << Bshift & Bmask;
+                    }
+		    *pixel = R | G | B | (A << Ashift & Amask);
+		    
+		}
+	    }
+	}
+	break;
+#endif
+	
+    }
+
+    return (0);
+}
+
+/* Draw rectangle with alpha enabled from RGBA color. */
+
+int filledRectAlpha(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color)
+{
+    Uint8 alpha;
+    Uint32 mcolor;
+    int result = 0;
+
+    /*
+     * Lock the surface 
+     */
+    if (SDL_MUSTLOCK(dst)) {
+	if (SDL_LockSurface(dst) < 0) {
+	    return (-1);
+	}
+    }
+
+    /*
+     * Setup color 
+     */
+    alpha = color & 0x000000ff;
+    mcolor =
+	SDL_MapRGBA(dst->format, (color & 0xff000000) >> 24,
+		    (color & 0x00ff0000) >> 16, (color & 0x0000ff00) >> 8, alpha);
+
+    /*
+     * Draw 
+     */
+    result = _filledRectAlpha(dst, x1, y1, x2, y2, mcolor, alpha);
+
+    /*
+     * Unlock the surface 
+     */
+    if (SDL_MUSTLOCK(dst)) {
+	SDL_UnlockSurface(dst);
+    }
+
+    return (result);
+}
+
+/* Draw horizontal line with alpha enabled from RGBA color */
+
+int HLineAlpha(SDL_Surface * dst, Sint16 x1, Sint16 x2, Sint16 y, Uint32 color)
+{
+    return (filledRectAlpha(dst, x1, y, x2, y, color));
+}
+
+
+/* Draw vertical line with alpha enabled from RGBA color */
+
+int VLineAlpha(SDL_Surface * dst, Sint16 x, Sint16 y1, Sint16 y2, Uint32 color)
+{
+    return (filledRectAlpha(dst, x, y1, x, y2, color));
+}
+
+
+/* Pixel - using alpha weight on color for AA-drawing */
+
+int pixelColorWeight(SDL_Surface * dst, Sint16 x, Sint16 y, Uint32 color, Uint32 weight)
+{
+    Uint32 a;
+
+    /*
+     * Get alpha 
+     */
+    a = (color & (Uint32) 0x000000ff);
+
+    /*
+     * Modify Alpha by weight 
+     */
+    a = ((a * weight) >> 8);
+
+    return (pixelColor(dst, x, y, (color & (Uint32) 0xffffff00) | (Uint32) a));
+}
+
+/* Pixel - using alpha weight on color for AA-drawing - no locking */
+
+int pixelColorWeightNolock(SDL_Surface * dst, Sint16 x, Sint16 y, Uint32 color, Uint32 weight)
+{
+    Uint32 a;
+
+    /*
+     * Get alpha 
+     */
+    a = (color & (Uint32) 0x000000ff);
+
+    /*
+     * Modify Alpha by weight 
+     */
+    a = ((a * weight) >> 8);
+
+    return (pixelColorNolock(dst, x, y, (color & (Uint32) 0xffffff00) | (Uint32) a));
+}
+
+int pixelRGBA(SDL_Surface * dst, Sint16 x, Sint16 y, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
+{
+    Uint32 color;
+
+    /*
+     * Check Alpha 
+     */
+    if (a == 255) {
+	/*
+	 * No alpha blending required 
+	 */
+	/*
+	 * Setup color 
+	 */
+	color = SDL_MapRGBA(dst->format, r, g, b, a);
+	/*
+	 * Draw 
+	 */
+	return (fastPixelColor(dst, x, y, color));
+    } else {
+	/*
+	 * Alpha blending required 
+	 */
+	/*
+	 * Draw 
+	 */
+	return (pixelColor(dst, x, y, ((Uint32) r << 24) | ((Uint32) g << 16) | ((Uint32) b << 8) | (Uint32) a));
+    }
+}
+
+/* ----- Horizontal line */
+
+/* Just store color including alpha, no blending */
+
+int hlineColorStore(SDL_Surface * dst, Sint16 x1, Sint16 x2, Sint16 y, Uint32 color)
+{
+    Sint16 left, right, top, bottom;
+    Uint8 *pixel, *pixellast;
+    int dx;
+    int pixx, pixy;
+    Sint16 w;
+    Sint16 xtmp;
+    int result = -1;
+
+    /*
+     * Check visibility of clipping rectangle
+     */
+    if ((dst->clip_rect.w==0) || (dst->clip_rect.h==0)) {
+     return(0);
+    }
+    
+    /*
+     * Swap x1, x2 if required to ensure x1<=x2
+     */
+    if (x1 > x2) {
+	xtmp = x1;
+	x1 = x2;
+	x2 = xtmp;
+    }
+
+    /*
+     * Get clipping boundary and
+     * check visibility of hline 
+     */
+    left = dst->clip_rect.x;
+    if (x2<left) {
+     return(0);
+    }
+    right = dst->clip_rect.x + dst->clip_rect.w - 1;
+    if (x1>right) {
+     return(0);
+    }
+    top = dst->clip_rect.y;
+    bottom = dst->clip_rect.y + dst->clip_rect.h - 1;
+    if ((y<top) || (y>bottom)) {
+     return (0);
+    }
+
+    /*
+     * Clip x 
+     */
+    if (x1 < left) {
+	x1 = left;
+    }
+    if (x2 > right) {
+	x2 = right;
+    }
+
+    /*
+     * Calculate width 
+     */
+    w = x2 - x1;
+
+    /*
+     * Lock surface 
+     */
+    SDL_LockSurface(dst);
+
+    /*
+     * More variable setup 
+     */
+    dx = w;
+    pixx = dst->format->BytesPerPixel;
+	pixy = dst->pitch;
+	pixel = ((Uint8 *) dst->pixels) + pixx * (int) x1 + pixy * (int) y;
+
+	/*
+	 * Draw 
+	 */
+	switch (dst->format->BytesPerPixel) {
+	case 1:
+	    memset(pixel, color, dx);
+	    break;
+	case 2:
+	    pixellast = pixel + dx + dx;
+	    for (; pixel <= pixellast; pixel += pixx) {
+		*(Uint16 *) pixel = color;
+	    }
+	    break;
+	case 3:
+	    pixellast = pixel + dx + dx + dx;
+	    for (; pixel <= pixellast; pixel += pixx) {
+		if (SDL_BYTEORDER == SDL_BIG_ENDIAN) {
+		    pixel[0] = (color >> 16) & 0xff;
+		    pixel[1] = (color >> 8) & 0xff;
+		    pixel[2] = color & 0xff;
+		} else {
+		    pixel[0] = color & 0xff;
+		    pixel[1] = (color >> 8) & 0xff;
+		    pixel[2] = (color >> 16) & 0xff;
+		}
+	    }
+	    break;
+	default:		/* case 4 */
+	    dx = dx + dx;
+	    pixellast = pixel + dx + dx;
+	    for (; pixel <= pixellast; pixel += pixx) {
+		*(Uint32 *) pixel = color;
+	    }
+	    break;
+	}
+
+	/*
+	 * Unlock surface 
+	 */
+	SDL_UnlockSurface(dst);
+
+	/*
+	 * Set result code 
+	 */
+	result = 0;
+
+    return (result);
+}
+
+int hlineRGBAStore(SDL_Surface * dst, Sint16 x1, Sint16 x2, Sint16 y, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
+{
+    /*
+     * Draw 
+     */
+    return (hlineColorStore(dst, x1, x2, y, ((Uint32) r << 24) | ((Uint32) g << 16) | ((Uint32) b << 8) | (Uint32) a));
+}
+
+int hlineColor(SDL_Surface * dst, Sint16 x1, Sint16 x2, Sint16 y, Uint32 color)
+{
+    Sint16 left, right, top, bottom;
+    Uint8 *pixel, *pixellast;
+    int dx;
+    int pixx, pixy;
+    Sint16 w;
+    Sint16 xtmp;
+    int result = -1;
+    Uint8 *colorptr;
+
+    /*
+     * Check visibility of clipping rectangle
+     */
+    if ((dst->clip_rect.w==0) || (dst->clip_rect.h==0)) {
+     return(0);
+    }
+    
+    /*
+     * Swap x1, x2 if required to ensure x1<=x2
+     */
+    if (x1 > x2) {
+	xtmp = x1;
+	x1 = x2;
+	x2 = xtmp;
+    }
+
+    /*
+     * Get clipping boundary and
+     * check visibility of hline 
+     */
+    left = dst->clip_rect.x;
+    if (x2<left) {
+     return(0);
+    }
+    right = dst->clip_rect.x + dst->clip_rect.w - 1;
+    if (x1>right) {
+     return(0);
+    }
+    top = dst->clip_rect.y;
+    bottom = dst->clip_rect.y + dst->clip_rect.h - 1;
+    if ((y<top) || (y>bottom)) {
+     return (0);
+    }
+
+    /*
+     * Clip x 
+     */
+    if (x1 < left) {
+	x1 = left;
+    }
+    if (x2 > right) {
+	x2 = right;
+    }
+
+    /*