1hardcopy_overview(3) Coin hardcopy_overview(3)
2
3
4
6 hardcopy_overview - An overview of the hardcopy support. The main API
7 for HardCopy support in Coin is the abstract class SoVectorizeAction.
8 SoVectorizeAction will extract geometry from an Inventor scene graph,
9 and project the geometry onto a specified page. Since postscript and
10 other vector based file formats do not support z-buffer or depth
11 clipping, all geometry is rendered using a simple painter's algorithm
12 (geometry is sorted based on distance to camera).
13
14 SoVectorizePSAction inherits SoVectorizeAction, and will output a
15 Postscript file.
16
17 Texture-mapped polygons are not supported, since this is not supported
18 by the vector file formats, at least it's not supported in Postscript.
19 Gouraud shading is not supported in the Postscript language (at least
20 not for V2.0), but an approximation is implemeting using an algorithm
21 that divides the triangle into several small (flat-shaded) triangles.
22 The gouraud shading quality (the number of sub-triangles) is controlled
23 by an epsilon value. The gouraud shading function is written by
24 Frederic Delhoume (delhoume (at) ilog.fr), and is free (public domain)
25 software.
26
27 Typical use of SoVectorizePSAction is shown in the following piece of
28 code:
29
30 SoVectorizePSAction * ps = new SoVectorizePSAction;
31 SoVectorOutput * out = ps->getOutput();
32
33 if (!out->openFile("output.ps")) {
34 return -1; // unable to open output file
35 }
36
37 // to enable gouraud shading. 0.1 is a nice epsilon value
38 // ps->setGouraudThreshold(0.1f);
39
40 // clear to white background. Not really necessary if you
41 // want a white background
42 ps->setBackgroundColor(TRUE, SbColor(1.0f, 1.0f, 1.0f));
43
44 // select LANDSCAPE or PORTRAIT orientation
45 ps->setOrientation(SoVectorizeAction::LANDSCAPE);
46
47 // start creating a new page (A4 page, with 10mm border).
48 ps->beginPage(SbVec2f(10.0f, 10.0f), SbVec2f(190.0f, 277.0f));
49
50 // There are also enums for A0-A10. Example:
51 // ps->beginStandardPage(SoVectorizeAction::A4, 10.0f);
52
53 // calibrate so that text, lines, points and images will have the
54 // same size in the postscript file as on the monitor.
55 ps->calibrate(viewer->getViewportRegion());
56
57 // apply action on the viewer scenegraph. Remember to use
58 // SoSceneManager's scene graph so that the camera is included.
59 ps->apply(viewer->getSceneManager()->getSceneGraph());
60
61 // this will create the postscript file
62 ps->endPage();
63
64 // close file
65 out->closeFile();
66
67 delete ps;
68
69 It is also possible to have several viewports and/or layers on a page.
70 This is useful if your application has several layers of geometry, for
71 instance some annotations in 2D on top of a 3D scene graph. To create
72 several layers, the beginViewport() and endViewport() functions can be
73 used.
74
75 Since
76 Coin 2.1
77
78 TGS provides HardCopy support as a separate extension for TGS
79 Inventor.
80
81Version 2.5.0 Wed Jul 20 2022 hardcopy_overview(3)