GNU bug report logs -
#77104
31.0.50; Transparent png image background is ignored in frames with alpha-background
Previous Next
To reply to this bug, email your comments to 77104 AT debbugs.gnu.org.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
dybfysiat <at> 163.com, bug-gnu-emacs <at> gnu.org
:
bug#77104
; Package
emacs
.
(Tue, 18 Mar 2025 18:05:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Ihor Radchenko <yantar92 <at> posteo.net>
:
New bug report received and forwarded. Copy sent to
dybfysiat <at> 163.com, bug-gnu-emacs <at> gnu.org
.
(Tue, 18 Mar 2025 18:05:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Try the following starting from emacs -Q + the attached .png file:
1.
(let ((ov (make-overlay 1 10)))
(set-frame-parameter nil 'alpha-background 90)
(overlay-put
ov
'display
(create-image
"/path/to/image.png"
nil nil :width 100)))
2. Observe image background not being transparent, but instead using
default face background.
3.
(let ((ov (make-overlay 1 10)))
(set-frame-parameter nil 'alpha-background 90)
(overlay-put
ov
'display
(create-image
"/path/to/image.png"
nil nil :width 100 :mask 'heuristic)))
4. With :mask 'heuristic, the background becomes transparent (mod
"rough" edges due to clipping)
I believe that (1) is a bug.
See also https://list.orgmode.org/orgmode/7324dc0.f8517.195a224ffd1.Coremail.dybfysiat <at> 163.com/
[image.png (image/png, attachment)]
[Message part 3 (text/plain, inline)]
In GNU Emacs 31.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
3.24.42, cairo version 1.18.2) of 2025-03-16 built on localhost
Repository revision: 52879c61e961cac71e7bb0ba12b73f6dd4f28877
Repository branch: scratch/markers-as-gap-array
Windowing system distributor 'The X.Org Foundation', version 11.0.12101014
System Description: Gentoo Linux
Configured using:
'configure --with-tree-sitter --with-native-compilation 'CFLAGS=-g3
-I/opt/mps/include -L/opt/mps/lib'
JAVAC=/etc/java-config-2/current-system-vm/bin/javac
PKG_CONFIG_PATH=/usr/share/guile-data/3.0/pkgconfig'
Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG
LCMS2 LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG RSVG
SECCOMP SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER WEBP
X11 XDBE XIM XINPUT2 XPM GTK3 ZLIB
--
Ihor Radchenko // yantar92,
Org mode maintainer,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#77104
; Package
emacs
.
(Wed, 19 Mar 2025 12:16:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 77104 <at> debbugs.gnu.org (full text, mbox):
> Cc: gynamics <dybfysiat <at> 163.com>
> From: Ihor Radchenko <yantar92 <at> posteo.net>
> Date: Tue, 18 Mar 2025 18:03:23 +0000
>
> Try the following starting from emacs -Q + the attached .png file:
>
> 1.
>
> (let ((ov (make-overlay 1 10)))
> (set-frame-parameter nil 'alpha-background 90)
> (overlay-put
> ov
> 'display
> (create-image
> "/path/to/image.png"
> nil nil :width 100)))
>
> 2. Observe image background not being transparent, but instead using
> default face background.
>
> 3.
>
> (let ((ov (make-overlay 1 10)))
> (set-frame-parameter nil 'alpha-background 90)
> (overlay-put
> ov
> 'display
> (create-image
> "/path/to/image.png"
> nil nil :width 100 :mask 'heuristic)))
>
> 4. With :mask 'heuristic, the background becomes transparent (mod
> "rough" edges due to clipping)
>
> I believe that (1) is a bug.
>
> See also https://list.orgmode.org/orgmode/7324dc0.f8517.195a224ffd1.Coremail.dybfysiat <at> 163.com/
Po Lu and Alan, is this a bug or a missing feature?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#77104
; Package
emacs
.
(Wed, 19 Mar 2025 13:07:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 77104 <at> debbugs.gnu.org (full text, mbox):
Eli Zaretskii <eliz <at> gnu.org> writes:
> Po Lu and Alan, is this a bug or a missing feature?
I'm tending towards "bug", but only Alan can be sure.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#77104
; Package
emacs
.
(Wed, 19 Mar 2025 16:25:13 GMT)
Full text and
rfc822 format available.
Message #14 received at 77104 <at> debbugs.gnu.org (full text, mbox):
On Wed, Mar 19, 2025 at 09:06:07PM +0800, Po Lu wrote:
> Eli Zaretskii <eliz <at> gnu.org> writes:
>
> > Po Lu and Alan, is this a bug or a missing feature?
>
> I'm tending towards "bug", but only Alan can be sure.
I'd lean more towards missing feature, but it's a toss up really.
I think the problem is that Emacs has never handled image
transparency, so it sets the transparent pixels of the image to the
frame's background colour. There's quite a bit of fiddling to manage
this with changing backgrounds and so on.
I'm not sure what would be required for drawing transparent images to
the glass. On NS I think it would be near trivial as the toolkit will
handle it for us, but I don't know about others. For example I have a
memory of being told that some terms don't clear under images so
drawing a transparent image might show the previous pixels.
--
Alan Third
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#77104
; Package
emacs
.
(Wed, 19 Mar 2025 16:58:02 GMT)
Full text and
rfc822 format available.
Message #17 received at 77104 <at> debbugs.gnu.org (full text, mbox):
Alan Third <alan <at> idiocy.org> writes:
> I think the problem is that Emacs has never handled image
> transparency, so it sets the transparent pixels of the image to the
> frame's background colour. There's quite a bit of fiddling to manage
> this with changing backgrounds and so on.
>
> I'm not sure what would be required for drawing transparent images to
> the glass. On NS I think it would be near trivial as the toolkit will
> handle it for us, but I don't know about others. For example I have a
> memory of being told that some terms don't clear under images so
> drawing a transparent image might show the previous pixels.
Then, how does :mask 'heuristic works? It somehow manages to set certain
pixels to be truly transparent. If so, why is it a problem setting
pixels that have transparent color in the image truly transparent in
exactly the same way?
--
Ihor Radchenko // yantar92,
Org mode maintainer,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#77104
; Package
emacs
.
(Wed, 19 Mar 2025 17:03:06 GMT)
Full text and
rfc822 format available.
Message #20 received at 77104 <at> debbugs.gnu.org (full text, mbox):
> Date: Wed, 19 Mar 2025 16:23:44 +0000
> From: Alan Third <alan <at> idiocy.org>
> Cc: Eli Zaretskii <eliz <at> gnu.org>, Ihor Radchenko <yantar92 <at> posteo.net>,
> 77104 <at> debbugs.gnu.org, dybfysiat <at> 163.com
>
> On Wed, Mar 19, 2025 at 09:06:07PM +0800, Po Lu wrote:
> > Eli Zaretskii <eliz <at> gnu.org> writes:
> >
> > > Po Lu and Alan, is this a bug or a missing feature?
> >
> > I'm tending towards "bug", but only Alan can be sure.
>
> I'd lean more towards missing feature, but it's a toss up really.
>
> I think the problem is that Emacs has never handled image
> transparency, so it sets the transparent pixels of the image to the
> frame's background colour.
That's what I thought, indeed.
> There's quite a bit of fiddling to manage this with changing
> backgrounds and so on.
>
> I'm not sure what would be required for drawing transparent images to
> the glass. On NS I think it would be near trivial as the toolkit will
> handle it for us, but I don't know about others. For example I have a
> memory of being told that some terms don't clear under images so
> drawing a transparent image might show the previous pixels.
Patches welcome.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#77104
; Package
emacs
.
(Wed, 19 Mar 2025 20:46:02 GMT)
Full text and
rfc822 format available.
Message #23 received at 77104 <at> debbugs.gnu.org (full text, mbox):
On Wed, Mar 19, 2025 at 04:57:01PM +0000, Ihor Radchenko wrote:
> Alan Third <alan <at> idiocy.org> writes:
>
> > I think the problem is that Emacs has never handled image
> > transparency, so it sets the transparent pixels of the image to the
> > frame's background colour. There's quite a bit of fiddling to manage
> > this with changing backgrounds and so on.
> >
> > I'm not sure what would be required for drawing transparent images to
> > the glass. On NS I think it would be near trivial as the toolkit will
> > handle it for us, but I don't know about others. For example I have a
> > memory of being told that some terms don't clear under images so
> > drawing a transparent image might show the previous pixels.
>
> Then, how does :mask 'heuristic works? It somehow manages to set certain
> pixels to be truly transparent. If so, why is it a problem setting
> pixels that have transparent color in the image truly transparent in
> exactly the same way?
As I recall on X it uses a mask, so there's a second image that has
the transparent pixels marked (so probably a one bit bitmap) and the
image drawing function only draws the corresponding non-transparent
pixels from the main image.
Other terms may work differently. I don't think NS has native support
for masking bitmaps, for example. I can't remember how we work around
that.
--
Alan Third
This bug report was last modified 87 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.