KoPathShape saveOdf and loadOdf oddities

C. Boemann cbo at boemann.dk
Sat Jan 17 12:43:46 GMT 2015


On Saturday 17 January 2015 09:58:28 Stefano Bonicatti wrote:
> Hello, we have a problem in Krita with drawing a polygon or a bezier curve
> (or basicly anything that uses KoPathShape) in a vector layer, then
> transform it so that the lines increase their thickness, then save the file
> in .kra format and then reload it: the thickness is not kept.
> I've found that this is because loadOdf does something different than
> saveOdf when loading and i don't get why.
> First it only loads some attributes back, then it checks for some specific
> element names (and in my tests i never entered in those ifs), then the
> transformation matrix is baked into the viewbox and the path geometry only,
> while the stroke is kept unchanged.
> This is wrong though because the original transformation, before saving,
> changed also the stroke thickness.
> Why baking the matrix into the path geometry only? Why loadOdf doesn't just
> do the "opposite" of what saveOdf do?
> 
> I tried replicating what saveOdf does writing simply this:
> 
> Q_D(KoPathShape);
> loadOdfAttributes(element, context, OdfAllAttributes | OdfViewbox);
> KoPathShapeLoader loader(this);
> loader.parseSvg(element.attributeNS(KoXmlNS::svg, "d"), true);
> d->loadNodeTypes(element);
> loadOdfAttributes(element, context, OdfCommonChildElements);
> loadText(element, context);
> 
> as a replacement for loadOdf and it works as expected.
> Though not being 100% that this doesn't give problems somewhere else, i'm
> writing here for clues.
I tried: creating - increasing thickness - save as odf then load it back. In 
words the thickness is preserved - so i don't think it's as bad as you say. 
However the line ending is not preserved

maybe it's part of the same issue - but i would be very cautious of changing 
the loadOdf - iirc it was fine tuned to load files created by other applications

still something fishy is going on so i would think it more likely that we need 
to change the save method




More information about the calligra-devel mailing list