Re: [whatwg] [canvas] inner shadows

2012-11-24 Thread Glenn Maynard
On Fri, Nov 23, 2012 at 11:11 PM, Rik Cabanier caban...@gmail.com wrote: What matters is the shape that is used to calculate the blur (step 1) In your example, that shape is a rectangle so just the rectangle edges will be blurred. That slightly blurred rectangle is then composited with the

Re: [whatwg] [canvas] inner shadows

2012-11-24 Thread Rik Cabanier
On Sat, Nov 24, 2012 at 7:59 AM, Glenn Maynard gl...@zewt.org wrote: On Fri, Nov 23, 2012 at 11:11 PM, Rik Cabanier caban...@gmail.com wrote: What matters is the shape that is used to calculate the blur (step 1) In your example, that shape is a rectangle so just the rectangle edges will be

Re: [whatwg] [canvas] inner shadows

2012-11-24 Thread Rik Cabanier
On Sat, Nov 24, 2012 at 8:36 AM, Ian Hickson i...@hixie.ch wrote: On Sat, 24 Nov 2012, Rik Cabanier wrote: How about the strokes? The example in the OP didn't have them, but you'd have to include them in the fill area. With the new Path objects, you'd just use

Re: [whatwg] [canvas] inner shadows

2012-11-24 Thread Rik Cabanier
On Fri, Nov 23, 2012 at 10:30 PM, Ian Hickson i...@hixie.ch wrote: On Fri, 23 Nov 2012, Rik Cabanier wrote: On Fri, Nov 23, 2012 at 8:58 PM, Ian Hickson i...@hixie.ch wrote: On Fri, 23 Nov 2012, Rik Cabanier wrote: Turns out it's relatively easy to do today in canvas; after you've

Re: [whatwg] [canvas] inner shadows

2012-11-24 Thread Ian Hickson
On Sat, 24 Nov 2012, Rik Cabanier wrote: How about the strokes? The example in the OP didn't have them, but you'd have to include them in the fill area. With the new Path objects, you'd just use addPathByStrokingPath(), which would be relatively simple. Unfortunately the winding

Re: [whatwg] [canvas] inner shadows

2012-11-24 Thread Rik Cabanier
On Sat, Nov 24, 2012 at 8:21 AM, Rik Cabanier caban...@gmail.com wrote: On Sat, Nov 24, 2012 at 7:59 AM, Glenn Maynard gl...@zewt.org wrote: On Fri, Nov 23, 2012 at 11:11 PM, Rik Cabanier caban...@gmail.comwrote: What matters is the shape that is used to calculate the blur (step 1) In your

Re: [whatwg] [canvas] inner shadows

2012-11-23 Thread Ian Hickson
On Fri, 21 Sep 2012, Tyler Larson wrote: On Sep 20, 2012, at 6:49 PM, Ian Hickson i...@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

Re: [whatwg] [canvas] inner shadows

2012-11-23 Thread Rik Cabanier
On Fri, Nov 23, 2012 at 2:36 PM, Ian Hickson i...@hixie.ch wrote: On Fri, 21 Sep 2012, Tyler Larson wrote: On Sep 20, 2012, at 6:49 PM, Ian Hickson i...@hixie.ch wrote: Can't you do this using clip() easily enough? Maybe I'm missing something important here. Can you elaborate? Here

Re: [whatwg] [canvas] inner shadows

2012-11-23 Thread Dirk Schulze
On Nov 23, 2012, at 2:36 PM, Ian Hickson i...@hixie.ch wrote: On Fri, 21 Sep 2012, Tyler Larson wrote: On Sep 20, 2012, at 6:49 PM, Ian Hickson i...@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

Re: [whatwg] [canvas] inner shadows

2012-11-23 Thread Ian Hickson
On Fri, 23 Nov 2012, Ian Hickson wrote: On Fri, 21 Sep 2012, Tyler Larson wrote: On Sep 20, 2012, at 6:49 PM, Ian Hickson i...@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

Re: [whatwg] [canvas] inner shadows

2012-11-23 Thread Glenn Maynard
On Fri, Sep 21, 2012 at 7:49 PM, Rik Cabanier caban...@gmail.com wrote: 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

Re: [whatwg] [canvas] inner shadows

2012-11-23 Thread Rik Cabanier
On Fri, Nov 23, 2012 at 3:47 PM, Glenn Maynard gl...@zewt.org wrote: On Fri, Sep 21, 2012 at 7:49 PM, Rik Cabanier caban...@gmail.com wrote: 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

Re: [whatwg] [canvas] inner shadows

2012-11-23 Thread Ian Hickson
On Fri, 23 Nov 2012, Rik Cabanier wrote: 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 inverse. Turns out it's much easier than that; see

Re: [whatwg] [canvas] inner shadows

2012-11-23 Thread Rik Cabanier
On Fri, Nov 23, 2012 at 4:03 PM, Ian Hickson i...@hixie.ch wrote: On Fri, 23 Nov 2012, Rik Cabanier wrote: 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

Re: [whatwg] [canvas] inner shadows

2012-11-23 Thread Ian Hickson
On Fri, 23 Nov 2012, Rik Cabanier wrote: On Fri, Nov 23, 2012 at 4:03 PM, Ian Hickson i...@hixie.ch wrote: On Fri, 23 Nov 2012, Rik Cabanier wrote: 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

Re: [whatwg] [canvas] inner shadows

2012-11-23 Thread Ian Hickson
On Fri, 23 Nov 2012, Rik Cabanier wrote: Turns out it's relatively easy to do today in canvas; after you've drawn your shape and filled it, just add the following code: c.save(); c.clip(); c.moveTo(0,0); c.lineTo(0,height); c.lineTo(width,height);

Re: [whatwg] [canvas] inner shadows

2012-11-23 Thread Rik Cabanier
On Fri, Nov 23, 2012 at 8:58 PM, Ian Hickson i...@hixie.ch wrote: On Fri, 23 Nov 2012, Rik Cabanier wrote: Turns out it's relatively easy to do today in canvas; after you've drawn your shape and filled it, just add the following code: c.save(); c.clip(); c.moveTo(0,0);

Re: [whatwg] [canvas] inner shadows

2012-11-23 Thread Rik Cabanier
On Fri, Nov 23, 2012 at 3:57 PM, Ian Hickson i...@hixie.ch wrote: On Fri, 23 Nov 2012, Ian Hickson wrote: On Fri, 21 Sep 2012, Tyler Larson wrote: On Sep 20, 2012, at 6:49 PM, Ian Hickson i...@hixie.ch wrote: Can't you do this using clip() easily enough? Maybe I'm missing something

Re: [whatwg] [canvas] inner shadows

2012-11-23 Thread Ian Hickson
On Fri, 23 Nov 2012, Rik Cabanier wrote: On Fri, Nov 23, 2012 at 8:58 PM, Ian Hickson i...@hixie.ch wrote: On Fri, 23 Nov 2012, Rik Cabanier wrote: Turns out it's relatively easy to do today in canvas; after you've drawn your shape and filled it, just add the following code:

Re: [whatwg] [canvas] inner shadows

2012-09-21 Thread Rik Cabanier
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,

Re: [whatwg] [canvas] inner shadows

2012-09-20 Thread Ian Hickson
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

[whatwg] [canvas] inner shadows

2012-04-26 Thread Tyler Larson
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

Re: [whatwg] [canvas] inner shadows

2012-04-26 Thread David Geary
You can specify negative shadow offsets for shadows inside a shape. Is that not good enough? david On Thursday, April 26, 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