diff --git a/lib/image.cpp b/lib/image.cpp index 620794a..fccf352 100644 --- a/lib/image.cpp +++ b/lib/image.cpp @@ -16,4 +16,16 @@ namespace Image } } + + SDL_Surface *copySurface(SDL_Surface *s) + { + SDL_Surface *copy = SDL_CreateRGBSurface(SDL_SWSURFACE, s->w, s->h, + s->format->BitsPerPixel, + s->format->Rmask, s->format->Gmask, + s->format->Bmask, s->format->Amask); + SDL_BlitSurface(s, NULL, copy, NULL); + return copy; + } + + } diff --git a/lib/image.h b/lib/image.h index ef8713c..aff3205 100644 --- a/lib/image.h +++ b/lib/image.h @@ -22,7 +22,7 @@ namespace Image { void threshold(SDL_Surface *image, int lowerBound, int upperBound); - + SDL_Surface *copySurface(SDL_Surface *s); } #endif /* ifndef _IMAGE_H_ */