From 6b380ae5e7c74281def85cfa874e5a6ec3f41ae7 Mon Sep 17 00:00:00 2001 From: oysteini Date: Thu, 1 Mar 2007 13:00:51 +0000 Subject: [PATCH] Image::copySurface added --- lib/image.cpp | 12 ++++++++++++ lib/image.h | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) 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_ */