X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=pages%2FSDL-Video.html-inc;h=107b2a937f263cb095ae5be1de06e0b80ac2dfe0;hb=449a007bd9879e7a37f21137c044f2af6f99f87c;hp=2333e0e6c236bd7422dc2a3201a5462a03a80cbe;hpb=1b37d90b4f19cb3a3a743759e5d3040ea4be8b18;p=sdlgit%2FSDL-Site.git diff --git a/pages/SDL-Video.html-inc b/pages/SDL-Video.html-inc index 2333e0e..107b2a9 100644 --- a/pages/SDL-Video.html-inc +++ b/pages/SDL-Video.html-inc @@ -12,13 +12,9 @@
  • list_modes(formats,flags)
  • video_mode_ok(width,height,bpp,flags)
  • set_video_mode(width,height,bpp,flags) - -
  • update_rect(surface,x,y,width,height)
  • update_rects(surface,rects)
  • flip(surface)
  • @@ -122,36 +118,67 @@ It returns 0 if the mode is not supported at all, or the suggested bpp.

    set_video_mode returns a SDL::Surface on succés or it returns undef on error, the error message is retrieved using SDL::get_error.

    -

    List of avalaibles flags

    +

    List of avalaibles flags

    -
    -
    -
    -	SDL_SWSURFACE	Create the video surface in system memory
    -	SDL_HWSURFACE	Create the video surface in video memory
    -	SDL_ASYNCBLIT	Enables the use of asynchronous updates of the display surface. 
    -			This will usually slow down blitting on single CPU machines, but may provide a speed increase on SMP systems.
    -	SDL_ANYFORMAT	Normally, if a video surface of the requested bits-per-pixel (bpp) is not available, SDL will emulate one with a shadow surface.
    -			Passing SDL_ANYFORMAT prevents this and causes SDL to use the video surface, regardless of its pixel depth.
    -	SDL_HWPALETTE	Give SDL exclusive palette access. Without this flag you may not always get the colors you request with SDL::set_colors or SDL::set_palette.
    -	SDL_DOUBLEBUF	Enable hardware double buffering; only valid with SDL_HWSURFACE. Calling SDL::flip will flip the buffers and update the screen. 
    -			All drawing will take place on the surface that is not displayed at the moment. 
    -			If double buffering could not be enabled then SDL_Flip will just perform a SDL::update_rect on the entire screen.
    -	SDL_FULLSCREEN	SDL will attempt to use a fullscreen mode. If a hardware resolution change is not possible (for whatever reason), 
    -			the next higher resolution will be used and the display window centered on a black background.
    -	SDL_OPENGL	Create an OpenGL rendering context. You should have previously set OpenGL video attributes with SDL::gl_setattribute.
    -	SDL_OPENGLBLIT	Create an OpenGL rendering context, like above, but allow normal blitting operations. 
    -			The screen (2D) surface may have an alpha channel, and SDL::update_rects must be used for updating changes to the screen surface. 
    -			NOTE: This option is kept for compatibility only, and will be removed in next versions. Is not recommended for new code.
    -	SDL_RESIZABLE	Create a resizable window. 
    -			When the window is resized by the user a SDL_VIDEORESIZE event is generated and SDL::set_video_mode  can be called again with the new size.
    -	SDL_NOFRAME	If possible, SDL_NOFRAME causes SDL to create a window with no title bar or frame decoration. 
    -			Fullscreen modes automatically have this flag set.
    -
    -
    -
    -
    -
    +
    +
    SDL_SWSURFACE
    +
    +

    Create the video surface in system memory

    +
    +
    SDL_HWSURFACE
    +
    +

    Create the video surface in video memory

    +
    +
    SDL_ASYNCBLIT
    +
    +

    Enables the use of asynchronous updates of the display surface. +This will usually slow down blitting on single CPU machines, but may provide a speed increase on SMP systems.

    +
    +
    SDL_ANYFORMAT
    +
    +

    Normally, if a video surface of the requested bits-per-pixel (bpp) is not available, SDL will emulate one with a shadow surface. +Passing SDL_ANYFORMAT prevents this and causes SDL to use the video surface, regardless of its pixel depth.

    +
    +
    SDL_HWPALETTE
    +
    +

    Give SDL exclusive palette access. Without this flag you may not always get the colors you request with SDL::set_colors or SDL::set_palette.

    +
    +
    SDL_DOUBLEBUF
    +
    +

    Enable hardware double buffering; only valid with SDL_HWSURFACE. Calling SDL::flip will flip the buffers and update the screen. +All drawing will take place on the surface that is not displayed at the moment. +If double buffering could not be enabled then SDL_Flip will just perform a SDL::update_rect on the entire screen.

    +
    +
    SDL_FULLSCREEN
    +
    +

    SDL will attempt to use a fullscreen mode. If a hardware resolution change is not possible (for whatever reason), +the next higher resolution will be used and the display window centered on a black background.

    +
    +
    SDL_OPENGL
    +
    +

    Create an OpenGL rendering context. You should have previously set OpenGL video attributes with SDL::gl_setattribute.

    +
    +
    SDL_OPENGLBLIT
    +
    +

    Create an OpenGL rendering context, like above, but allow normal blitting operations. +The screen (2D) surface may have an alpha channel, and SDL::update_rects must be used for updating changes to the screen surface. +NOTE: This option is kept for compatibility only, and will be removed in next versions. Is not recommended for new code.

    +
    +
    SDL_RESIZABLE
    +
    +

    Create a resizable window. +When the window is resized by the user a SDL_VIDEORESIZE event is generated and SDL::set_video_mode can be called again with the new size.

    + + + + +
    +
    SDL_NOFRAME
    +
    +

    If possible, SDL_NOFRAME causes SDL to create a window with no title bar or frame decoration. +Fullscreen modes automatically have this flag set.

    +
    +

    Note 1: Use SDL_SWSURFACE if you plan on doing per-pixel manipulations, or blit surfaces with alpha channels, and require a high framerate. When you use hardware surfaces (by passing the flag SDL_HWSURFACE as parameter), SDL copies the surfaces from video memory to system memory when you lock them, and back when you unlock them. This can cause a major performance hit. Be aware that you may request a hardware surface, but receive a software surface because the video driver doesn't support hardware surface. Many platforms can only provide a hardware surface when using SDL_FULLSCREEN. The SDL_HWSURFACE flag is best used when the surfaces you'll be blitting can also be stored in video memory.

    Note 2: If you want to control the position on the screen when creating a windowed surface, you may do so by setting the environment variables SDL_VIDEO_CENTERED=center or SDL_VIDEO_WINDOW_POS=x,y. You can also set them via SDL::putenv.

    Note 3: This function should be called in the main thread of your application.

    @@ -284,27 +311,37 @@ This function uses the entire 8-bit [0..255] range when converting color compone

    Creates an empty SDL::Surface from pixel data Allocate an empty surface (must be called after SDL::set_video_mode) If bitsPerPixel is 8 an empty palette is allocated for the surface, otherwise a 'packed-pixel' SDL::pixel_format is created using the [RGBA]mask's provided (see SDL::pixel_format). The flags specifies the type of surface that should be created, it is an OR'd combination of the following possible values.

    -
    	SDL_SWSURFACE	SDL will create the surface in system memory. 
    -			This improves the performance of pixel level access, however you may not be able to take advantage of some types of hardware blitting.
    -
    -	SDL_HWSURFACE	SDL will attempt to create the surface in video memory. 
    -			This will allow SDL to take advantage of Video->Video blits (which are often accelerated).
    -
    -	SDL_SRCCOLORKEY	This flag turns on color keying for blits from this surface. 
    -			If SDL_HWSURFACE is also specified and color keyed blits are hardware-accelerated, then SDL will attempt to place the surface in video memory.
    -			If the screen is a hardware surface and color keyed blits are hardware-accelerated then the SDL_HWSURFACE flag will be set. 
    -			Use SDL_SetColorKey to set or clear this flag after surface creation.
    -
    -	SDL_SRCALPHA	This flag turns on alpha-blending for blits from this surface. 
    -			If SDL_HWSURFACE is also specified and alpha-blending blits are hardware-accelerated, 
    -			then the surface will be placed in video memory if possible. 
    -			If the screen is a hardware surface and alpha-blending blits are hardware-accelerated then the SDL_HWSURFACE flag will be set. 
    -			Use SDL_SetAlpha to set or clear this flag after surface creation.
    +
    +
    SDL_SWSURFACE
    +
    +

    SDL will create the surface in system memory. +This improves the performance of pixel level access, however you may not be able to take advantage of some types of hardware blitting.

    +
    +
    SDL_HWSURFACE
    +
    +

    SDL will attempt to create the surface in video memory. +This will allow SDL to take advantage of Video->Video blits (which are often accelerated).

    +
    +
    SDL_SRCCOLORKEY
    +
    +

    This flag turns on color keying for blits from this surface. +If SDL_HWSURFACE is also specified and color keyed blits are hardware-accelerated, then SDL will attempt to place the surface in video memory. +If the screen is a hardware surface and color keyed blits are hardware-accelerated then the SDL_HWSURFACE flag will be set. +Use SDL_SetColorKey to set or clear this flag after surface creation.

    +
    +
    SDL_SRCALPHA
    +
    +

    This flag turns on alpha-blending for blits from this surface. +If SDL_HWSURFACE is also specified and alpha-blending blits are hardware-accelerated, +then the surface will be placed in video memory if possible. +If the screen is a hardware surface and alpha-blending blits are hardware-accelerated then the SDL_HWSURFACE flag will be set. +Use SDL_SetAlpha to set or clear this flag after surface creation.

    +
    +
    -

    [RGBA]mask are the bitmasks used to extract that colour from a pixel. For instance, Rmask being FF000000 means the red data is stored in the most significant byte. Using zeros for the RGB masks sets a default value, based on the depth. (e.g. SDL::create_RGB_surface(flags,w,h,32,0,0,0,0);). @@ -401,35 +438,49 @@ If SDL_SRCALPHA is not passed as a flag then all alpha information is ignored wh The alpha parameter is the per-surface alpha value; a surface need not have an alpha channel to use per-surface alpha and blitting can still be accelerated with SDL_RLEACCEL.

    Note: The per-surface alpha value of 128 is considered a special case and is optimised, so it's much faster than other per-surface values.

    Alpha affects surface blitting in the following ways:

    -
    	RGBA->RGB with SDL_SRCALPHA	The source is alpha-blended with the destination, using the alpha channel. 
    -					SDL_SRCCOLORKEY and the per-surface alpha are ignored.
    -
    -	RGBA->RGB without SDL_SRCALPHA	The RGB data is copied from the source. The source alpha channel and the per-surface alpha value are ignored. 
    -					If SDL_SRCCOLORKEY is set, only the pixels not matching the colorkey value are copied.
    -
    -	RGB->RGBA with SDL_SRCALPHA	The source is alpha-blended with the destination using the per-surface alpha value. 
    -					If SDL_SRCCOLORKEY is set, only the pixels not matching the colorkey value are copied. 
    -					The alpha channel of the copied pixels is set to opaque.
    -
    -	RGB->RGBA without SDL_SRCALPHA	The RGB data is copied from the source and the alpha value of the copied pixels is set to opaque. 
    -					If SDL_SRCCOLORKEY is set, only the pixels not matching the colorkey value are copied.
    -
    -	RGBA->RGBA with SDL_SRCALPHA	The source is alpha-blended with the destination using the source alpha channel. 
    -					The alpha channel in the destination surface is left untouched. SDL_SRCCOLORKEY is ignored.
    -
    -	RGBA->RGBA without SDL_SRCALPHA	The RGBA data is copied to the destination surface.
    -					 If SDL_SRCCOLORKEY is set, only the pixels not matching the colorkey value are copied.
    -
    -	RGB->RGB with SDL_SRCALPHA	The source is alpha-blended with the destination using the per-surface alpha value. 
    -					If SDL_SRCCOLORKEY is set, only the pixels not matching the colorkey value are copied.
    -
    -	RGB->RGB without SDL_SRCALPHA	The RGB data is copied from the source. 
    -					If SDL_SRCCOLORKEY is set, only the pixels not matching the colorkey value are copied.
    -
    -
    -
    -
    -
    +
    +
    RGBA->RGB with SDL_SRCALPHA
    +
    +

    The source is alpha-blended with the destination, using the alpha channel. +SDL_SRCCOLORKEY and the per-surface alpha are ignored.

    +
    +
    RGBA->RGB without SDL_SRCALPHA
    +
    +

    The RGB data is copied from the source. The source alpha channel and the per-surface alpha value are ignored. +If SDL_SRCCOLORKEY is set, only the pixels not matching the colorkey value are copied.

    +
    +
    RGB->RGBA with SDL_SRCALPHA
    +
    +

    The source is alpha-blended with the destination using the per-surface alpha value. +If SDL_SRCCOLORKEY is set, only the pixels not matching the colorkey value are copied. +The alpha channel of the copied pixels is set to opaque.

    +
    +
    RGB->RGBA without SDL_SRCALPHA
    +
    +

    The RGB data is copied from the source and the alpha value of the copied pixels is set to opaque. +If SDL_SRCCOLORKEY is set, only the pixels not matching the colorkey value are copied.

    +
    +
    RGBA->RGBA with SDL_SRCALPHA
    +
    +

    The source is alpha-blended with the destination using the source alpha channel. +The alpha channel in the destination surface is left untouched. SDL_SRCCOLORKEY is ignored.

    +
    +
    RGBA->RGBA without SDL_SRCALPHA
    +
    +

    The RGBA data is copied to the destination surface. +If SDL_SRCCOLORKEY is set, only the pixels not matching the colorkey value are copied.

    +
    +
    RGB->RGB with SDL_SRCALPHA
    +
    +

    The source is alpha-blended with the destination using the per-surface alpha value. +If SDL_SRCCOLORKEY is set, only the pixels not matching the colorkey value are copied.

    +
    +
    RGB->RGB without SDL_SRCALPHA
    +
    +

    The RGB data is copied from the source. +If SDL_SRCCOLORKEY is set, only the pixels not matching the colorkey value are copied.

    +
    +

    Note: When blitting, the presence or absence of SDL_SRCALPHA is relevant only on the source surface, not the destination. Note: Note that RGBA->RGBA blits (with SDL_SRCALPHA set) keep the alpha of the destination surface. This means that you cannot compose two arbitrary RGBA surfaces this way and get the result you would expect from "overlaying" them; the destination alpha will work as a mask.

    Note: Also note that per-pixel and per-surface alpha cannot be combined; the per-pixel alpha is always used if available.

    @@ -527,10 +578,8 @@ It returns 0 on succés or -1 on error.

    unlock_YUV_overlay(overlay)

    -

    The opposite to SDL::lock_YUV_overlay. Unlocks a previously locked overlay. An overlay must be unlocked before it can be displayed. -It returns 0 on succés or -1 on error. - -

    +

    The opposite to SDL::lock_YUV_overlay. Unlocks a previously locked overlay. An overlay must be unlocked before it can be displayed. +It returns 0 on succés or -1 on error.

    display_YUV_overlay(overlay,dstrect)