[SDL] Search function to display picture got with libcurl

Damien Fawks damien_fawks at hotmail.com
Sun Jun 24 09:05:17 PDT 2007


Thank you. I didn't knew this function. So I changed my function to this :


void update_img(void *ptr, int size, int nmemb, void *stream)
{
    int img_size = size * nmemb;
   
    SDL_RWops *dl_img = SDL_RWFromMem(ptr, img_size);
    SDL_Surface *webcam_img = IMG_Load_RW(dl_img, 1);

    img_position.x = 0;                                                                    
    img_position.y = 0;
       
    SDL_BlitSurface(webcam_img, NULL, screen, &img_position);
    SDL_Flip(screen);
    pause();
}

It work in fact : it get an image (better than a black window)

Unfortunately, I only have the first 1/10th of the image. Seems there is a buffer issue somewhere. Maybe libcurl call the function immediately when data come in and don't wait the end of the transmission, so only a small part of the image is passed to the function.


>
> ---------------------
>
> There is another function named IMG_Load_RW.  You will need to create a
> SDL_RWops structure and fill it our properly, but it may work.  Once you
> have that structure you can do something like this:
>
>     SDL_RWops 	myRWOps;	// You need to create/fill this correctly.
>     SDL_Surface * pSurface;
>     
>     pSurface = IMG_Load_RW( myRWOps,0 );
>
>
>
>
> No virus found in this outgoing message.
> Checked by AVG Free Edition. 
> Version: 7.5.472 / Virus Database: 269.9.6/863 - Release Date: 6/23/2007
> 11:08 AM
>  
>
> _______________________________________________
> SDL mailing list
> SDL at lists.libsdl.org
> http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
>
>


_________________________________________________________________
Besoin d'un e-mail ? Créez gratuitement un compte Windows Live Hotmail, plus sûr, plus simple et plus complet !
http://www.windowslive.fr/hotmail/default.asp


More information about the SDL mailing list