-- 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:

git.thebackupbox.net

rxvt-unicode-sixel

git://git.thebackupbox.net/rxvt-unicode-sixel

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

index 492ab082913ec1f40d2898fd8a8bbf4083455f00..

index ..928c3898d1e1b9fad3c534264f8f78ed5b725490 100644

--- 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

index aa455b9ca5cd5451f00b6633b8ff572de372d44c..

index ..fdbf2401d8e9efee813843934320dafb82368476 100644

--- 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