-- Leo's gemini proxy
-- Connecting to git.thebackupbox.net:1965...
-- Connected
-- Sending request
-- Meta line: 20 text/gemini
repo: rxvt-unicode-sixel action: commit revision: path_from: revision_from: 331a63868e37b26a1399d6f9f4163cf5798a1fd9: path_to: revision_to:
commit 331a63868e37b26a1399d6f9f4163cf5798a1fd9 Author: Emanuele Giaquinta <emanuele.giaquinta@gmail.com> Date: Sun Jun 3 20:34:25 2012 +0000 Add method to convert an rxvt_img to another format. diff --git a/src/rxvtimg.C b/src/rxvtimg.C
--- a/src/rxvtimg.C +++ b/src/rxvtimg.C @@ -215,6 +215,29 @@ rxvt_img::scale (int new_width, int new_height) //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 diff --git a/src/rxvtimg.h b/src/rxvtimg.h
--- a/src/rxvtimg.h +++ b/src/rxvtimg.h @@ -41,6 +41,7 @@ struct rxvt_img rxvt_img *copy (); rxvt_img *scale (int new_width, int new_height); rxvt_img *transform (int new_width, int new_height, double matrix[16]); + rxvt_img *convert_to (XRenderPictFormat *format); }; #endif
-----END OF PAGE-----
-- Response ended
-- Page fetched on Sun Jun 2 12:04:00 2024