bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#67968: [PATCH] A small patch to make emacs support transparent image


From: Qiutum
Subject: bug#67968: [PATCH] A small patch to make emacs support transparent image (png, webp, svg)
Date: Fri, 22 Dec 2023 19:38:09 +0800

Hi everyone,

Recently, I've been reading the code of image.c and wondering how to make emacs support transparent image. Then I find that a small change on the src/image.c can make it worked (and wonder why this have not been solved since the solution is so simple).

This patch can support the transparent png, webp and svg. The core of the patch is to change the code,

 PUT_PIXEL (mask_img, x, y, *p > 0 ? PIX_MASK_DRAW : PIX_MASK_RETAIN);    

to 

 PUT_PIXEL (mask_img, x, y, *p > 0 ? *p : PIX_MASK_RETAIN);   

Then all worked like a magic.

I have checked my patch in linux by default configure option "../configure" for dwm and pgtk build for hyprland, both are fine. I don't know whether it could support other platforms since I don't have them.

Please check my patch and happy to hear comments.

Best regards,
Zhang

Attachment: support-image-transparent.patch
Description: Source code patch


reply via email to

[Prev in Thread] Current Thread [Next in Thread]