[Top]
SDL
SDL.Surface
|
Method SDL.Surface()->init()
- Method
init
SDL.Surface init(int flags, int width, int height, int depth, int Rmask, int Gmask, int Bmask, int Amask)
- Description
This (re)initializes this surface using the specified
parameters. Any previously allocated data will be freed.
If depth is 8 bits an empty palette is allocated for the surface,
otherwise a 'packed-pixel' SDL.PixelFormat is created using
the [RGBA]mask's provided. width and height specifies
the desired size of the image. 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 colourkeying for blits from this
surface. If SDL.HWSURFACE is also specified and colourkeyed
blits are hardware-accelerated, then SDL will attempt to
place the surface in video memory. Use set_color_key() 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. Use
set_alpha() to set or clear this flag after surface
creation.
- Note
If an alpha-channel is specified (that is, if Amask is
nonzero), then the SDL.SRCALPHA flag is automatically set. You
may remove this flag by calling set_alpha() after surface
creation.
- Returns
A reference to itself.
- Note
If this method fails, the surface will become uninitialized.
- See also
set_image()
|