--- rxvt-unicode/src/rxvtimg.C 2012/06/03 18:49:55 1.6 +++ rxvt-unicode/src/rxvtimg.C 2012/06/03 20:34:25 1.7 @@ -215,6 +215,29 @@ //TODO } +rxvt_img * +rxvt_img::convert_to (XRenderPictFormat *new_format) +{ + Display *dpy = s->display->dpy; + Pixmap new_pm = XCreatePixmap (dpy, pm, w, h, new_format->depth); + Picture src = XRenderCreatePicture (dpy, pm, format, 0, 0); + Picture dst = XRenderCreatePicture (dpy, new_pm, new_format, 0, 0); + + XRenderComposite (dpy, PictOpSrc, src, None, dst, 0, 0, 0, 0, 0, 0, w, h); + + XRenderFreePicture (dpy, src); + XRenderFreePicture (dpy, dst); + + rxvt_img *img = new rxvt_img ( + s, + new_format, + w, + h, + new_pm + ); + + return img; +} #endif