hardcopy(3)

πŸ“¦ version 3.1.3, in fedora 43, fedora 44

πŸ’– hardcopy β€” Vectorized Printing Classes πŸ’–

ok so bestie, listen. this is the whole entire hardcopy(3) page from the Coin library, and it's literally about printing your 3D scene as vectors instead of squishy pixels. no cap. let's go. ✨


🌈 SYNOPSIS 🌈

πŸŽ€ Classes πŸŽ€

  • class SoHardCopy β€” bestie this one is a static class and all it does is initialize the hardcopy support. it's the bouncer at the door. it doesn't do much else. πŸ’…
  • class SoPSVectorOutput β€” this one writes Postscript. that's the whole job. iconic.
  • class SoVectorOutput β€” this one sets the vector output file. the file-setter, the vibe-setter.
  • class SoVectorizeAction β€” the base class for vectorizing Coin scene graphs. everything else is built off this queen. πŸ‘‘
  • class SoVectorizePSAction β€” renders to a Postscript file. the one you'll actually be using, fr fr.

πŸ¦‹ Detailed Description πŸ¦‹

okay so the whole point of the vectorized printing classes is: rendering to vector devices instead of raster devices. why do you care? because you can use this to generate scalable PostScript images for printing β€” instead of raster images that get all crusty and pixellated the second you scale them up. 😭 scalable. printing. periodt.

see below for A HardCopy Overview. πŸ’–

✨ A HardCopy Overview ✨

the main API for HardCopy support in Coin is the abstract class SoVectorizeAction. SoVectorizeAction extracts geometry from an Inventor scene graph and projects that geometry onto a specified page. and because postscript and other vector-based file formats do not support z-buffer or depth clipping, all geometry gets rendered using a simple painter's algorithm β€” meaning geometry is sorted based on distance to camera. that's just how it is, bestie. 🀷

SoVectorizePSAction inherits SoVectorizeAction, and it outputs a Postscript file. cute.

heads up!! texture-mapped polygons are not supported, because the vector file formats don't support them β€” at least, it's not supported in Postscript. Gouraud shading is also not supported in the Postscript language (at least not for V2.0), but an approximation is implemented using an algorithm that divides the triangle into several small (flat-shaded) triangles. the gouraud shading quality β€” that's the number of sub-triangles β€” is controlled by an epsilon value. the gouraud shading function is written by Frederic Delhoume (delhoume (at) ilog.fr), and it's free (public domain) software. shoutout. 🫢

typical use of SoVectorizePSAction is shown in the following piece of code, and honestly? study it. it's giving main character energy. 🌸

SoVectorizePSAction * ps = new SoVectorizePSAction;
SoVectorOutput * out = ps->getOutput();

if (!out->openFile("output.ps")) {
  return -1; // unable to open output file
}

// to enable gouraud shading. 0.1 is a nice epsilon value
// ps->setGouraudThreshold(0.1f);

// clear to white background. Not really necessary if you
// want a white background
ps->setBackgroundColor(TRUE, SbColor(1.0f, 1.0f, 1.0f));

// select LANDSCAPE or PORTRAIT orientation
ps->setOrientation(SoVectorizeAction::LANDSCAPE);

// start creating a new page (A4 page, with 10mm border).
ps->beginPage(SbVec2f(10.0f, 10.0f), SbVec2f(190.0f, 277.0f));

// There are also enums for A0-A10. Example:
// ps->beginStandardPage(SoVectorizeAction::A4, 10.0f);

// calibrate so that text, lines, points and images will have the
// same size in the postscript file as on the monitor.
ps->calibrate(viewer->getViewportRegion());

// apply action on the viewer scenegraph. Remember to use
// SoSceneManager's scene graph so that the camera is included.
ps->apply(viewer->getSceneManager()->getSceneGraph());

// this will create the postscript file
ps->endPage();

// close file
out->closeFile();

delete ps;

also!! it is also possible to have several viewports and/or layers on a page. this is useful if your application has several layers of geometry β€” for instance, some annotations in 2D on top of a 3D scene graph. to create several layers, the beginViewport() and endViewport() functions can be used. layers on layers on layers. 🧚

🌟 Since 🌟

  • Coin 2.1
  • TGS provides HardCopy support as a separate extension for TGS Inventor.

πŸ’œ Author πŸ’œ

Generated automatically by Doxygen for Coin from the source code. (yes, a robot wrote it. the robot ate. πŸ’…)


and that's the whole page bestie, mwah πŸŽ€ β€” this was hardcopy(3) from Coin, Version 3.1.3. go forth and vectorize responsibly. πŸ’–βœ¨πŸ¦‹

πŸ“¦ where this page comes from