|
Size: 2078
Comment: update content (old wiki)
|
← Revision 10 as of 2012-01-28 20:16:16 ⇥
Size: 1224
Comment:
|
| Deletions are marked like this. | Additions are marked like this. |
| Line 3: | Line 3: |
| ||<tablewidth="100%" style="color: #FF0000;" :> DRAFT|| | |
| Line 6: | Line 5: |
| Use this function to set the color key (transparent pixel) in a blittable surface *???and enable or disable RLE blit acceleration???*. | Use this function to set the color key (transparent pixel) in a surface. |
| Line 18: | Line 17: |
| ||'''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 || |
||'''surface'''||the [[SDL_Surface]] structure to update|| ||'''flag'''||SDL_TRUE to enable color key, SDL_FALSE to disable color key|| ||'''key'''||the transparent pixel|| |
| Line 23: | Line 22: |
| Returns 0 on success, or -1 if the surface is not valid; call [[SDL_GetError]]() for more information. | Returns 0 on success or a negative error code on failure; call [[SDL_GetError]]() for more information. |
| Line 31: | Line 30: |
| ''You can add useful comments here'' | 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 33: | Line 32: |
| *<<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. | |
| Line 35: | Line 33: |
| <<Color2(green,There are several instances of surface here where it is unclear whether it should be bolded as the param.)>> | RLE acceleration can substantially speed up blitting of images with large horizontal runs of transparent pixels. See [[SDL_SetSurfaceRLE]]() for details. |
| Line 37: | Line 35: |
| 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 44: | Line 37: |
| .[[SDL_BlitSurface]] * | .[[SDL_BlitSurface]] |
| Line 46: | Line 39: |
| .[[SDL_MapRGB]] * |
SDL_SetColorKey
Use this function to set the color key (transparent pixel) in a surface.
Contents
Syntax
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
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.
