you could always use opengl, opengl is set up so that you can easily resize
images when you draw them to the screen with hardware accelerated scaling (:> ----- Original Message -----
From: joakim.kolsjo@home.se (Joakim Kolsjo)
To:
Sent: Wednesday, September 01, 2004 8:02 PM
Subject: [SDL] Is it possible to resize surfaces with transarent
areasintact?Hello, i’m writing a game where i need to resize some of my images before
using them acording to how big the map is and how big of a resolution the
user has. I’ve been unable to do so while getting the transparent areas
correct, instead i get black areas where it used to be transparent.The following code generates this problem:
SDL_Surface *temp = SDL_CreateRGBSurface(SDL_SWSURFACE, width, height,
bpp, 0, 0, 0, 0);
SDL_BlitSurface(some_image, 0, temp, 0); // The same effect as when i use
my resize code
SDL_BlitSurface(temp, 0, screen, some_dest); // When i do this the
transparent areas in the original “some_image” is black.How do i keep the transparent information when i copy the surface? This
copy must be done on a per pixel basis so that i can use scale variables
like this:
//getPixel(src, (int)(xwscale), (int)(yhscale), r, g, b);
//setPixel(dst, x, y, r, g, b);// I’ve attempted to include alpha like this, but it would not work
though… but is this really what im looking for anyway?
SDL_GetRGBA(((Uint32*)src->pixels)[x + ysrc->w], src->format, &r, &g, &b,
&a);
((Uint32)dst->pixels)[x + y*dst->w] = SDL_MapRGBA(src->format, r, g, b,
a);Thanks in advance / Jocke
SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl