Sign in to follow this  

SDL: rescale jpeg surface.

This topic is 3370 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

The code involved with the problem:

Sorry: Class & object & method names in spanish. ;-)

imgmgr.h :

SDL_Surface *imagen;
SDL_RWops *rwop;

imgmgr.cpp :

AdministradorImagenes::
AdministradorImagenes()
{
imagen = NULL;
rwop = NULL;
}

SDL_Surface *AdministradorImagenes::
cargaImagen(char *ruta)
{
rwop = SDL_RWFromFile(ruta, "rb");
imagen = IMG_LoadJPG_RW(rwop);
return imagen;
}

SDL_Surface *AdministradorImagenes::
cargaQImagen(char *ruta)
{
SDL_Surface *orig = cargaImagen(ruta);
double w = orig->w/4;
double h = orig->h/4;
SDL_Surface *resc = zoomSurface(orig, w, h, SMOOTHING_OFF);
return resc;
}

principal.cpp :

AdministradorImagenes img_adm;
foto = img_adm.cargaQImagen(argv[1]);

Share this post


Link to post
Share on other sites
I have already checked with debuger (gdb) I know exactly where the error ocurrs:

SDL_Surface *resc = zoomSurface(orig, w, h, SMOOTHING_OFF);

I left SDL_image and i'm using jpeglib instead. Now I have a SDL_Surface with my thumbnail but whith some problems, doesn't matters I'll deal with this errors by myself.

SDL_image creates an SDL_Surface with the jpeg image in a 1:1 scale. then I preferr to scale at loading time directly with jpeglib.

however, If somebody knows how to rescale an existing SDL_Surface with pixels within...

Share this post


Link to post
Share on other sites

This topic is 3370 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this