Commits

Anonymous committed 2c5caf0

add set_gamma_ramp

Comments (0)

Files changed (6)

 # BREAK = change breaks existing code
 # BUG	= fixed a bug that was (or could have been) crashing
 
-may 16, 2002
+May 17, 2002
+	added display.set_gamma_ramp(). thx andrew
+
+May 16, 2002
 	custom blitters to handle destination pixel alphas
 	fix recursive subsurfaces and subsurface blit returns
 
 <a href=ref/pygame_cursors.html#compile>pygame.cursors.compile</a> - compile cursor strings into cursor data<br>
 <a href=ref/pygame_cursors.html#load_xbm>pygame.cursors.load_xbm</a> - reads a pair of XBM files into set_cursor arguments<br>
 <a href=ref/pygame_display.html#Info>pygame.display.Info</a> - get display capabilities and settings<br>
+<a href=ref/pygame_display.html#Info>pygame.display.Info</a> - get display capabilities and settings<br>
+<a href=ref/pygame_display.html#flip>pygame.display.flip</a> - update the display<br>
 <a href=ref/pygame_display.html#flip>pygame.display.flip</a> - update the display<br>
 <a href=ref/pygame_display.html#get_active>pygame.display.get_active</a> - get state of display mode<br>
+<a href=ref/pygame_display.html#get_active>pygame.display.get_active</a> - get state of display mode<br>
+<a href=ref/pygame_display.html#get_caption>pygame.display.get_caption</a> - get the current title of the window<br>
 <a href=ref/pygame_display.html#get_caption>pygame.display.get_caption</a> - get the current title of the window<br>
 <a href=ref/pygame_display.html#get_driver>pygame.display.get_driver</a> - get the current sdl video driver<br>
+<a href=ref/pygame_display.html#get_driver>pygame.display.get_driver</a> - get the current sdl video driver<br>
+<a href=ref/pygame_display.html#get_init>pygame.display.get_init</a> - get status of display module initialization<br>
 <a href=ref/pygame_display.html#get_init>pygame.display.get_init</a> - get status of display module initialization<br>
 <a href=ref/pygame_display.html#get_surface>pygame.display.get_surface</a> - get current display surface<br>
+<a href=ref/pygame_display.html#get_surface>pygame.display.get_surface</a> - get current display surface<br>
+<a href=ref/pygame_display.html#gl_get_attribute>pygame.display.gl_get_attribute</a> - get special OPENGL attributes<br>
 <a href=ref/pygame_display.html#gl_get_attribute>pygame.display.gl_get_attribute</a> - get special OPENGL attributes<br>
 <a href=ref/pygame_display.html#gl_set_attribute>pygame.display.gl_set_attribute</a> - set special OPENGL attributes<br>
+<a href=ref/pygame_display.html#gl_set_attribute>pygame.display.gl_set_attribute</a> - set special OPENGL attributes<br>
+<a href=ref/pygame_display.html#iconify>pygame.display.iconify</a> - minimize the display window<br>
 <a href=ref/pygame_display.html#iconify>pygame.display.iconify</a> - minimize the display window<br>
 <a href=ref/pygame_display.html#init>pygame.display.init</a> - initialize the display module<br>
+<a href=ref/pygame_display.html#init>pygame.display.init</a> - initialize the display module<br>
+<a href=ref/pygame_display.html#list_modes>pygame.display.list_modes</a> - query all resolutions for requested mode<br>
 <a href=ref/pygame_display.html#list_modes>pygame.display.list_modes</a> - query all resolutions for requested mode<br>
 <a href=ref/pygame_display.html#mode_ok>pygame.display.mode_ok</a> - query a specific display mode<br>
+<a href=ref/pygame_display.html#mode_ok>pygame.display.mode_ok</a> - query a specific display mode<br>
+<a href=ref/pygame_display.html#quit>pygame.display.quit</a> - uninitialize the display module<br>
 <a href=ref/pygame_display.html#quit>pygame.display.quit</a> - uninitialize the display module<br>
 <a href=ref/pygame_display.html#set_caption>pygame.display.set_caption</a> - changes the title of the window<br>
+<a href=ref/pygame_display.html#set_caption>pygame.display.set_caption</a> - changes the title of the window<br>
 <a href=ref/pygame_display.html#set_gamma>pygame.display.set_gamma</a> - change the brightness of the display<br>
+<a href=ref/pygame_display.html#set_gamma>pygame.display.set_gamma</a> - change the brightness of the display<br>
+<a href=ref/pygame_display.html#set_gamma_ramp>pygame.display.set_gamma_ramp</a> - advanced control over the display gamma ramps<br>
+<a href=ref/pygame_display.html#set_gamma_ramp>pygame.display.set_gamma_ramp</a> - advanced control over the display gamma ramps<br>
+<a href=ref/pygame_display.html#set_icon>pygame.display.set_icon</a> - changes the window manager icon for the window<br>
 <a href=ref/pygame_display.html#set_icon>pygame.display.set_icon</a> - changes the window manager icon for the window<br>
 <a href=ref/pygame_display.html#set_mode>pygame.display.set_mode</a> - set the display mode<br>
