YUVoverlay

Hi all,

Will such code work properly?------------------------------------------------------------------------------
overlay = SDL_CreateYUVOverlay(0, 0, format, surface) //create a 0*0
overlay first, update it later

//if there exists picture BufY[wh], BufU[wh/2], BufV[w*h/2].
overlay->pixels[0] = BufY;
overlay->pixels[1] = BufU;
overlay->pixels[2] = BufV;

overlay->pitches[0] = wh;
overlay->pitches[1] = w
h/2;
overlay->pitches[2] = w*h/2;

overlay->w = w;
overlay->h = h;

SDL_DisplayYUVOverlay(overlay, rect);

will this code works fine, and display the updated overlay?

Thanks,

Max

Diqing Zhong wrote:

Hi all,

Will such code work properly?


overlay = SDL_CreateYUVOverlay(0, 0, format, surface) //create a 0*0
overlay first, update it later

//if there exists picture BufY[wh], BufU[wh/2], BufV[w*h/2].
overlay->pixels[0] = BufY;
overlay->pixels[1] = BufU;
overlay->pixels[2] = BufV;

overlay->pitches[0] = wh;
overlay->pitches[1] = w
h/2;
overlay->pitches[2] = w*h/2;

overlay->w = w;
overlay->h = h;

SDL_DisplayYUVOverlay(overlay, rect);

will this code works fine, and display the updated overlay?

I suggest you look at SDL12/test/testoverlay.c and
SDL12/test/testoverlay2.c for examples on how to use overlays :
http://www.libsdl.org/cgi/cvsweb.cgi/SDL12/test/testoverlay.c?rev=1.4&content-type=text/x-cvsweb-markup
http://www.libsdl.org/cgi/cvsweb.cgi/SDL12/test/testoverlay2.c?rev=1.5&content-type=text/x-cvsweb-markup

Stephane