KoPathShape saveOdf and loadOdf oddities

Dmitry Kazakov dimula73 at gmail.com
Fri Jan 23 09:52:51 GMT 2015


The main question here is:

"What is the meaning of KoShape::absoluteTransformation()?"

It has two answers:

1) It is a transformation that applies *to control points of the shape only*
.

Pseudo code for painting in this case looks like that:

QPainterPath path = shape->absoluteTransformation(...).map(shape->path());
gc.setPen(shape->pen());
gc.drawPath(path);


2) It is a transformation that applies *to the entire shape*.

Pseudo code:

gc.setPen(shape->pen());
gc.setTransform(shape->absoluteTransformation(...));
gc.drawPath(shape->path());


Obviously enough the two options generate two completely different results.
Qt's QGraphicsScene uses the second approach. Which one is supposed to be
in flake? If we answer this question, the solution of the original problem
will be quite simple.




On Sun, Jan 18, 2015 at 2:01 PM, Stefano Bonicatti <smjert at gmail.com> wrote:

> 2015-01-18 6:39 GMT+01:00 Thorsten Zachmann <t.zachmann at zagge.de>:
>
>> Hello Stefano,
>> Seems the change of the transformation was done by Jan to help with
>> fixing the
>> bug https://bugs.kde.org/show_bug.cgi?id=280348. Do you have a patch for
>> which
>> I could run cstester to see if it would break anything.
>
>
> Hello, i spoke with Camilla about the issue, the "proposed" patch in this
> mail is not ok because due to that bug the transformation doesn't have to
> be applied to everything, but only to part of the shape, as it is already
> done.
>
> I did some testing with other shapes in Krita and Inkscape/LibreOffice
> (even though i couldn't import their .odg because Krita has problems with
> them), and clearly the problem presents itself only with path shapes,
> because with the other shapes the matrix is used to transform the entire
> shape.
> So either Krita follows how other vector editors works, and then it
> doesn't permit a layer transformation unless it "rasterize" it as an image,
> or Krita has to subclass KoPathShape to change its behaviour.
>
> In both cases KoPathShape has to enforce that when setting a matrix the
> control points has to be mapped to it, as it happens when handling the
> shape with the correct tools.
> This is because as far as i can tell Calligra want to be faithful to how
> the other vector editors work (and correctly load their shapes) and the
> special use is done "only" by Krita.
>
>
> _______________________________________________
> calligra-devel mailing list
> calligra-devel at kde.org
> https://mail.kde.org/mailman/listinfo/calligra-devel
>
>


-- 
Dmitry Kazakov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/calligra-devel/attachments/20150123/153b76bb/attachment.htm>


More information about the calligra-devel mailing list