Esempio n. 1
0
void Surface::SetColorKey(const RGBA & color)
{
#if SDL_VERSION_ATLEAST(2, 0, 0)
    SDL_SetColorKey(surface, SDL_TRUE, MapRGB(color));
#else
    SDL_SetColorKey(surface, SDL_SRCCOLORKEY, MapRGB(color));
#endif
}
Esempio n. 2
0
u32 Surface::GetColorIndex(u16 index) const
{
    if(isValid())
    {
	if(8 == depth())
	    return index;
	else
	{
	    index *= 3;

    	    if(static_cast<u16>(ARRAY_COUNT(kb_pal)) > index + 2)
		return MapRGB(kb_pal[index] << 2, kb_pal[index + 1] << 2, kb_pal[index + 2] << 2);
	}
    }
    return 0;
}
Esempio n. 3
0
void
Surface::FillRect (const Color & c, rectangle * destrect)
{
    if (SDL_FillRect (surface, destrect, MapRGB (c)))
	throw SDLException ();
}
Esempio n. 4
0
void
Surface::SetColorKey (const Color & key, Uint32 flag)
{
    if (SDL_SetColorKey (surface, flag, MapRGB (key)))
	throw SDLException ();
}