Tao.Sdl SDK Documentation

Sdl.SDL_SetColorKey Method 

Sets the color key (transparent pixel) in a blittable surface and RLE acceleration.

[Visual Basic]
Public Shared Function SDL_SetColorKey( _
   ByVal surface As IntPtr, _
   ByVal flag As Integer, _
   ByVal key As Integer _
) As Integer
[C#]
public static int SDL_SetColorKey(
   IntPtr surface,
   int flag,
   int key
);

Parameters

surface
flag
key

Return Value

This function returns 0, or -1 if there was an error.

Remarks

Sets the color key (transparent pixel) in a blittable surface and enables or disables RLE blit acceleration.

RLE acceleration can substantially speed up blitting of images with large horizontal runs of transparent pixels (i.e., pixels that match the key value). The key must be of the same pixel format as the surface, SDL_MapRGB is often useful for obtaining an acceptable value.

If flag is SDL_SRCCOLORKEY then key is the transparent pixel value in the source image of a blit.

If flag is OR'd with SDL_RLEACCEL then the surface will be draw using RLE acceleration when drawn with SDL_BlitSurface. The surface will actually be encoded for RLE acceleration the first time SDL_BlitSurface or SDL_DisplayFormat is called on the surface.

If flag is 0, this function clears any current color key.

Binds to C-function call in SDL_video.h:

int SDL_SetColorKey(SDL_Surface *surface, Uint32 flag, Uint32 key);
            

See Also

Sdl Class | Tao.Sdl Namespace | SDL_BlitSurface | SDL_DisplayFormat | SDL_MapRGB | SDL_SetAlpha