Re: Proposed module for pen plotters: Graphics::Penplotters::GcodeXY
[email protected] (David Mertens) Thu, 21 Aug 2025 12:14:46 -0400
| Newsgroups | perl.module-authors |
|---|---|
| Message-ID | <CA+4ieYX2qW+86iPT4Ykhty6WLvKtbXtmMhUg9S3-B_q1v6QmMw@mail.gmail.com> |
--00000000000001d8d0063ce264cf Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable It's probably too late in the process for this, but you should know that the Perl-only GUI toolkit Prima---which is amazing!---has very similar primitives under the Prima::Drawable interface. I would encourage you to look for ways to interact with Prima. One way would be to make your interface align with Prima's in a duck-typed way so that the same sequence of methods could be called on a Prima Drawable or one of your plotter objects. Dmitry is amazing. If you can find a way to collaborate, it would totally be worth your time. David "Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." -- Brian Kernighan On Thu, Aug 21, 2025, 8:37=E2=80=AFAM Albert Koelmans via module-authors < [email protected]> wrote: > I am planning to contribute a (2D) graphics library for pen plotters. Thi= s > seems to fill a hole in CPAN - I can't find any support for pen plotters > there. > > I want to call this Graphics::Penplotter::GcodeXY, partly because it will > make it easier for pen plotter users to find it. > > Gcode is the command language for pen plotters. This language was > originally designed for 3D milling machines. Pen plotters use just one > plane, hence the XY. > > Pen plotters need a separate graphics library because pen plotters > generate line segments rather than pixels. This means that the graphics > engine is quite different. You don't need Bresenham's algorithm, for > example. > > In its current state, the library offers the following: > - the usual graphics primitives: line, rectangle, circle, ellipse, > polygon, arc, arrowhead, bezier curves of any order. Most have variants, > including rounded corners; > - transformations (like in Postscript): translate, scale, rotate, skew, > save and restore graphics state, manipulate the current transformation > matrix; > - SVG import and export; > - design splitting (e.g. split A1 design into four A3 sheets for separate > plotting); > - Postscript output (eps); > - pen movement optimization; > - interface with the vpype software for lots of advanced algorithms; > - font support: set font name and size, add font search paths, calculate > string width; > - hatching (to simulate filled areas). > > To check out the complete perldoc on github: > https://github.com/gamk67/Graphics-Penplotter-GcodeXY > > I would be grateful for any feedback. > > Many thanks > Albert > > --00000000000001d8d0063ce264cf Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"auto"><div>It's probably too late in the process for this, = but you should know that the Perl-only GUI toolkit Prima---which is amazing= !---has very similar primitives under the Prima::Drawable interface. I woul= d encourage you to look for ways to interact with Prima. One way would be t= o make your interface align with Prima's in a duck-typed way so that th= e same sequence of methods could be called on a Prima Drawable or one of yo= ur plotter objects.</div><div dir=3D"auto"><br></div><div dir=3D"auto">Dmit= ry is amazing. If you can find a way to collaborate, it would totally be wo= rth your time.</div><div dir=3D"auto"><br></div><div dir=3D"auto">David</di= v><div><br></div><div data-smartmail=3D"gmail_signature">=C2=A0"Debugg= ing is twice as hard as writing the code in the first place.<br> =C2=A0 Therefore, if you write the code as cleverly as possible, you are,<= br> =C2=A0 by definition, not smart enough to debug it." -- Brian Kernigh= an<br></div></div><br><div class=3D"gmail_quote gmail_quote_container"><div= dir=3D"ltr" class=3D"gmail_attr">On Thu, Aug 21, 2025, 8:37=E2=80=AFAM Alb= ert Koelmans via module-authors <<a href=3D"mailto:[email protected]= rg">[email protected]</a>> wrote:<br></div><blockquote class=3D"gm= ail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-le= ft:1ex"><u></u> =20 =20 =20 <div> <p><font size=3D"4" face=3D"Fira Code">I am planning to contribute a (2D) graphics library for pen plotters. This seems to fill a hole in CPAN - I can't find any support for pen plotters there.= <br> </font></p> <p><font size=3D"4" face=3D"Fira Code">I want to call this Graphics::Penplotter::GcodeXY, partly because it will make it easier for pen plotter users to find it.<br> <br> Gcode is the command language for pen plotters. This language was originally designed for 3D milling machines. Pen plotters use just one plane, hence the XY.<br> <br> Pen plotters need a separate graphics library because pen plotters generate line segments rather than pixels. This means that the graphics engine is quite different. You don't need Bresenham's algorithm, for example.<br> <br> In its current state, the library offers the following:=C2=A0<br> - the usual graphics primitives: line, rectangle, circle, ellipse, polygon, arc, arrowhead, bezier curves of any order. Most have variants, including rounded corners;=C2=A0<br> - transformations (like in Postscript): translate, scale, rotate, skew, save and restore graphics state, manipulate the current transformation matrix;<br> - SVG import and export;<br> - design splitting (e.g. split A1 design into four A3 sheets for separate plotting);<br> - Postscript output (eps);<br> - pen movement optimization;<br> - interface with the vpype software for lots of advanced algorithms;<br> - font support: set font name and size, add font search paths, calculate string width;<br> - hatching (to simulate filled areas).<br> <br> To check out the complete perldoc on github:<br> <a href=3D"https://github.com/gamk67/Graphics-Penplotter-GcodeXY" t= arget=3D"_blank" rel=3D"noreferrer">https://github.com/gamk67/Graphics-Penp= lotter-GcodeXY</a><br> <br> I would be grateful for any feedback.<br> <br> Many thanks<br> Albert<br> </font><br> </p> </div> </blockquote></div> --00000000000001d8d0063ce264cf--