Wiki Page Content

Differences between revisions 1 and 4 (spanning 3 versions)
Revision 1 as of 2010-02-25 20:22:40
Size: 976
Editor: SheenaSmith
Comment: create page, add content (Rev 5540)
Revision 4 as of 2010-08-09 18:06:50
Size: 2078
Editor: SheenaSmith
Comment: update content (old wiki)
Deletions are marked like this. Additions are marked like this.
Line 6: Line 6:
Use this function to set the color key (transparent pixel) in a blittable surface. Use this function to set the color key (transparent pixel) in a blittable surface *???and enable or disable RLE blit acceleration???*.
Line 18: Line 18:
||'''surface'''||the surface to update||
||'''flag'''||non-zero to enable colorkey, 0 to disable colorkey||
||'''surface'''||the surface / [[SDL_Surface]] to update||
||'''flag'''||non-zero to enable colorkey, 0 to disable colorkey^; see [[#Remarks|Remarks]] for details^||
Line 33: Line 33:
*<<BR>>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.

<<Color2(green,There are several instances of surface here where it is unclear whether it should be bolded as the param.)>>

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 drawn 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. <<Color2(green,SDL_!DisplayFormat is not in 1.3.)>>

If '''flag''' is 0, this function clears any current color key. <<BR>>*
Line 34: Line 44:
 .[[SDL_BlitSurface]] *
Line 35: Line 46:
 .[[SDL_MapRGB]] *

DRAFT

SDL_SetColorKey

Use this function to set the color key (transparent pixel) in a blittable surface *???and enable or disable RLE blit acceleration???*.

Syntax

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

Function Parameters

surface

the surface / SDL_Surface to update

flag

non-zero to enable colorkey, 0 to disable colorkey; see [[#Remarks|Remarks]] for details

key

the transparent pixel in the native surface format

Return Value

Returns 0 on success, or -1 if the surface is not valid; call SDL_GetError() for more information.

Code Examples

You can add your code example here

Remarks

You can add useful comments here

*
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.

green

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 drawn 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. green

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


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