Idea for solving shadow overlap issue

jaham at gmx.net jaham at gmx.net
Tue Apr 19 19:42:02 BST 2011


On Tuesday 19 April 2011 10:55:24 Yue Liu wrote:
> Hello,
> 
> To solve the shadow-overlap-other-shapes issue, I got an idea but not sure
> whether it is done right.
> The problem currently is, if we add shadow to a stencil(which is a shape
> group), shadows to the child shape would overlap each other. Even if we put
> all the shadows behind the child shapes, the intersection of two blured
> shadows would change the weight that the outer shadow of the stencil should
> have.
> So my plan is to change something in KoShapeShadow, KoShapeGroup and
> KoShapeManager.
> 
> I want to introduce draw:shadow as an available style to the <draw:g>
> element.

If that is not allowed in the odf specification you can't use the draw 
namespace.

> The result to the user would be: when a group is selected, shadow will only
> apply to the group as a whole, if user want all the child shapes inside the
> group to have their own shadows, the user have to ungroup and select all
> the child shapes, then add shadow and re-group.
> 
> First something should be changed in shapeManager->selection or
> KoShapeShadow, so that when adding shadow to a group, shadow is only added
> to the top-level shape, that is the group.

The shape manager or rather KoSelection already has support for that. 
KoSelection::selectedShapes(KoFlake::TopLevelSelection) should do the trick.

> When drawing a shadow, first check if the selected shape is a group. If it
> is, a clip region that capable of holding the whole group is created, then
> background and borders to all the child shapes are painted to the clip
> region in the shadow color. If blur effect is used, the clip region would
> be blured before painted to the canvas.
> 
> To decide the size of the clip region the size value to the KoShapeGroup
> should not be 0, if that cause a problem in other codes we can add a
> contentSize variant.

I don't know why the shape group was changed to always have a size of zero. If 
other code has problems with the group reporting its correct size, than that 
code has to be fixed. imho.

> 
> The idea solved the problem I met and won't change the correct alpha value
> to the blured shadow.
> 
> What do you think about it?

I think the biggest obstacle (as often) is to work around the odf 
specification.

Ciao Jan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/calligra-devel/attachments/20110419/fc6c0ffa/attachment.htm>


More information about the calligra-devel mailing list