Go to main content

man pages section 3: Library Interfaces and Headers

Exit Print View

Updated: Thursday, June 13, 2019
 
 

SDL_SetColorKey (3)

Name

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

Synopsis

#include "SDL.h"

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

Description

SDL_SetColorKey(3)             SDL API Reference            SDL_SetColorKey(3)



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

SYNOPSIS
       #include "SDL.h"

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

DESCRIPTION
        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 sur-
       face, 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.

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


ATTRIBUTES
       See attributes(7) for descriptions of the following attributes:


       +---------------+------------------+
       |ATTRIBUTE TYPE | ATTRIBUTE VALUE  |
       +---------------+------------------+
       |Availability   | library/sdl      |
       +---------------+------------------+
       |Stability      | Volatile         |
       +---------------+------------------+
SEE ALSO
       SDL_BlitSurface, SDL_DisplayFormat, SDL_MapRGB, SDL_SetAlpha



NOTES
       This    software    was    built    from    source     available     at
       https://github.com/oracle/solaris-userland.    The  original  community
       source       was        downloaded        from         https://www.lib-
       sdl.org/release/SDL-1.2.15.tar.gz

       Further information about this software can be found on the open source
       community website at https://www.libsdl.org/.



SDL                         Tue 11 Sep 2001, 23:01          SDL_SetColorKey(3)