emacs-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] A small patch to make emacs support transparent image (png,


From: Po Lu
Subject: Re: [PATCH] A small patch to make emacs support transparent image (png, webp, svg)
Date: Fri, 22 Dec 2023 20:13:35 +0800
User-agent: Gnus/5.13 (Gnus v5.13)

Qiutum <zh4710jj@gmail.com> writes:

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

Because the change is _not_ this simple, just deceptively so: the depth
of the mask image is not guaranteed to exceed 1, storing complete pixel
values into which is undefined behavior, but on your system saves the
alpha channel alone into the 8-bit pixmap created there.  In combination
with the deletion of the code blending the remainder of the image with
the frame's background and an X server configured such that the picture
format chosen by Emacs for the mask picture coincides with that used by
libpng, this results in the image being composited onto the frame by the
X server.  Such a house of cards is liable to collapse without a
moment's notice, so with good reason we have not settled on such a
solution.

At the minimum, it would be required for both mechanisms to be preserved
with the original used on systems incapable of alpha compositing in the
manner of XRender, and to make provisions for converting between the
image formats used by these image libraries and those of the X server in
the event they differ.  However, image.c is long overdue for a rewrite
to eliminate the crud that has accumulated over the course of decades,
particularly the subtle variations in behavior across different systems
which are addressed at many levels with unnavigable OS and window system
conditionals, and will probably stand in the way of correctly
implementing that feature in any case.


reply via email to

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