<div dir="ltr">Hi all, <br><br>I did some progress but still I got blank window, here is my code:<br><br>Display *dpy;<br><br> dpy = XOpenDisplay(NULL);<br> <br> //stride = cairo_format_stride_for_width (CAIRO_FORMAT_RGB32 , width);<br>
//SDL_Surface *sdl=SDL_SetVideoMode(width,height,24,SDL_HWSURFACE);<br> //SDL_Surface *sdl;<br> Uint32 rmask, gmask, bmask, amask;<br>#if SDL_BYTEORDER == SDL_BIG_ENDIAN<br> rmask = 0xff000000;<br> gmask = 0x00ff0000;<br>
bmask = 0x0000ff00;<br> amask = 0x00000000;<br>#else<br> rmask = 0x000000ff;<br> gmask = 0x0000ff00;<br> bmask = 0x00ff0000;<br> amask = 0x00000000;<br>#endif<br><br>SDL_Surface *sdl = SDL_CreateRGBSurface(SDL_SWSURFACE, width, height, <br>
24, rmask, gmask, bmask, amask);<br> <br><br> <br> <br> cairo_surface_t *surface_source = cairo_xlib_surface_create(dpy,DefaultRootWindow(dpy), DefaultVisual(dpy, DefaultScreen(dpy)),height, width); <br>
<br> cairo_surface_t *surface_dest = cairo_image_surface_create_for_data((unsigned char *)sdl->pixels, CAIRO_FORMAT_RGB24, sdl->w, sdl->h, sdl->pitch);<br> cairo_t *cr_dest = cairo_create(surface_dest);<br>
//cairo_scale(cr_dest, (double)width, (double)height );<br> <br> cairo_set_source_surface(cr_dest, surface_source, (double)height, (double)width);<br> cairo_paint(cr_dest);<br><br> cairo_set_source_rgba (cr_dest, 0.5, 0.5, 0.5, 1.0);<br>
SDL_SaveBMP(sdl,"test.bmp");<br> //cairo_surface_write_to_png(surface_dest,"test.png");<br> <br> cairo_paint(cr_dest);<br> cairo_surface_destroy(surface_source);<br> cairo_surface_destroy(surface_dest);<br>
<br>I want to copy from cairo surface into sdl surface, any idea please? also will it work fast? or is there other way?<br><br>Best Regards,<br>Gadi<br></div>