W3C home > Mailing lists > Public > whatwg@whatwg.org > September 2012

Re: [whatwg] [canvas] inner shadows

From: Rik Cabanier <cabanier@gmail.com>
Date: Sat, 22 Sep 2012 02:49:41 +0200
Message-ID: <CAGN7qDDwnd0x0SFgbbmWToyfEmi1oVKcnu_hgP6KhU-o1jyXaQ@mail.gmail.com>
To: Ian Hickson <ian@hixie.ch>
Cc: Tyler Larson <talltyler@gmail.com>, whatwg@whatwg.org
With both types of shadow, you take the shape of the element and calculate
the blur image.

With an outer shadow, you take the result of the blur and composite it.
After this, you composite the original shape.
With an inner shadow, you draw the shape first followed by the blur image.
Importantly, the blur image also needs to clipped by the shape before it is
composited.

A user could implement an inner shadow by drawing multiple times and using
existing canvas methods, but it would be a pain...

On Fri, Sep 21, 2012 at 12:49 AM, Ian Hickson <ian@hixie.ch> wrote:

> On Thu, 26 Apr 2012, Tyler Larson wrote:
> >
> > Shadows can be applied to the outside of anything. This is a great
> > feature that is otherwise rather difficult to recreate but why not
> > enable users to be able to have inner shadows? Things like beveling,
> > embossing and many other stylistic things that are used in today designs
> > rely on inner shadows.
> > http://www.whatwg.org/specs/web-apps/current-work/#shadows
> >
> > It could just be a boolean value noting if rendering is done to the
> > inside or the outside of what is currently drawn into the context. In
> > CSS we have inset box-shadows, which gives a similar effect.
> > http://www.w3.org/TR/css3-background/#the-box-shadow
> >
> > Can we add this to the canvas shadows please?
>
> Can't you do this using clip() easily enough? Maybe I'm missing something
> important here. Can you elaborate?
>
> --
> Ian Hickson               U+1047E                )\._.,--....,'``.    fL
> http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
> Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
>
Received on Saturday, 22 September 2012 00:50:23 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:45 UTC