+<a href=ref/pygame_display.html#set_mode>pygame.display.set_mode</a> - set the display mode<br>
+<a href=ref/pygame_display.html#set_palette>pygame.display.set_palette</a> - set the palette<br>
 <a href=ref/pygame_display.html#set_palette>pygame.display.set_palette</a> - set the palette<br>
 <a href=ref/pygame_display.html#toggle_fullscreen>pygame.display.toggle_fullscreen</a> - switch the display fullscreen mode<br>
+<a href=ref/pygame_display.html#toggle_fullscreen>pygame.display.toggle_fullscreen</a> - switch the display fullscreen mode<br>
+<a href=ref/pygame_display.html#update>pygame.display.update</a> - update an area of the display<br>
 <a href=ref/pygame_display.html#update>pygame.display.update</a> - update an area of the display<br>
 <a href=ref/pygame_draw.html#circle>pygame.draw.circle</a> - draw a circle on a surface<br>
 <a href=ref/pygame_draw.html#ellipse>pygame.draw.ellipse</a> - draw an ellipse on a surface<br>

docs/ref/pygame_display.html

 <br>&nbsp;<br>
 After you have initialized your video mode, you can take the
 surface that was returned and write to it like any other Surface
-object. Be sure to call <a href=#update>update()</a> or <a href=#flip>flip()</a> to keep what is on the
+object. Be sure to call <a href=#update>update()</a> or <a href=pygame_transform.html#flip>flip()</a> to keep what is on the
 screen synchronized with what is on the surface. Be sure not to call
 display routines that modify the display surface while it is locked.
 
 get display capabilities and settings</td></tr>
 
 
+<tr><td><a href=#Info>Info</a></td><td> -
+get display capabilities and settings</td></tr>
+
+
+<tr><td><a href=#flip>flip</a></td><td> -
+update the display</td></tr>
+
+
 <tr><td><a href=#flip>flip</a></td><td> -
 update the display</td></tr>
 
 get state of display mode</td></tr>
 
 
+<tr><td><a href=#get_active>get_active</a></td><td> -
+get state of display mode</td></tr>
+
+
+<tr><td><a href=#get_caption>get_caption</a></td><td> -
+get the current title of the window</td></tr>
+
+
 <tr><td><a href=#get_caption>get_caption</a></td><td> -
 get the current title of the window</td></tr>
 
 get the current sdl video driver</td></tr>
 
 
+<tr><td><a href=#get_driver>get_driver</a></td><td> -
+get the current sdl video driver</td></tr>
+
+
+<tr><td><a href=#get_init>get_init</a></td><td> -
+get status of display module initialization</td></tr>
+
+
 <tr><td><a href=#get_init>get_init</a></td><td> -
 get status of display module initialization</td></tr>
 
 get current display surface</td></tr>
 
 
+<tr><td><a href=#get_surface>get_surface</a></td><td> -
+get current display surface</td></tr>
+
+
+<tr><td><a href=#gl_get_attribute>gl_get_attribute</a></td><td> -
+get special OPENGL attributes</td></tr>
+
+
 <tr><td><a href=#gl_get_attribute>gl_get_attribute</a></td><td> -
 get special OPENGL attributes</td></tr>
 
 set special OPENGL attributes</td></tr>
 
 
+<tr><td><a href=#gl_set_attribute>gl_set_attribute</a></td><td> -
+set special OPENGL attributes</td></tr>
+
+
+<tr><td><a href=#iconify>iconify</a></td><td> -
+minimize the display window</td></tr>
+
+
 <tr><td><a href=#iconify>iconify</a></td><td> -
 minimize the display window</td></tr>
 
 initialize the display module</td></tr>
 
 
+<tr><td><a href=#init>init</a></td><td> -
+initialize the display module</td></tr>
+
+
+<tr><td><a href=#list_modes>list_modes</a></td><td> -
+query all resolutions for requested mode</td></tr>
+
+
 <tr><td><a href=#list_modes>list_modes</a></td><td> -
 query all resolutions for requested mode</td></tr>
 
 query a specific display mode</td></tr>
 
 
+<tr><td><a href=#mode_ok>mode_ok</a></td><td> -
+query a specific display mode</td></tr>
+
+
+<tr><td><a href=#quit>quit</a></td><td> -
+uninitialize the display module</td></tr>
+
+
 <tr><td><a href=#quit>quit</a></td><td> -
 uninitialize the display module</td></tr>
 
 changes the title of the window</td></tr>
 
 
+<tr><td><a href=#set_caption>set_caption</a></td><td> -
+changes the title of the window</td></tr>
+
+
 <tr><td><a href=#set_gamma>set_gamma</a></td><td> -
 change the brightness of the display</td></tr>
 
 
