Games:...g2TkPs(3pm)

πŸ“¦
version 4.252 Β· 3 versions
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble

πŸ’… Games:...g2TkPs πŸ’…

okay bestie so this is a page from the User Contributed Perl Documentation collection, and it's about Games::Go::Sgf2Dg::Dg2TkPs, which is a whole mouthful, i know. it's a Perl module, it lives in the 3pm section, and it's giving "i was thrown together in an afternoon and i know it." 🫢


✨ NAME ✨

Games::Go::Sgf2Dg::Dg2TkPs β€” the module that converts Games::Go::Sgf2Dg::Diagrams to PostScript, straight out of a Tk window. πŸŽ€


🌸 SYNOPSIS 🌸

here's the whole vibe, copy-paste ready:

use Games::Go::Sgf2Dg::Dg2TkPs

 my $dg2ps = B<Games::Go::Sgf2Dg::Dg2TkPs-E<gt>new> (options);
 my $canvas = $dg2ps->convertDiagram($diagram);

πŸ¦‹ DESCRIPTION πŸ¦‹

ngl bestie, this is a real hack. like, the whole entire point is to get PostScript output out of the Dg2Tk converter, and all it actually does is lean on the built-in PostScript that a Tk::Canvas widget already hands you, then use that to convert the Dg2Tk canvas pages into PostScript. that's it. that's the trick. πŸ’€

so obviously the resulting PostScript is fairly crude β€” because the Canvas it's drawn from was crude to begin with. it's giving "we worked with what we had." if you want a better PostScript converter, go look at Games::Go::Sgf2Dg::Dg2Ps instead, that one's the main character. πŸ‘‘

a Games::Go::Sgf2Dg::Dg2TkPs inherits from Games::Go::Sgf2Dg::Dg2Tk, and it uses all of its methods and options. the main difference is that once the conversion to Tk is done, each diagram Tk::Canvas gets converted to PostScript via the Tk::Canvas->postscript method. then some minor massaging of the PostScript source happens, to string all the canvas pages together. slay. ✨


πŸ’– METHODS πŸ’–

for the usual Dg2* conversion methods, go peek at Dg2Tk β€” that's where the classics live. the ones specific to this module are:

  • $dg2ps->comment ($comment ? , ... ?) β€” drops comments into the PostScript source code. but heads up 🚨 because the PostScript only gets generated after all the diagrams are constructed by Dg2Tk, the comments are likely to be out of order β€” they'll all end up sitting at the head of the PostScript file. iconic placement, honestly.
  • $dg2ps->configure (option => value, ?...?) β€” grabs the 'file' configuration option for itself, and passes every other request straight through to Dg2Tk. teamwork 🫢
  • $dg2ps->close β€” converts each diagram Tk::Canvas in the Dg2Tk NoteBook to PostScript, via the Tk::Canvas->postscript method. the grand finale. πŸŽ†

🌈 SEE ALSO 🌈

  • sgf2dg(1) β€” Script to convert SGF format files to Go diagrams. the OG tool. iykyk. ⭐

πŸ™ˆ BUGS πŸ™ˆ

okay so the output is pretty ugly. fr fr. that's just... what it is. oh well β€” what can you expect from such a simple hack? 😭

bestie, if you're here for pretty PostScript, you're in the wrong repo. no cap.

and that's the whole page πŸ’œ β€” this was perl v5.30.0, dated 2019-10-27, and the page itself goes by Games:...g2TkPs(3pm). mwah, go forth and convert some diagrams, queen 🧚🌸

πŸ“¦ where this page comes from