Thanks for your response, Uli.<div><br></div><div>Ugh...I was trying to clean up my code when putting in the email but made a couple of mistakes. The XPutImage is actually commented out in my running code. Please disregard it. Also, the video feed is initially 8 bit but I have another program grabbing the frames via V4L2 and piping them out as 24 bits. Therefore, the xImage which cairo uses as a source is indeed 24 bits. Sorry for the confusion.<div>
<br></div><div>I am not waiting for an Expose event but I don't see why it would matter since the images are drawn fine when I don't call the scale function. It's only when I call scale that the image is no longer displayed in the window. This is a stand alone window who's only purpose right now is to have these images drawn in it (for testing). If I can get this working, I will then draw them in a Widget which is part of a larger application.</div>
<div><br></div><div>I have tried some other operations with cairo which aren't working for me either (right before the call to set_source_surface). I tried writing text on the image:</div><div><br></div><div><div>cairo_select_font_face (cr_dest, "serif", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);</div>
<div>cairo_set_font_size (cr_dest, 20.0);</div><div>cairo_move_to(cr_dest, 50, 50);</div><div>cairo_show_text(cr_dest, "Hello");</div></div><div><br></div><div>and I tried rotating the image 180 degrees:</div><div>
<br></div><div>cairo_rotate(cr_dest, M_PI);</div><div><br></div><div>Writing text and rotating don't do anything but the image is still displayed, unaltered. This is in contrast to the attempt to scale which results in no image being displayed.</div>
<div><br></div><div><br></div><div>The corrected code is below:</div><div><br></div><div><br></div><div><div style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; color: rgb(34, 34, 34); "><div>
//Create a simple X11 window for displaying the XImage...</div><div> window = XCreateSimpleWindow(</div><div> display,</div><div> RootWindowOfScreen(screen),</div><div> 0, // x</div><div> 0, // y</div>
<div> width,</div><div> height,</div><div> 0, // border width</div><div> BlackPixelOfScreen(screen), // border</div><div> BlackPixelOfScreen(screen) // background</div><div>
);</div><div> XMapRaised(display, window);</div><div> </div><div> //cairo stuff...</div><div> cairo_surface_t *surface_dest = cairo_xlib_surface_create(display, window, XDefaultVisualOfScreen(screen), width, height);</div>
<div> cairo_t *cr_dest = cairo_create(surface_dest);</div><div> </div><div> cairo_surface_t *surface_source = cairo_image_surface_create_for_data((unsigned char*)(xImage->data), CAIRO_FORMAT_RGB24, xImage->width, xImage->height, xImage->bytes_per_line);</div>
<div><span style="white-space: pre-wrap; ">        </span> </div><div> cairo_scale(cr_dest, (double)width / xImage->width, (double)height / xImage->height);</div><div><br></div><div> cairo_set_source_surface(cr_dest, surface_source, 0, 0);</div>
<div> cairo_paint(cr_dest);</div><div> cairo_surface_destroy(surface_source);</div><div><span style="white-space: pre-wrap; ">        </span></div><div> cairo_surface_destroy(surface_dest);</div></div><div style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; color: rgb(34, 34, 34); ">
cairo_surface_destroy(surface_source);</div></div></div>