+<tr><td><a href=#set_gamma>set_gamma</a></td><td> -
+change the brightness of the display</td></tr>
+
+
+<tr><td><a href=#set_gamma_ramp>set_gamma_ramp</a></td><td> -
+advanced control over the display gamma ramps</td></tr>
+
+
+<tr><td><a href=#set_gamma_ramp>set_gamma_ramp</a></td><td> -
+advanced control over the display gamma ramps</td></tr>
+
+
 <tr><td><a href=#set_icon>set_icon</a></td><td> -
 changes the window manager icon for the window</td></tr>
 
 
+<tr><td><a href=#set_icon>set_icon</a></td><td> -
+changes the window manager icon for the window</td></tr>
+
+
+<tr><td><a href=#set_mode>set_mode</a></td><td> -
+set the display mode</td></tr>
+
+
 <tr><td><a href=#set_mode>set_mode</a></td><td> -
 set the display mode</td></tr>
 
 set the palette</td></tr>
 
 
+<tr><td><a href=#set_palette>set_palette</a></td><td> -
+set the palette</td></tr>
+
+
 <tr><td><a href=#toggle_fullscreen>toggle_fullscreen</a></td><td> -
 switch the display fullscreen mode</td></tr>
 
 
+<tr><td><a href=#toggle_fullscreen>toggle_fullscreen</a></td><td> -
+switch the display fullscreen mode</td></tr>
+
+
+<tr><td><a href=#update>update</a></td><td> -
+update an area of the display</td></tr>
+
+
 <tr><td><a href=#update>update</a></td><td> -
 update an area of the display</td></tr>
 
 You can print the VidInfo object to see all its members and values.
 </ul><br>&nbsp;<br>
 
+<a name=Info><font size=+2><b>Info
+</b></font><br><font size=+1><tt>
+pygame.display.Info() -> VidInfo
+</tt></font><ul>
+Gets a vidinfo object that contains information about the
+capabilities and current state of the video driver. This can be
+called before the display mode is set, to determine the current
+video mode of a display.
+You can print the VidInfo object to see all its members and values.
+</ul><br>&nbsp;<br>
+
+<a name=flip><font size=+2><b>flip
+</b></font><br><font size=+1><tt>
+pygame.display.flip() -> None
+</tt></font><ul>
+This will update the contents of the entire display. If your
+display mode is using the flags HWSURFACE and DOUBLEBUF, this
+will wait for a vertical retrace and swap the surfaces. If you
+are using a different type of display mode, it will simply update
+the entire contents of the surface.
+<br>&nbsp;<br>
+When using an OPENGL display mode this will perform a gl buffer swap.
+</ul><br>&nbsp;<br>
+
 <a name=flip><font size=+2><b>flip
 </b></font><br><font size=+1><tt>
 pygame.display.flip() -> None
 be lost after this call.
 </ul><br>&nbsp;<br>
 
+<a name=get_active><font size=+2><b>get_active
+</b></font><br><font size=+1><tt>
+pygame.display.get_active() -> bool
+</tt></font><ul>
+Returns true if the current display is active on the screen. This
+done with the call to <a href=#set_mode>pygame.display.set_mode()</a>. It is
+potentially subject to the activity of a running window manager.
+<br>&nbsp;<br>
+Calling <a href=#set_mode>set_mode()</a> will change all existing display surface
+to reference the new display mode. The old display surface will
+be lost after this call.
+</ul><br>&nbsp;<br>
+
 <a name=get_caption><font size=+2><b>get_caption
 </b></font><br><font size=+1><tt>
 pygame.display.get_caption() -> title, icontitle
 Returns the current title and icontitle for the display window.
 </ul><br>&nbsp;<br>
 
+<a name=get_caption><font size=+2><b>get_caption
+</b></font><br><font size=+1><tt>
+pygame.display.get_caption() -> title, icontitle
+</tt></font><ul>
+Returns the current title and icontitle for the display window.
+</ul><br>&nbsp;<br>
+
+<a name=get_driver><font size=+2><b>get_driver
+</b></font><br><font size=+1><tt>
+pygame.display.get_driver() -> name
+</tt></font><ul>
+Once the display is initialized, this will return the name of the
+currently running video driver. There is no way to get a list of
+all the supported video drivers.
+</ul><br>&nbsp;<br>
+
 <a name=get_driver><font size=+2><b>get_driver
 </b></font><br><font size=+1><tt>
 pygame.display.get_driver() -> name
 Returns true if SDL's video system is currently intialized.
 </ul><br>&nbsp;<br>
 
+<a name=get_init><font size=+2><b>get_init
+</b></font><br><font size=+1><tt>
+pygame.display.get_init() -> bool
+</tt></font><ul>
+Returns true if SDL's video system is currently intialized.
+</ul><br>&nbsp;<br>
+
 <a name=get_surface><font size=+2><b>get_surface
 </b></font><br><font size=+1><tt>
 pygame.display.get_surface() -> Surface
 return None if called before the display mode is set.
 </ul><br>&nbsp;<br>
 
