Shape shadows

Inge Wallin inge at lysator.liu.se
Wed May 2 18:34:53 BST 2012


On Wednesday, May 02, 2012 06:02:57 Thorsten Zachmann wrote:
> On Wednesday, May 02, 2012 12:16:34 AM Inge Wallin wrote:
> > https://bugs.kde.org/show_bug.cgi?id=260535 has the title:
> > 
> > kpresenter:openoffice:Shadow of the picture is not getting displayed.
> > 
> > I had a look at this, and the reason is the following code in void
> > KoShapeShadow::Private::paintShadow() at line 86 in
> > 
> > libs/flake/KoShapeShadow.cpp:
> >     if (shape->background()) {
> >     
> >         painter.save();
> >         KoShape::applyConversion(painter, converter);
> >         painter.setBrush(QBrush(color));
> >         QPainterPath path(shape->outline());
> >         KoPathShape * pathShape = dynamic_cast<KoPathShape*>(shape);
> >         if (pathShape)
> >         
> >             path.setFillRule(pathShape->fillRule());
> >         
> >         painter.drawPath(path);
> >         painter.restore();
> >     
> >     }
> > 
> > There is a similar test for stroke right behind it.
> > 
> > This means that only shapes with a defined background can ever get a
> > shadow. I don't really see the reason for this.  Shouldn't it be enough
> > to remove the test to make it work everywhere? What would be the
> > drawbacks?
> 
> That means we only draw a shadow for the background if there is actually a
> background. E.g. if there is a shape that only has a outline only a shadow
> for the outline will be draw. This is done by the code in the test for the
> stroke. So if that would be changed also e.g. a polygon would show a
> background.

Yes, I know what it means.  My question was really why it is so from the 
beginning.  What is the thinking behind only drawing a shadow if there is a 
stroke and/or fill (a.k.a background)?  I think Yue should comment because he 
is the guy who wrote it.

> I see the problem is that the picture shape has no background and therefore
> this fails. One idea would be to add a method to test if there is a shadow
> for the shape background the would in KoShape test if shape->background is
> set and return true in case it is a picture shape. But maybe others have a
> better idea. However that might fail in case the image has transparency at
> the edges. Not sure if that is something we need to support.

We could have such a method but what I am not sure of the connection between 
the background and the shadow.  In my eyes, if a user wants a shadow he should 
have the shadow no matter what the shape contains.

Opinions?

> Thorsten
> _______________________________________________
> calligra-devel mailing list
> calligra-devel at kde.org
> https://mail.kde.org/mailman/listinfo/calligra-devel



More information about the calligra-devel mailing list