all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Qiutum <zh4710jj@gmail.com>
To: 67968@debbugs.gnu.org
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	[thread overview]
Message-ID: <CACph+bVEiGK7Mcd1JmsEEN403u=i=cTQagzCemp_tc7wKQtG0w@mail.gmail.com> (raw)
In-Reply-To: <CACph+bW99OiFn2c_yWy_vE3nw90ZLwmPES-uCuu=JYdQtHhubQ@mail.gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 819 bytes --]

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 #1.2: Type: text/html, Size: 1193 bytes --]

[-- Attachment #2: support-image-transparent.patch --]
[-- Type: application/x-patch, Size: 9393 bytes --]

  parent reply	other threads:[~2023-12-22 11:38 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 ` Qiutum [this message]
2023-12-24 14:36   ` bug#67968: " Stefan Kangas
2024-03-10 20:50   ` nsan
2023-12-22 12:13 ` Po Lu

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='CACph+bVEiGK7Mcd1JmsEEN403u=i=cTQagzCemp_tc7wKQtG0w@mail.gmail.com' \
    --to=zh4710jj@gmail.com \
    --cc=67968@debbugs.gnu.org \
    /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.