+<a name=get_surface><font size=+2><b>get_surface
+</b></font><br><font size=+1><tt>
+pygame.display.get_surface() -> Surface
+</tt></font><ul>
+Returns a Surface object representing the current display. Will
+return None if called before the display mode is set.
+</ul><br>&nbsp;<br>
+
+<a name=gl_get_attribute><font size=+2><b>gl_get_attribute
+</b></font><br><font size=+1><tt>
+pygame.display.gl_get_attribute(flag) -> value
+</tt></font><ul>
+After calling <a href=#set_mode>pygame.display.set_mode()</a> with the OPENGL flag
+you will likely want to check the value of any special opengl
+attributes you requested. You will not always get what you
+requested.
+<br>&nbsp;<br>
+See <a href=#gl_set_attribute>pygame.display.gl_set_attribute()</a> for a list of flags.
+<br>&nbsp;<br>
+The OPENGL flags are; GL_ALPHA_SIZE, GL_DEPTH_SIZE, GL_STENCIL_SIZE,
+GL_ACCUM_RED_SIZE, GL_ACCUM_GREEN_SIZE, GL_ACCUM_BLUE_SIZE, GL_ACCUM_ALPHA_SIZE,
+GL_RED_SIZE, GL_GREEN_SIZE, GL_BLUE_SIZE, GL_DEPTH_SIZE
+</ul><br>&nbsp;<br>
+
 <a name=gl_get_attribute><font size=+2><b>gl_get_attribute
 </b></font><br><font size=+1><tt>
 pygame.display.gl_get_attribute(flag) -> value
 GL_ACCUM_RED_SIZE, GL_ACCUM_GREEN_SIZE, GL_ACCUM_BLUE_SIZE, GL_ACCUM_ALPHA_SIZE
 </ul><br>&nbsp;<br>
 
+<a name=gl_set_attribute><font size=+2><b>gl_set_attribute
+</b></font><br><font size=+1><tt>
+pygame.display.gl_set_attribute(flag, value) -> None
+</tt></font><ul>
+When calling <a href=#set_mode>pygame.display.set_mode()</a> with the OPENGL flag,
+pygame automatically handles setting the opengl attributes like
+color and doublebuffering. OPENGL offers several other attributes
+you may want control over. Pass one of these attributes as the
+flag, and its appropriate value.
+<br>&nbsp;<br>
+This must be called before <a href=#set_mode>pygame.display.set_mode()</a>
+<br>&nbsp;<br>
+The OPENGL flags are; GL_ALPHA_SIZE, GL_DEPTH_SIZE, GL_STENCIL_SIZE,
+GL_ACCUM_RED_SIZE, GL_ACCUM_GREEN_SIZE, GL_ACCUM_BLUE_SIZE, GL_ACCUM_ALPHA_SIZE
+</ul><br>&nbsp;<br>
+
+<a name=iconify><font size=+2><b>iconify
+</b></font><br><font size=+1><tt>
+pygame.display.iconify() -> bool
+</tt></font><ul>
+Tells the window manager (if available) to minimize the
+application. The call will return true if successful. You will
+receive an APPACTIVE event on the event queue when the window has
+been minimized.
+</ul><br>&nbsp;<br>
+
 <a name=iconify><font size=+2><b>iconify
 </b></font><br><font size=+1><tt>
 pygame.display.iconify() -> bool
 function if the video has is currently initialized.
 </ul><br>&nbsp;<br>
 
+<a name=init><font size=+2><b>init
+</b></font><br><font size=+1><tt>
+pygame.display.init() -> None
+</tt></font><ul>
+Manually initialize SDL's video subsystem. Will raise an
+exception if it cannot be initialized. It is safe to call this
+function if the video has is currently initialized.
+</ul><br>&nbsp;<br>
+
+<a name=list_modes><font size=+2><b>list_modes
+</b></font><br><font size=+1><tt>
+pygame.display.list_modes([depth, [flags]]) -> [[x,y],...] | -1
+</tt></font><ul>
+This function returns a list of possible dimensions for a
+specified color depth. The return value will be an empty list of
+no display modes are available with the given arguments. A return
+value of -1 means that any requested resolution should work (this
+is likely the case for windowed modes). Mode sizes are sorted
+from biggest to smallest.
+<br>&nbsp;<br>
+If depth is not passed or 0, SDL will choose the current/best
+color depth for the display. You will usually want to pass
+FULLSCREEN when using the flags, if flags is omitted, FULLSCREEN
+is the default.
+</ul><br>&nbsp;<br>
+
 <a name=list_modes><font size=+2><b>list_modes
 </b></font><br><font size=+1><tt>
 pygame.display.list_modes([depth, [flags]]) -> [[x,y],...] | -1
 display will use the best/fastest pixel depth available.
 </ul><br>&nbsp;<br>
 
