-- 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: 3752861d51de1eb81e7da5e93dab23975139385f:
path_to:
revision_to:

git.thebackupbox.net

rxvt-unicode-sixel

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

commit 3752861d51de1eb81e7da5e93dab23975139385f
Author: Emanuele Giaquinta <emanuele.giaquinta@gmail.com>
Date:   Tue Jun 5 18:52:48 2012 +0000

    Add rxvt_img::blend method.

diff --git a/src/rxvtimg.C b/src/rxvtimg.C

index 5edf6412244e72eacc97904927d9f811cdb8c101..

index ..e1d29651db9dc20f3e67cb4d8101358b751a5706 100644

--- a/src/rxvtimg.C
+++ b/src/rxvtimg.C
@@ -453,5 +453,31 @@ rxvt_img::convert_to (XRenderPictFormat *new_format)
   return img;
 }

+rxvt_img *
+rxvt_img::blend (rxvt_img *img, double factor)
+{
+  rxvt_img *img2 = clone ();
+  Display *dpy = s->display->dpy;
+  Picture src = XRenderCreatePicture (dpy, img->pm, img->format, 0, 0);
+  Picture dst = XRenderCreatePicture (dpy, img2->pm, img2->format, 0, 0);
+  Picture mask = create_xrender_mask (dpy, img->pm, False);
+
+  XRenderColor mask_c;
+
+  mask_c.alpha = float_to_component (factor);
+  mask_c.red   =
+  mask_c.green =
+  mask_c.blue  = 0;
+  XRenderFillRectangle (dpy, PictOpSrc, mask, &mask_c, 0, 0, 1, 1);
+
+  XRenderComposite (dpy, PictOpOver, src, mask, dst, 0, 0, 0, 0, 0, 0, w, h);
+
+  XRenderFreePicture (dpy, src);
+  XRenderFreePicture (dpy, dst);
+  XRenderFreePicture (dpy, mask);
+
+  return img2;
+}
+
 #endif

diff --git a/src/rxvtimg.h b/src/rxvtimg.h

index bf08a044fd691aef781f5236f3b435ebad164d1b..

index ..2b7b1a344f2dca5d5fc83d6c2eadf00e103ed21c 100644

--- a/src/rxvtimg.h
+++ b/src/rxvtimg.h
@@ -45,6 +45,7 @@ struct rxvt_img
   rxvt_img *scale (int new_width, int new_height);
   rxvt_img *rotate (int new_width, int new_height, int x, int y, double phi, int repeat = RepeatNormal);
   rxvt_img *convert_to (XRenderPictFormat *format);
+  rxvt_img *blend (rxvt_img *img, double factor);
 };

 #endif

-----END OF PAGE-----

-- Response ended

-- Page fetched on Sun Jun 2 10:02:41 2024