/*
* call-seq:
* colorkey -> [r,g,b] or nil
*
* Return the colorkey of the surface in the form [r,g,b] (or +nil+ if there
* is no key). The colorkey of a surface is the exact color which will be
* ignored when the surface is blitted, effectively turning that color
* transparent. This is often used to make a blue (for example) background
* on an image seem transparent.
*/
VALUE rbgm_surface_get_colorkey( VALUE self )
{
SDL_Surface *surf;
Uint32 colorkey;
Uint8 r,g,b;
Data_Get_Struct(self, SDL_Surface, surf);
colorkey = surf->format->colorkey;
if( surf->flags & SDL_SRCCOLORKEY )
{
SDL_GetRGB(colorkey, surf->format, &r, &g, &b);
return rb_ary_new3(3,UINT2NUM(r),UINT2NUM(g),UINT2NUM(b));
}
else
{
/* No colorkey set. */
return Qnil;
}
}