+<a name=mode_ok><font size=+2><b>mode_ok
+</b></font><br><font size=+1><tt>
+pygame.display.mode_ok(size, [flags, [depth]]) -> int
+</tt></font><ul>
+This uses the same arguments as the call to
+<a href=#set_mode>pygame.display.set_mode()</a>. It is used to determine if a requested
+display mode is available. It will return 0 if the requested mode
+is not possible. Otherwise it will return the best and closest
+matching bit depth for the mode requested.
+<br>&nbsp;<br>
+The size is a 2-number-sequence containing the width and height
+of the desired display mode. Flags represents a set of different
+options for the display mode. If omitted or given as 0, it will
+default to a simple software window. You can mix several flags
+together with the bitwise-or (|) operator. Possible flags are
+HWSURFACE (or the value 1), HWPALETTE, DOUBLEBUF, and/or
+FULLSCREEN. There are other flags available but these are the
+most usual. A full list of flags can be found in the SDL
+documentation. The optional depth arguement is the requested bits
+per pixel. It will usually be left omitted, in which case the
+display will use the best/fastest pixel depth available.
+</ul><br>&nbsp;<br>
+
 <a name=quit><font size=+2><b>quit
 </b></font><br><font size=+1><tt>
 pygame.display.quit() -> None
 this if the video is currently not initialized.
 </ul><br>&nbsp;<br>
 
+<a name=quit><font size=+2><b>quit
+</b></font><br><font size=+1><tt>
+pygame.display.quit() -> None
+</tt></font><ul>
+Manually uninitialize SDL's video subsystem. It is safe to call
+this if the video is currently not initialized.
+</ul><br>&nbsp;<br>
+
+<a name=set_caption><font size=+2><b>set_caption
+</b></font><br><font size=+1><tt>
+pygame.display.set_caption(title, [icontitle]) -> None
+</tt></font><ul>
+If the display has a window title, this routine will change the
+name on the window. Some environments support a shorter icon
+title to be used when the display is minimized. If icontitle is
+omittied it will be the same as caption title.
+</ul><br>&nbsp;<br>
+
 <a name=set_caption><font size=+2><b>set_caption
 </b></font><br><font size=+1><tt>
 pygame.display.set_caption(title, [icontitle]) -> None
 success.
 </ul><br>&nbsp;<br>
 
+<a name=set_gamma><font size=+2><b>set_gamma
+</b></font><br><font size=+1><tt>
+pygame.display.set_gamma(r, [g, b]) -> bool
+</tt></font><ul>
+Sets the display gamma to the given amounts. If green and blue
+are ommitted, the red value will be used for all three colors.
+The color arguments are floating point values with 1.0 being the
+normal value. If you are using a display mode with a hardware
+palette, this will simply update the palette you are using. Not
+all hardware supports gamma. The return value will be true on
+success.
+</ul><br>&nbsp;<br>
+
+<a name=set_gamma_ramp><font size=+2><b>set_gamma_ramp
+</b></font><br><font size=+1><tt>
+pygame.display.set_gamma_ramp(r, g, b) -> bool
+</tt></font><ul>
+Pass three sequences with 256 elements. Each element must be a
+'16bit' unsigned integer value. This is from 0 to 65536.
+If you are using a display mode with a hardware
+palette, this will simply update the palette you are using.
+Not all hardware supports gamma. The return value will be
+true on success.
+</ul><br>&nbsp;<br>
+
+<a name=set_gamma_ramp><font size=+2><b>set_gamma_ramp
+</b></font><br><font size=+1><tt>
+pygame.display.set_gamma_ramp(r, g, b) -> bool
+</tt></font><ul>
+Pass three sequences with 256 elements. Each element must be a
+'16bit' unsigned integer value. This is from 0 to 65536.
+If you are using a display mode with a hardware
+palette, this will simply update the palette you are using.
+Not all hardware supports gamma. The return value will be
+true on success.
+</ul><br>&nbsp;<br>
+
+<a name=set_icon><font size=+2><b>set_icon
+</b></font><br><font size=+1><tt>
+pygame.display.set_icon(Surface) -> None
+</tt></font><ul>
+Sets the runtime icon that your system uses to decorate
+the program window. It is also used when the application
+is iconified and in the window frame.
+<br>&nbsp;<br>
+You likely want this to be a smaller image, a size that
+your system window manager will be able to deal with. It will
+also use the Surface colorkey if available.
+</ul><br>&nbsp;<br>
+
 <a name=set_icon><font size=+2><b>set_icon
 </b></font><br><font size=+1><tt>
 pygame.display.set_icon(Surface) -> None
 <br>&nbsp;<br>
 You can also create an OpenGL surface (for use with PyOpenGL)
 by passing the OPENGL flag. You will likely want to use the
