all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Kai Ma <justksqsf@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: Text shadows
Date: Sun, 12 Mar 2023 11:14:48 +0200	[thread overview]
Message-ID: <83edpuuy9j.fsf@gnu.org> (raw)
In-Reply-To: <EC1A0CE7-AA3E-40A3-8CFC-09897E0954F0@gmail.com> (message from Kai Ma on Sun, 12 Mar 2023 16:24:17 +0800)

> From: Kai Ma <justksqsf@gmail.com>
> Date: Sun, 12 Mar 2023 16:24:17 +0800
> Cc: emacs-devel@gnu.org
> 
> > Which parts of the feature implementation really require Cairo?  IOW,
> > why cannot this be available to non-Cairo builds as well?
> 
> Theoretically, nothing.  I targeted Cairo because (I think) it is the most popular option on GNU/Linux.
> 
> Speaking of this specific implementation, gaussian_blur() relies on a specific Cairo image format ARGB32, (this assumption could be easily removed), and then it is used by ftcrfont_draw() to generate shadows.
> 
> I don’t know whether non-Cairo builds (non-cairo X, win32) can/should use gaussian_blur() though, since I’m not familiar with them.

Would you please investigate that aspect?  E.g., does Firefox support
this without Cairo, and if so, how?

At worst, perhaps it would be good enough not to support blurring on
some platforms, or support it by some minor modification of the color?
Or maybe we could implement the equivalent of gaussian_blur in our
code?

> >> This feature adds a new face attribute :shadow, and accepts values like:
> >> 
> >> - FLOAT                 how much blurring?
> >> - (FLOAT . COLOR)       additionally, specifies a color for the shadow
> >> - (FLOAT COLOR OFFSET)  additionally, specifies an offset (x . y)
> > 
> > I think at least in some GUI systems the offset is specified as radius
> > and angle.
> 
> The shadow is generated by this process:
> 
> - draw glyphs (in the shadow color) onto a blank canvas;
> - apply the blurring function;
> - copy the “shadow” back to the original canvas at the specified x-y coordinate.
> 
> So I don’t think radius and angle is relevant here.

The radius and angle are just polar specifications of the Cartesian
X-offset and Y-offset, that's all.  If the API needs Cartesian
specification, it should be trivial to convert polar to Cartesian
before calling the API.



  parent reply	other threads:[~2023-03-12  9:14 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-12  4:06 Text shadows Kai Ma
2023-03-12  4:18 ` Kai Ma
2023-03-12  7:12 ` Eli Zaretskii
2023-03-12  8:24   ` Kai Ma
2023-03-12  8:46     ` Po Lu
2023-03-12  9:23       ` Kai Ma
2023-03-12 10:33         ` Po Lu
2023-03-12  9:14     ` Eli Zaretskii [this message]
2023-03-12  9:55       ` Kai Ma
2023-03-12 11:33         ` Eli Zaretskii
2023-03-12 11:49           ` Kai Ma
2023-03-12 12:36             ` Eli Zaretskii

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=83edpuuy9j.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=justksqsf@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.