/*
* call-seq:
* to_display_alpha() -> Surface
*
* Like #to_display except the Surface has an extra channel for alpha (i.e.
* opacity). May raise SDLError if a problem occurs.
*
* This function can be used to convert a colorkey to an alpha channel, if the
* SRCCOLORKEY flag is set on the surface. The generated surface will then be
* transparent (alpha=0) where the pixels match the colorkey, and opaque
* (alpha=255) elsewhere.
*/
VALUE rbgm_surface_dispformalpha(VALUE self)
{
SDL_Surface *surf, *newsurf;
Data_Get_Struct(self, SDL_Surface, surf);
if( init_video_system() == 0 )
{
newsurf = SDL_DisplayFormatAlpha( surf );
}
else
{
newsurf = NULL;
}
if( newsurf == NULL )
{
rb_raise(eSDLError,\
"Could not convert the Surface to display format with alpha channel: %s",\
SDL_GetError());
}
return Data_Wrap_Struct( cSurface,0,SDL_FreeSurface,newsurf );
}