On Sun, 2023-02-05 at 00:54 +0100, Francesco Pretto wrote:
> PdfPainter:

        Hi,
the first time you wrote about PdfPainterExtensions I recalled my ideas
about the PdfPainter. From my point of view the "base" PdfPainter
should do just what the PDF standard drawing does, to expose all those
APIs in 1:1 manner. After that the "extensions" (or better a
PafPainter, which derives from the PdfPanterBase - or some better name)
can add wrapper functions, which will build on top of the base, adding
higher level API for common operations. It felt like your
PdfPainterExtensions aims to.

>     painter.Text.MoveTo(100, 500);
>     painter.Text.AddText("Test");
>     painter.Text.End();
>     painter.DrawText("Test2", 100, 600, PdfDrawTextStyle::StrikeOut);
>     painter.GraphicsState.SetLineWidth(1);
>     painter.Path.Begin(20, 20);
>     painter.Path.AddArcTo(150, 20, 150, 70, 50);

I understand that your painter.Text subobject follows the PDF standard,
they have the path separated from the text drawing. I'd still
reconsider whether the subobjects and all those "AddSometing()" methods
are needed (the 'Add' prefix of the functions feels unnecessary and
awful to me). Maybe it's just a matter of a habit, I do not know. I
understand that the PDF drawing API is not the same as the other
drawing APIs, the things just do not work the same, thus there is
involved certain learning curve.

I'm missing PdfPainter::/PdfPainterPathContext::getCurrentPath(), it's
needed for some drawing operators. Return it back, please.

That the wrappers/contexts need to access private members of the
PdfPainter makes me feel like not a great API design. The "friend
class..." things should be used in a minimum, from my point of view.
Especially when you want to debug something, the friend classes make
the debugging more complex. There's a reason why you've things private,
you do not want others to touch them.

By the way, what is the reason to repeat in the class definition that
some code is "private:", while you already declared that the current
declaration section is "private:"? Similarly with the "public:"
section. Unneeded redundancy in the code, is it not?

        Bye,
        zyx


_______________________________________________
Podofo-users mailing list
Podofo-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/podofo-users

Reply via email to