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

Re: [whatwg] [canvas] inner shadows

From: Rik Cabanier <cabanier@gmail.com>
Date: Fri, 23 Nov 2012 15:38:41 -0800
Message-ID: <CAGN7qDB4-3CH8DMcGqpMGch85Ts-jU0zhEax4JAezzchXt2iAQ@mail.gmail.com>
To: Ian Hickson <ian@hixie.ch>
Cc: Tyler Larson <talltyler@gmail.com>, whatwg@whatwg.org
On Fri, Nov 23, 2012 at 2:36 PM, Ian Hickson <ian@hixie.ch> wrote:

> On Fri, 21 Sep 2012, Tyler Larson wrote:
> > On Sep 20, 2012, at 6:49 PM, Ian Hickson <ian@hixie.ch> wrote:
> > > Can't you do this using clip() easily enough? Maybe I'm missing
> > > something important here. Can you elaborate?
> >
> > Here is an example of what I am talking about.
> > http://i.imgur.com/Sy4xM.png
> > Clip would mask something but adding an inner shadow is different and
> > pretty difficult to reproduce when you take into account complex shapes.
> Ah, yeah, I see what you mean. The problem is that the canvas rendering
> model always renders the shadow under the shape, and uses the shape's
> alpha to work out where to paint the shape.
> What we could do is offer control that would change the shadows from
> rendering under the shape to rendering over the shape, or, maybe even
> better, have a mode that only renders the shadows. Then you could achieve
> these effects relatively easily (by clipping to the shape so that the
> shadow only renders inside the shape).

It would still be quite complex to draw an inner shadow this way because
the blur is calculated on the inverse of the shape.
A user will need to draw to another canvas and then 'clear' it to get the

However, I like the fact that this is a primitive that can be used to
create other effects.

> Is this something implementors would be interested in?

It seems like this would be easy for them to implement...
Received on Saturday, 24 November 2012 00:28:20 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:09:17 UTC