From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Kai Ma Newsgroups: gmane.emacs.devel Subject: Re: Text shadows Date: Sun, 12 Mar 2023 17:55:01 +0800 Message-ID: <818EE19C-BF0F-4EB9-802F-C9BDBD280E03@gmail.com> References: <72650A07-DEC8-4E08-A524-5C7AF804F3CB@gmail.com> <83mt4iv3xa.fsf@gnu.org> <83edpuuy9j.fsf@gnu.org> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.400.51.1.1\)) Content-Type: multipart/alternative; boundary="Apple-Mail=_E7D1ADAA-D41D-4159-9D60-E37EC108A6F1" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="27936"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Mar 12 10:55:39 2023 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pbIQV-00072q-3Z for ged-emacs-devel@m.gmane-mx.org; Sun, 12 Mar 2023 10:55:39 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pbIQC-0008A5-Tp; Sun, 12 Mar 2023 05:55:20 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pbIQC-00089v-80 for emacs-devel@gnu.org; Sun, 12 Mar 2023 05:55:20 -0400 Original-Received: from mail-pj1-x1041.google.com ([2607:f8b0:4864:20::1041]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pbIQ9-0001Ay-83; Sun, 12 Mar 2023 05:55:19 -0400 Original-Received: by mail-pj1-x1041.google.com with SMTP id fy10-20020a17090b020a00b0023b4bcf0727so1510279pjb.0; Sun, 12 Mar 2023 01:55:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678614915; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:from:to:cc:subject:date:message-id:reply-to; bh=vFSOgFeYXirN2AWZ7LWcvruV0lnRsimxiLFRIk2hJHY=; b=V6aRERYSFesmuaXINWqhNKCbamDq62dIekDooWLtAna5gLoVr0PNnP5Cf/78a9vjI4 1y+lp2BueaLvWWa9f0GrUUU+aYpICFj07OikAuqRxXnFlqXlNefvGMDHZtQ4J9MaoaEx 4rsKTLltdxg9UJANQggswZBI/nShTzY3JtmNkjd2cvLWPfH+Bvyi8P1ImgI58Sfw+JBR rLUvVUFSeAEXpKDdQ2OXhjBj/0Iae/n4IPxDVyIjfOlvSyuQZCi8X1HWCmKgWd88kyJs KCz1k+IlJHGDfuA2D7MntmfNnm4CAur0JDCwfS40egUBsKY1MOhNBkL1aGJP2UR3Nu96 Q9Gw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678614915; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=vFSOgFeYXirN2AWZ7LWcvruV0lnRsimxiLFRIk2hJHY=; b=E+1WnrPYFAxOco0chF2nNsTJkmcbHgxfy7bw7Gqe+vEIQy4YCLfIHWJe4X8EySYXV9 TclXpNNdBeGxJCn1fuMspKkjGl2ksl9EfPFbN0j7MG6wnVbepTrwdw8mkmaFhctZ6OIK 23UlBgD2Lf+ZDfz0Hx8eeXS21YPca7TR2XUI/Kib3nkGo3rdiF1gVrtPrd0I93xi87No khwHk47BcNJuxTeUhKKvdaBNgmICrN+wjPALLI4gdh11MrTgSzZ0HbMNHAvIQf8FSn8r 33zZopmcxJI7B0BvNfHi+epqwEF5UEhdu5h+5dC145j7MWmA+XL55Glz2CNEJ75YxQYm Xf/A== X-Gm-Message-State: AO0yUKXFcaE0m0u14F+HxYNEYbhQhmnLHiLdFFYMvKasTxd7GBB3MObf kiw596d0KPTcElT4t5wCOLhPMa0Gc9M+bA/gSrQ= X-Google-Smtp-Source: AK7set9LRfw9lTq3KCN3nRoyCi+HiERZxSg9HdGCiY5KVGZswYGi+mvpq3QjFNkQXVml8Kmpn6EWOg== X-Received: by 2002:a17:902:e844:b0:19c:d97f:5d28 with SMTP id t4-20020a170902e84400b0019cd97f5d28mr38961000plg.32.1678614914848; Sun, 12 Mar 2023 01:55:14 -0800 (PST) Original-Received: from smtpclient.apple ([2404:c800:922f:d3b:9cf2:fcff:fecc:2ed2]) by smtp.gmail.com with ESMTPSA id j4-20020a170902758400b0019f27fd7cecsm2089721pll.197.2023.03.12.01.55.13 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 12 Mar 2023 01:55:14 -0800 (PST) In-Reply-To: <83edpuuy9j.fsf@gnu.org> X-Mailer: Apple Mail (2.3731.400.51.1.1) Received-SPF: pass client-ip=2607:f8b0:4864:20::1041; envelope-from=justksqsf@gmail.com; helo=mail-pj1-x1041.google.com X-Spam_score_int: -15 X-Spam_score: -1.6 X-Spam_bar: - X-Spam_report: (-1.6 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, FROM_LOCAL_NOVOWEL=0.5, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:304359 Archived-At: --Apple-Mail=_E7D1ADAA-D41D-4159-9D60-E37EC108A6F1 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Mar 12, 2023, at 17:14, Eli Zaretskii wrote: >=20 > Would you please investigate that aspect? E.g., does Firefox support > this without Cairo, and if so, how? =46rom 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/2ede53e39955988f98db4369f7ce0961= 4b22104a/gfx/2d/Blur.cpp#876=20 [2] = https://searchfox.org/mozilla-central/rev/2ede53e39955988f98db4369f7ce0961= 4b22104a/gfx/2d/2D.h#1447=20 [3] = https://searchfox.org/mozilla-central/rev/2ede53e39955988f98db4369f7ce0961= 4b22104a/gfx/2d/DrawTargetCairo.cpp#936=20 [4] https://searchfox.org/mozilla-central/source/gfx/2d/Blur.cpp#581 [5] = https://searchfox.org/mozilla-central/rev/2ede53e39955988f98db4369f7ce0961= 4b22104a/gfx/2d/DrawTargetD2D1.cpp#306=20 [6] = https://searchfox.org/mozilla-central/rev/2ede53e39955988f98db4369f7ce0961= 4b22104a/gfx/2d/DrawTargetSkia.cpp#765=20 > 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 =E2=80=9CTrue Gaussian Blur=E2=80=9D, like = Moz2D=E2=80=99s implementation. It only uses one CPU core, but is fast = enough for me. I don=E2=80=99t have objections to simply making the background slightly = different on some difficult platforms. --Apple-Mail=_E7D1ADAA-D41D-4159-9D60-E37EC108A6F1 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8
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?

=46rom 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.


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 = =E2=80=9CTrue Gaussian Blur=E2=80=9D, like Moz2D=E2=80=99s = implementation.  It only uses one CPU core, but is fast enough for = me.

I don=E2=80=99t have objections to simply = making the background slightly different on some difficult = platforms.

= --Apple-Mail=_E7D1ADAA-D41D-4159-9D60-E37EC108A6F1--