Add Scaled Blit Functions to Surface

This commit is contained in:
Kirigaya Kazuto 2017-04-14 20:46:07 +08:00
parent 3043ae0684
commit d9b26de617
2 changed files with 35 additions and 0 deletions

View File

@ -295,6 +295,35 @@ namespace MiniEngine
return SDL_BlitSurface(s._get(),NULL,_get(),NULL);
}
int Surface::blitScaled(Surface s,Rect src,Rect dst)
{
SDL_Rect rsrc=src.toSDLRect();
SDL_Rect rdst=dst.toSDLRect();
return SDL_BlitScaled(s._get(),&rsrc,_get(),&rdst);
}
int Surface::blitScaledTo(Surface s,Rect dst)
{
SDL_Rect rdst=dst.toSDLRect();
return SDL_BlitScaled(s._get(),NULL,_get(),&rdst);
}
int Surface::blitScaledTo(Surface s,Point lupoint)
{
return blitScaledTo(s,Rect(lupoint.x,lupoint.y,s.getw(),s.geth()));
}
int Surface::blitScaledFill(Surface s,Rect src)
{
SDL_Rect rsrc=src.toSDLRect();
return SDL_BlitScaled(s._get(),&rsrc,_get(),NULL);
}
int Surface::blitScaledFullFill(Surface s)
{
return SDL_BlitScaled(s._get(),NULL,_get(),NULL);
}
int Surface::setAlphaMode(int alpha)
{
return SDL_SetSurfaceAlphaMod(_get(),alpha);

View File

@ -107,6 +107,12 @@ namespace MiniEngine
int blitFill(Surface t, Rect src);
int blitFullFill(Surface t);
int blitScaled(Surface s,Rect src,Rect dst);
int blitScaledTo(Surface t, Rect dst);
int blitScaledTo(Surface t, Point lupoint);
int blitScaledFill(Surface t, Rect src);
int blitScaledFullFill(Surface t);
int setAlphaMode(int alpha);
int getAlphaMode();