Wiki Page Content

Differences between revisions 7 and 8
Revision 7 as of 2011-01-07 18:15:35
Size: 1212
Editor: SheenaSmith
Comment: update content - w/ Sam; remove draft
Revision 8 as of 2011-01-07 18:21:42
Size: 1290
Editor: SheenaSmith
Comment: update content - w/ Sam
Deletions are marked like this. Additions are marked like this.
Line 30: Line 30:
The color key is a pixel of the format used by the surface, as generated by [[SDL_MapRGB]](). 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]]().
Line 32: Line 32:
RLE acceleration can substantially speed up blitting of images with large horizontal runs of transparent pixels (i.e., pixels that match the key value). See [[SDL_SetSurfaceRLE]]() for details.
RLE acceleration can substantially speed up blitting of images with large horizontal runs of transparent pixels. See [[SDL_SetSurfaceRLE]]() for details.

(i.e., pixels that match the key value)

SDL_SetColorKey

Use this function to set the color key (transparent pixel) in a surface.

Syntax

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

Function Parameters

surface

the SDL_Surface structure to update

flag

1 to enable color key, 0 to disable color key; see Remarks for details

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

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.

(i.e., pixels that match the key value)


CategoryAPI, CategorySurface

None: SDL_SetColorKey (last edited 2012-01-28 20:16:16 by Sam Lantinga)

(Page Info.)
Feedback
Please include your contact information if you'd like to receive a reply.
Submit