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