all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Kai Ma <justksqsf@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: Text shadows
Date: Sun, 12 Mar 2023 17:55:01 +0800	[thread overview]
Message-ID: <818EE19C-BF0F-4EB9-802F-C9BDBD280E03@gmail.com> (raw)
In-Reply-To: <83edpuuy9j.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 1916 bytes --]


> On Mar 12, 2023, at 17:14, Eli Zaretskii <eliz@gnu.org> wrote:
> 
> Would you please investigate that aspect?  E.g., does Firefox support
> this without Cairo, and if so, how?

From what I read, Firefox currently has two set of 2D graphics APIs, Moz2D and Thebes.

Moz2D contained their own implementations for an approximation of Gaussian blurring using the box blur [1].

Thebes defines an interface named DrawSurfaceWithShadow [2], and provides implementations in terms of Cairo [3] (based on a custom blurring function [4]), Direct2D [5], and Skia [6].

So it appears that, with Cairo, one has to implement their own blurring function.

[1] https://searchfox.org/mozilla-central/rev/2ede53e39955988f98db4369f7ce09614b22104a/gfx/2d/Blur.cpp#876 
[2] https://searchfox.org/mozilla-central/rev/2ede53e39955988f98db4369f7ce09614b22104a/gfx/2d/2D.h#1447 
[3] https://searchfox.org/mozilla-central/rev/2ede53e39955988f98db4369f7ce09614b22104a/gfx/2d/DrawTargetCairo.cpp#936 
[4] https://searchfox.org/mozilla-central/source/gfx/2d/Blur.cpp#581
[5] https://searchfox.org/mozilla-central/rev/2ede53e39955988f98db4369f7ce09614b22104a/gfx/2d/DrawTargetD2D1.cpp#306 
[6] https://searchfox.org/mozilla-central/rev/2ede53e39955988f98db4369f7ce09614b22104a/gfx/2d/DrawTargetSkia.cpp#765 

> 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 is already the case: Cairo does not provide a Gaussian blurring function, so I wrote one (named gaussian_blur) in xcairo.c.  It is an approximation, not the “True Gaussian Blur”, like Moz2D’s implementation.  It only uses one CPU core, but is fast enough for me.

I don’t have objections to simply making the background slightly different on some difficult platforms.


[-- Attachment #2: Type: text/html, Size: 7824 bytes --]

  reply	other threads:[~2023-03-12  9:55 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
2023-03-12  9:55       ` Kai Ma [this message]
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=818EE19C-BF0F-4EB9-802F-C9BDBD280E03@gmail.com \
    --to=justksqsf@gmail.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@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.