all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Po Lu <luangruo@yahoo.com>
To: Qiutum <zh4710jj@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: [PATCH] A small patch to make emacs support transparent image (png, webp, svg)
Date: Fri, 22 Dec 2023 20:13:35 +0800	[thread overview]
Message-ID: <87v88qwi34.fsf@yahoo.com> (raw)
In-Reply-To: <CACph+bW99OiFn2c_yWy_vE3nw90ZLwmPES-uCuu=JYdQtHhubQ@mail.gmail.com> (Qiutum's message of "Fri, 22 Dec 2023 15:18:06 +0800")

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.



      parent reply	other threads:[~2023-12-22 12:13 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-22  7:18 [PATCH] A small patch to make emacs support transparent image (png, webp, svg) Qiutum
2023-12-22  8:25 ` Manuel Giraud via Emacs development discussions.
2023-12-22  8:59   ` Qiutum
2023-12-22  9:43     ` Manuel Giraud via Emacs development discussions.
2023-12-22  9:49 ` Stefan Kangas
2023-12-22 11:38 ` bug#67968: " Qiutum
2023-12-24 14:36   ` Stefan Kangas
2024-03-10 20:50   ` nsan
2023-12-22 12:13 ` Po Lu [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87v88qwi34.fsf@yahoo.com \
    --to=luangruo@yahoo.com \
    --cc=emacs-devel@gnu.org \
    --cc=zh4710jj@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.