Apache OpenOffice (AOO) Bugzilla – Issue 121437
Custom shape with quadratic Bezier curve (= command Q) does not show the curve
Last modified: 2022-10-28 12:54:29 UTC
Created attachment 80000 [details] quadric bezier curve and screenshot The attached document contains a custom shape with a quadric Bezier curve, which is defined by the command Q. This curve is not drawn. Use the Navigator to see, where the object is located. Right from the shape I have inserted a screenshot, how this shape looks in LibreOffice.
Seams the case QUADRATICCURVE_TO is missing in EnhancedCustomShape2d::CreateSubPath(...) in /main/svx/source/customshapes/EnhancedCustomShape2d.cxx. Is that the only place, where I would need to add something?
ALG: Hi Regina, had no time yet to take a deeper look, but that's the central place to add something, and AFAIK it should be the only one. HTH!
I'll try it.
Created attachment 80008 [details] Example with command Q as first command The file contains a custom shape, which has a Q command as first command. Such file makes no sense, because the start point of the Bezier curve is missing. But such a path is syntactically correct and it should not crash the application.
Created attachment 80009 [details] proposed patch. I uses an equivalent cubic Bezier curve @Armin: Please have a look. If you like it, can you please push it? I have not moved my build to the new location yet.
@Regina: how do you draw such custom shapes with commands? do you use a macro or is it possible in the user interface?
@Ariel: I write it directly into the file. You find a starting description in http://books.evc-cit.info/odbook/custom_shapes_article.odt. I'm considering to make a talk for FOSDEM about that. And playing around for that, I have come across the problem with the command Q in AOO. There is no UI for custom shapes. I have not tried macros yet.
ALG: @Regina: On Monday, I need my weekend :-) You are at Fosdem, Yay! Looking forward to meet...
ALG: @Regina: Looks good to me :-) I would start changing GetPoint to return basegfx:B2DPoint, work on double precision and do the calculations with aControlQ in double, but that's too much before aw080 is in ....) One question: I'm sure you have tested the functionality, but is it correct that aControlA *and* aControlB are both calculated with addition of the needed part of aControlQ, or should for ControlPointB (the one from endpoint) a substraction be used...?
I have tested it and calculated on paper. You find the formula in http://de.wikipedia.org/wiki/B%C3%A9zierkurve#Kubische_Darstellung_quadratischer_B.C3.A9zierkurven. I have only expanded "P0 + 2/3(P12 - PO)" to "1/3 P0 + 2/3 P12".
ALG: Okay, tanks, Regina. Comitted, done. BTW: relocating a CWS unbder svn is quite simple: use 'svn switch https://svn.apache.org/repos/asf/openoffice/trunk/main'. It worked without problems here...
ALG: Commit has rev 1419533
"alg" committed SVN revision 1419533 into trunk: #121437# Added patch from Regina which implements QuadraticBezier segemnts to...