Subject: bug#67968: [PATCH] A small patch to make emacs support transparent image (png, webp, svg)

From: Stefan Kangas <[email-masked]>
Date: Sun, 24 Dec 2023 06:36:51 -0800

Qiutum <[email-masked]> writes:

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

I thought we already supported transparency in png, webp and svg?

Could you please explain more about the problem you are trying to solve?