unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Po Lu <luangruo@yahoo.com>
To: Nate Sandy <nsan@posteo.de>
Cc: "Sebastian Wålinder" <s.walinder@gmail.com>, emacs-devel@gnu.org
Subject: Re: Face transparency attribute
Date: Mon, 18 Mar 2024 21:50:44 +0800	[thread overview]
Message-ID: <87sf0nr6mj.fsf@yahoo.com> (raw)
In-Reply-To: <87v85k1myr.fsf@posteo.de> (Nate Sandy's message of "Sun, 17 Mar 2024 23:02:20 +0000")

Nate Sandy <nsan@posteo.de> writes:

> Po Lu <luangruo@yahoo.com> writes:
>
>> Neither approach is easy or exceptionally challenging, so interested
>> individuals are invited to chose whichever they should find more to
>> their liking.
>
> Hi Po,
>
> I have written a patch for this for the pgtk backend and went with the
> first route - supporting an alpha channel in face colors. I figured it's
> nicer since we get alpha channels for all other text decorations as
> well.
>
> The way it works is that when painting a background color (one which
> respects alpha-background), we instead compose it with the frame
> background color via a re-implementation of CAIRO_OPERATOR_OVER. I
> didn't find a way to do this with cairo itself without painting the
> surface inbetween.
>
> I also made sure that this patch integrates with alpha-background, which
> is also my primary use case - fully hiding faces which don't respect
> alpha-background.
>
> The only syntax supported for transparency is gtk_parse_rgba's
> `rgba(255,255,255,1.0)`. Maybe we would want support for `#ff00ff00` too?
>
> One interesting quirk is that when changing the opacity of the `default`
> face to less than 1, the whole background is fully transparent again. I
> am not sure whether this is a fault in my code or because of some extra
> logic regarding the `default` face.
>
> Attached are a screenshot and the patch. I'd very much appreciate
> feedback. If necessary I could also try to implement this for X and/or
> terminals, however I don't have access to other platforms.

I'm not happy with this approach, since it defines the alpha value as an
integral component of a face's foreground and background colors, rather
than an attribute (or attributes) the face merging process can manage
independently to prevent alpha values from being transferred between
faces against the user's wishes, and more broadly to enable specifying
alpha values separately from face colors, which there is plenty of
reason for users to replace that might not apply to transparency in
identical circumstances.

Furthermore, the transparency implemented in this patch is specified
with premultiplied values--premultiplied alpha is more efficient on free
systems, but admits of invalid color values whose behavior is undefined
across all the systems and toolkits we support.  It's already too easy
for Emacs users to shoot themselves in the foot, and muddling the waters
with the potential for invalid color definitions would be a step in the
wrong direction, in my humble estimation, so I would prefer an
implementation that exposes straight alpha values to users, converting
between those and the suitable alpha format for the toolkit at display
time.



  parent reply	other threads:[~2024-03-18 13:50 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-18  1:35 Face transparency attribute Sebastian Wålinder
2024-01-18  7:14 ` Po Lu
2024-03-17 23:02   ` Nate Sandy
2024-03-18  7:41     ` Protesilaos Stavrou
2024-03-18 13:50     ` Po Lu [this message]
2024-05-03  7:01       ` Filippo Argiolas

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=87sf0nr6mj.fsf@yahoo.com \
    --to=luangruo@yahoo.com \
    --cc=emacs-devel@gnu.org \
    --cc=nsan@posteo.de \
    --cc=s.walinder@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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).