Method SDL.Surface()->set_image()
- Method set_image
SDL.Surface
set_image(Image.Image
image
,int
|void
flags
)
SDL.Surface
set_image(Image.Image
image
,Image.Image
alpha
,int
|void
flags
)- Description
This (re)initializes this surface from the Image.Image in
image
.Any previously allocated data will be freed.
If initialization is successful, this surface will use RGBA8888 format. For good blitting performance, it should be converted to the display format using display_format().
- Parameter
image
The source image.
- Parameter
alpha
Optional alpha channel. In Pike, the alpha channel can have different alpha values for red, green and blue. Since SDL doesn't support this, only the alpha value of the red color is used in the conversion. When this calling convention is used, the surface alpha value of image is ignored.
- Parameter
flags
When present this 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. Note that if this surface has an alpha value specified, this flag is enabled automatically. Use set_alpha() to modify this flag at a later point.
- Note
If this method fails, the surface will become uninitialized.
- Returns
A reference to itself.
- See also