W3C home > Mailing lists > Public > www-style@w3.org > February 2009

Re: [CSSWG] Minutes and Resolutions 2009-02-04: box-shadow and border-image

From: Brad Kemper <brad.kemper@gmail.com>
Date: Thu, 12 Feb 2009 22:54:19 -0800
Cc: "www-style@w3.org" <www-style@w3.org>
Message-Id: <608D33E7-2C15-411D-8DEF-8F76EAE3334C@gmail.com>
To: fantasai <fantasai.lists@inkedblade.net>


On Feb 12, 2009, at 5:22 PM, fantasai wrote:

> David Hyatt wrote:
>>>    ..and then clip out the padding-box from that, which ordinarily
>>>    would not have a shadow from the border cast onto it (or does  
>>> this
>>>    shadow still get drawn behind the padding box?)...
>>>
>>>
>>> You build the element's mask, then you build the shadow, then you  
>>> cut the mask out of the shadow by painting alpha=0 with the  
>>> "source" Porter-Duff operator using the element's mask as the  
>>> mask. The alpha values of the cut-out shadow will be the shadow  
>>> alpha value multiplied by (1 - the mask alpha value). So no shadow  
>>> will draw under the padding-box.
>> I think Brad's point is that no shadow should appear under the  
>> original location of the padding box either.  It's a given that the  
>> shadow itself when offset will contain only transparent pixels in  
>> its own offset padding area, but the offset "border" portion of the  
>> shadow should also not appear behind the original padding box.
>> Basically you clip out the original padding box from any drawing  
>> you do right up front just as with normal box shadow, and then  
>> build/paint the shadow as you suggested.
>
> I think, actually, that you don't want to clip out the padding-box  
> area
> if, e.g. the middle part of the image is being used. In the cases  
> where
> the border image describes a non-rectangular shape, the padding edge  
> will
> not really have a graphical meaning, and you'll need to either fill  
> the
> entire internal part of the image with a background pattern or leave  
> it
> wholly transparent.

Its easy to see why the padding box should be clipped out of the  
padding box if you imagine the rectangular picture frame being  
substituted for a border of the same thickness. I would expect, in  
that simplest of cases, that the shadow would be in the same place,  
that is, outside the border, and not casting into the padding box.  
That is also what I would get if building the shadows manually in  
PhotoShop, unless I left some space between the image and the padding  
box for the shadow to appear (if that's what I wanted).

For more complex shapes (non-rectangles), I may or may not want them  
clipped by an inner shape. I can always leave a space for the shadow  
on the inner edge if that is what I am looking for. Or if the  
background of the box is solid, I can simulate it extending into the  
shadow, either above or below the rest of the border.
Received on Friday, 13 February 2009 06:54:59 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:16 GMT