-DOUBLEBUF flag when using OPENGL. In which case, the <a href=#flip>flip()</a>
+DOUBLEBUF flag when using OPENGL. In which case, the <a href=pygame_transform.html#flip>flip()</a>
 function will perform the GL buffer swaps. When you are using
 an OPENGL video mode, you will not be able to perform most of the
 pygame drawing functions (fill, set_at, etc) on the display surface.
 </ul><br>&nbsp;<br>
 
+<a name=set_mode><font size=+2><b>set_mode
+</b></font><br><font size=+1><tt>
+pygame.display.set_mode(size, [flags, [depth]]) -> Surface
+</tt></font><ul>
+Sets the current display mode. If calling this after the mode has
+already been set, this will change the display mode to the
+desired type. Sometimes an exact match for the requested video
+mode is not available. In this case SDL will try to find the
+closest match and work with that instead.
+<br>&nbsp;<br>
+The size is a 2-number-sequence containing the width and height
+of the desired display mode. Flags represents a set of different
+options for the new display mode. If omitted or given as 0, it
+will default to a simple software window. You can mix several
+flags together with the bitwise-or (|) operator. Possible flags
+are HWSURFACE (or the value 1), HWPALETTE, DOUBLEBUF, and/or
+FULLSCREEN. There are other flags available but these are the
+most usual. A full list of flags can be found in the SDL
+documentation. The optional depth arguement is the requested bits
+per pixel. It will usually be left omitted, in which case the
+display will use the best/fastest pixel depth available.
+<br>&nbsp;<br>
+You can also create an OpenGL surface (for use with PyOpenGL)
+by passing the OPENGL flag. You will likely want to use the
+DOUBLEBUF flag when using OPENGL. In which case, the <a href=pygame_transform.html#flip>flip()</a>
+function will perform the GL buffer swaps. When you are using
+an OPENGL video mode, you will not be able to perform most of the
+pygame drawing functions (fill, set_at, etc) on the display surface.
+</ul><br>&nbsp;<br>
+
+<a name=set_palette><font size=+2><b>set_palette
+</b></font><br><font size=+1><tt>
+pygame.display.set_palette([[r, g, b], ...]) -> None
+</tt></font><ul>
+Displays with a HWPALETTE have two palettes. The display Surface
+palette and the visible 'onscreen' palette.
+<br>&nbsp;<br>
+This will change the video display's visible colormap. It does
+not effect the display Surface's base palette, only how it is
+displayed. Setting the palette for the display Surface will
+override this visible palette. Also passing no args will reset
+the display palette back to the Surface's palette.
+<br>&nbsp;<br>
+You can pass an incomplete list of RGB values, and
+this will only change the first colors in the palette.
+</ul><br>&nbsp;<br>
+
 <a name=set_palette><font size=+2><b>set_palette
 </b></font><br><font size=+1><tt>
 pygame.display.set_palette([[r, g, b], ...]) -> None
 for this call.
 </ul><br>&nbsp;<br>
 
+<a name=toggle_fullscreen><font size=+2><b>toggle_fullscreen
+</b></font><br><font size=+1><tt>
+pygame.display.toggle_fullscreen() -> bool
+</tt></font><ul>
+Tells the window manager (if available) to switch between
+windowed and fullscreen mode. If available and successfull, will
+return true. Note, there is currently limited platform support
+for this call.
+</ul><br>&nbsp;<br>
+
 <a name=update><font size=+2><b>update
 </b></font><br><font size=+1><tt>
 pygame.display.update([rectstyle]) -> None
 an exception.
 </ul><br>&nbsp;<br>
 
+<a name=update><font size=+2><b>update
+</b></font><br><font size=+1><tt>
+pygame.display.update([rectstyle]) -> None
+</tt></font><ul>
+This call will update a section (or sections) of the display
+screen. You must update an area of your display when you change
+its contents. If passed with no arguments, this will update the
+entire display surface. If you have many rects that need
+updating, it is best to combine them into a sequence and pass
+them all at once. This call will accept a sequence of rectstyle
+arguments. Any None's in the list will be ignored.
+<br>&nbsp;<br>
+This call cannot be used on OPENGL displays, and will generate
+an exception.
+</ul><br>&nbsp;<br>
+
 
 <hr>
 </body></html>
 <li>TheCorruptor for his incredible logos and graphics</li>
 <li>Thanks to those sending in patches and fixes:
     Niki Spahiev, Gordon Tyler, Nathaniel Pryce, 
-    Dave Wallace, John Popplewell, Michael Urman</li>
+    Dave Wallace, John Popplewell, Michael Urman,
+    Andrew Straw</li>
 <li>And our bug hunters above and beyond:
     Angus, Guillaume Proux, Frank Raiser,
     Austin Henry, Kaweh Kazemi, Arturo Aldama,
      TheCorruptor for his incredible logos and graphics
 
      Thanks to those sending in patches and fixes: Niki Spahiev, Gordon
