1SoOffscreenRenderer(3IV)() SoOffscreenRenderer(3IV)()
2
3
4
6 SoOffscreenRenderer — renders to an off-screen buffer for printing or
7 generating textures
8
10 SoOffscreenRenderer
11
13 #include <Inventor/SoOffscreenRenderer.h>
14
15 enum Components {
16 SoOffscreenRenderer::LUMINANCE
17
18 SoOffscreenRenderer::LUMINANCE_TRANSPARENCY
19
20 SoOffscreenRenderer::RGB
21 SoOffscreenRenderer::RGB_TRANSPARENCY
22
23 }
24
25 Methods from class SoOffscreenRenderer:
26
27 SoOffscreenRenderer(const SbViewportRegion
28 &viewportRegion)
29 SoOffscreenRenderer(SoGLRenderAction *ra)
30 ~SoOffscreenRenderer()
31 static float getScreenPixelsPerInch()
32 static SbVec2s getMaximumResolution()
33 void setComponents(Components components)
34 Components getComponents() const
35 void setViewportRegion(const SbViewportRegion
36 ®ion)
37 const SbViewportRegion & getViewportRegion() const
38 void setBackgroundColor(const SbColor &c)
39 const SbColor & getBackgroundColor() const
40 void setGLRenderAction(const SoGLRenderAction *ra)
41 SoGLRenderAction * getGLRenderAction() const
42 SbBool render(SoNode *scene)
43 SbBool render(SoPath *scene)
44 unsigned char * getBuffer() const
45 SbBool writeToRGB(FILE *fp) const
46 SbBool writeToPostScript(FILE *fp) const
47 SbBool writeToPostScript(FILE *fp, const SbVec2f
48 &printSize) const
49
50
52 This class is used to render into an off-screen buffer to create a
53 printable image or to generate a texture image. It uses X Pixmaps for
54 rendering. Methods are provided to write the buffer to a file, either
55 as an RGB image or an encapsulated PostScript description.
56
58 SoOffscreenRenderer(const SbViewportRegion
59 &viewportRegion)
60 SoOffscreenRenderer(SoGLRenderAction *ra)
61 ~SoOffscreenRenderer()
62 Constructors and destructor. If a render action is passed to the
63 contructor, that action will be used in all subsequent offscreen
64 renderings. Otherwise, an internal instance of an SoGLRenderAction
65 will be maintained with a viewport region set to the on passed in by
66 the constructor.
67
68 static float getScreenPixelsPerInch()
69 Returns the number of pixels per inch (in the horizontal direction)
70 of the current X device screen.
71
72 static SbVec2s getMaximumResolution()
73 Get the maximum supported resolution of the viewport.
74
75 void setComponents(Components components)
76 Components getComponents() const
77 Sets or returns the components to be rendered.
78
79 void setViewportRegion(const SbViewportRegion
80 ®ion)
81 const SbViewportRegion & getViewportRegion() const
82 Sets or returns the viewport region used for rendering. This will
83 NOT be applied to the viewport region of any render action passed
84 in.
85
86 void setBackgroundColor(const SbColor &c)
87 const SbColor & getBackgroundColor() const
88 Sets or returns the background color for rendering.
89
90 void setGLRenderAction(const SoGLRenderAction *ra)
91 SoGLRenderAction * getGLRenderAction() const
92 Set and get the render action to use for rendering. This will return
93 any render action passed in by the caller.
94
95 SbBool render(SoNode *scene)
96 SbBool render(SoPath *scene)
97 Renders the given scene, specified as a node or a path, into an off-
98 screen buffer.
99
100 unsigned char * getBuffer() const
101 Returns the buffer containing the rendered image. The buffer is an
102 array of unsigned characters. Each pixel is stored sequentially by
103 scanline, starting with the lower left corner. The data stored for
104 each pixel is determined by the Components set before rendering.
105 Pixels are stored in RGBA order and are packed without any padding
106 between pixels or scanlines. The buffer is allocated by the off‐
107 screen renderer class and the space is deleted when the instance is
108 destructed.
109
110 SbBool writeToRGB(FILE *fp) const
111 Writes the buffer as a .rgb file to the given file pointer.
112
113 SbBool writeToPostScript(FILE *fp) const
114 SbBool writeToPostScript(FILE *fp, const SbVec2f
115 &printSize) const
116 Writes the buffer as encapsulated PostScript. If a print size is not
117 given, the size of the image in the buffer is adjusted so it is the
118 same as the apparent size of the viewport region on the current
119 device.
120
121
122
123
124 SoOffscreenRenderer(3IV)()