#pragma section-numbers off #pragma disable-camelcase = SDL_SetColorKey = Use this function to set the color key (transparent pixel) in a surface. <> == Syntax == {{{#!highlight cpp int SDL_SetColorKey(SDL_Surface* surface, int flag, Uint32 key) }}} == Function Parameters == ||'''surface'''||the [[SDL_Surface]] structure to update|| ||'''flag'''||SDL_TRUE to enable color key, SDL_FALSE to disable color key|| ||'''key'''||the transparent pixel|| == Return Value == Returns 0 on success or a negative error code on failure; call [[SDL_GetError]]() for more information. == Code Examples == {{{#!highlight cpp You can add your code example here }}} == Remarks == The color key defines a pixel value that will be treated as transparent in a blit. It is a pixel of the format used by the surface, as generated by [[SDL_MapRGB]](). RLE acceleration can substantially speed up blitting of images with large horizontal runs of transparent pixels. See [[SDL_SetSurfaceRLE]]() for details. == Related Functions == .[[SDL_BlitSurface]] .[[SDL_GetColorKey]] ---- [[CategoryAPI]], [[CategorySurface]]