-   Tyler, Nathaniel Pryce, Dave Wallace, John Popplewell, Michael Urman
+   Tyler, Nathaniel Pryce, Dave Wallace, John Popplewell, Michael Urman,
+   Andrew Straw
 
      And our bug hunters above and beyond: Angus, Guillaume Proux, Frank
    Raiser, Austin Henry, Kaweh Kazemi, Arturo Aldama, Mike Mulcheck, Rene
 #define PYGAMEAPI_DISPLAY_INTERNAL
 #include "pygame.h"
 
-
 static char* icon_defaultname = "pygame_icon.bmp";
 static PyObject* self_module = NULL;
 
 
 static void vidinfo_dealloc(PyObject* self)
 {
-	PyObject_DEL(self);
+	PyObject_DEL(self);	
 }
 
 
 	else if(!strcmp(name, "losses"))
 		return Py_BuildValue("(iiii)", info->vfmt->Rloss, info->vfmt->Gloss,
 					info->vfmt->Bloss, info->vfmt->Aloss);
-
+	
 	return RAISE(PyExc_AttributeError, "does not exist in vidinfo");
 }
 
 	PyVidInfoObject* info;
 
 	if(!i) return RAISE(PyExc_SDLError, SDL_GetError());
-
+	
 	info = PyObject_NEW(PyVidInfoObject, &PyVidInfo_Type);
 	if(!info) return NULL;
 
 static PyObject* get_driver(PyObject* self, PyObject* args)
 {
 	char buf[256];
-
+	
 	if(!PyArg_ParseTuple(args, ""))
 		return NULL;
 
 static PyObject* gl_set_attribute(PyObject* self, PyObject* arg)
 {
         int flag, value, result;
-
+    
 	VIDEO_INIT_CHECK();
 
     	if(!PyArg_ParseTuple(arg, "ii", &flag, &value))
 	result = SDL_GL_SetAttribute(flag, value);
         if(result == -1)
             return RAISE(PyExc_SDLError, SDL_GetError());
-
+        
         RETURN_NONE
 }
 
 static PyObject* gl_get_attribute(PyObject* self, PyObject* arg)
 {
         int flag, value, result;
-
+    
 	VIDEO_INIT_CHECK();
 
 	if(!PyArg_ParseTuple(arg, "i", &flag))
 	result = SDL_GL_GetAttribute(flag, &value);
         if(result == -1)
             return RAISE(PyExc_SDLError, SDL_GetError());
-
+        
         return PyInt_FromLong(value);
 }
 
 
-
+            
     /*DOC*/ static char doc_set_mode[] =
     /*DOC*/    "pygame.display.set_mode(size, [flags, [depth]]) -> Surface\n"
     /*DOC*/    "set the display mode\n"
 		if(!surf)
 			return RAISE(PyExc_SDLError, SDL_GetError());
 	}
-
 	SDL_WM_GetCaption(&title, &icontitle);
 	if(!title || !*title)
 		SDL_WM_SetCaption("pygame window", "pygame");
 	else
 		DisplaySurfaceObject = PySurface_New(surf);
 
+
 #if !defined(darwin)
 	if(!icon_was_set)
 	{
 	SDL_Rect** rects;
 	int flags=SDL_FULLSCREEN;
 	PyObject *list, *size;
-
+	
 	format.BitsPerPixel = 0;
 	if(PyTuple_Size(args)!=0 && !PyArg_ParseTuple(args, "|bi", &format.BitsPerPixel, &flags))
 		return NULL;
 	high = screen->h;
 	if(screen->flags & SDL_OPENGL)
 		return RAISE(PyExc_SDLError, "Cannot update an OPENGL display");
-
+        
 	/*determine type of argument we got*/
 	if(PyTuple_Size(arg) == 0)
         {
                 seq = PyTuple_GET_ITEM(arg, 0);
                 if(!seq || !PySequence_Check(seq))
                         return RAISE(PyExc_ValueError, "update requires a rectstyle or sequence of recstyles");
-
+        
                 num = PySequence_Length(seq);
                 rects = PyMem_New(SDL_Rect, num);
                 if(!rects) return NULL;
                 for(loop = 0; loop < num; ++loop)
                 {
                         GAME_Rect* cur_rect = (GAME_Rect*)(rects + count);
-
+        
                         /*get rect from the sequence*/
                         r = PySequence_GetItem(seq, loop);
                         if(r == Py_None)
                                 PyMem_Free((char*)rects);
                                 return RAISE(PyExc_ValueError, "update_rects requires a single list of rects");
                         }
-
+                        
                         if(gr->w < 1 && gr->h < 1)
                                 continue;
-
+        
                         /*bail out if rect not onscreen*/
                         if(!screencroprect(gr, wide, high, cur_rect))
                                 continue;
-
+        
                         ++count;
                 }
-
+        
                 if(count)
                     SDL_UpdateRects(screen, count, rects);
                 PyMem_Free((char*)rects);
 	PyObject* list, *item = NULL;
 	int i, len;
 	short r, g, b;
-
+	
 	VIDEO_INIT_CHECK();
 	if(!PyArg_ParseTuple(args, "|O", &list))
 		return NULL;
 		SDL_SetPalette(surf, SDL_PHYSPAL, colors, 0, len);
 		RETURN_NONE
 	}
-
-
+	
+	
 	if(!PySequence_Check(list))
 		return RAISE(PyExc_ValueError, "Argument must be a sequence type");
 
 	colors = (SDL_Color*)malloc(len * sizeof(SDL_Color));
 	if(!colors)
 		return NULL;
-
+	
 	for(i = 0; i < len; i++)
 	{
 		item = PySequence_GetItem(list, i);
 		colors[i].r = (unsigned char)r;
 		colors[i].g = (unsigned char)g;
 		colors[i].b = (unsigned char)b;
-
+	
 		Py_DECREF(item);
 	}
 
 	return PyInt_FromLong(result == 0);
 }
 
+static int convert_to_uint16(PyObject* python_array, Uint16* c_uint16_array)
+{
+        int i;
+        PyObject* item;
 
+	if (!c_uint16_array) {
+	        RAISE(PyExc_RuntimeError, "Memory not allocated for c_uint16_array.");
+		return 0;
+	}
+
+	if (!PySequence_Check(python_array))
+        {
+	        RAISE(PyExc_TypeError, "Array must be sequence type");
+	        return 0;
+        }
+
+	if (PySequence_Size(python_array) != 256)
+        {
+		RAISE(PyExc_ValueError, "gamma ramp must be 256 elements long");
+                return 0;
+        }
+	for (i=0; i<256; i++)
+        {
+                item = PySequence_GetItem(python_array, i);
+                if(!PyInt_Check(item))
+                {
+		    RAISE(PyExc_ValueError, "gamma ramp must contain integer elements");
+                    return 0;
+                }
+		c_uint16_array[i] = PyInt_AsLong(item);
+        }
+	return 1;
+}
+
+    /*DOC*/ static char doc_set_gamma_ramp[] =
+    /*DOC*/    "pygame.display.set_gamma_ramp(r, g, b) -> bool\n"
+    /*DOC*/    "advanced control over the display gamma ramps\n"
+    /*DOC*/    "\n"
+    /*DOC*/    "Pass three sequences with 256 elements. Each element must be a\n"
+    /*DOC*/    "'16bit' unsigned integer value. This is from 0 to 65536.\n"
+    /*DOC*/    "If you are using a display mode with a hardware\n"
+    /*DOC*/    "palette, this will simply update the palette you are using.\n"
+    /*DOC*/    "Not all hardware supports gamma. The return value will be\n"
+    /*DOC*/    "true on success.\n";
+
+static PyObject* set_gamma_ramp(PyObject* self, PyObject* arg)
+{
+ 	Uint16 *r, *g, *b;
+
+	int result;
+ 
+	r = (Uint16 *)malloc(256 * sizeof(Uint16));
+	if (!r)
+	        return NULL;
+	g = (Uint16 *)malloc(256 * sizeof(Uint16));
+	if (!g)
+        {
+                free(r);
+	        return NULL;
+        }
+	b = (Uint16 *)malloc(256 * sizeof(Uint16));
+	if (!b)
+        {
+                free(r);
+                free(g);
+	        return NULL;
+        }
+
+	if(!PyArg_ParseTuple(arg, "O&O&O&", 
+			     convert_to_uint16, r,
+			     convert_to_uint16, g,
+			     convert_to_uint16, b))
+        {
+                free(r); free(g); free(b);
+	        return NULL;
+        }
+
+        VIDEO_INIT_CHECK();
+	
+	result = SDL_SetGammaRamp(r, g, b);
+
+	free((char*)r);
+	free((char*)g);
+	free((char*)b);
+
+	return PyInt_FromLong(result == 0);
+}
 
     /*DOC*/ static char doc_set_caption[] =
     /*DOC*/    "pygame.display.set_caption(title, [icontitle]) -> None\n"
 		return NULL;
 
 	SDL_WM_GetCaption(&title, &icontitle);
-
+	
 	if(title && *title)
 		return Py_BuildValue("(ss)", title, icontitle);
 
 
 	{ "set_palette", set_palette, 1, doc_set_palette },
 	{ "set_gamma", set_gamma, 1, doc_set_gamma },
-	/*gammaramp support will be added later, if needed?*/
+	{ "set_gamma_ramp", set_gamma_ramp, 1, doc_set_gamma_ramp },
 
 	{ "set_caption", set_caption, 1, doc_set_caption },
 	{ "get_caption", get_caption, 1, doc_get_caption },