| 1 |
NAME SoOffscreenRenderer SoOffRnd SO_OFF_RND_ { |
| 2 |
renders to an off-screen buffer for printing or generating textures |
| 3 |
} |
| 4 |
|
| 5 |
INCLUDE SoOffscreenRenderer.h |
| 6 |
|
| 7 |
DESC { |
| 8 |
This class is used to render into an off-screen buffer to create a |
| 9 |
printable image or to generate a texture image. It uses X Pixmaps for |
| 10 |
rendering. Methods are provided to write the buffer to a file, either |
| 11 |
as an RGB image or an encapsulated PostScript description. |
| 12 |
} |
| 13 |
|
| 14 |
ENUM Components { |
| 15 |
LUMINANCE "", |
| 16 |
LUMINANCE_TRANSPARENCY "", |
| 17 |
RGB "", |
| 18 |
RGB_TRANSPARENCY "" |
| 19 |
} |
| 20 |
|
| 21 |
METHOD "" SoOffscreenRenderer(const SbViewportRegion &viewportRegion) {} |
| 22 |
METHOD CreateAct SoOffscreenRenderer(SoGLRenderAction *ra) {} |
| 23 |
METHOD "" ~SoOffscreenRenderer() { |
| 24 |
Constructors and destructor. If a render action is passed to the contructor, |
| 25 |
that action will be used in all subsequent offscreen renderings. Otherwise, |
| 26 |
an internal instance of an SoGLRenderAction will be maintained with a |
| 27 |
viewport region set to the on passed in by the constructor. |
| 28 |
} |
| 29 |
|
| 30 |
METHOD getScrPixPerInch static float getScreenPixelsPerInch() { |
| 31 |
Returns the number of pixels per inch (in the horizontal direction) of |
| 32 |
the current X device screen. |
| 33 |
} |
| 34 |
|
| 35 |
METHOD getMaxRes static SbVec2s getMaximumResolution() { |
| 36 |
Get the maximum supported resolution of the viewport. |
| 37 |
} |
| 38 |
|
| 39 |
METHOD setComp void setComponents(Components components) {} |
| 40 |
METHOD getComp Components getComponents() const { |
| 41 |
Sets or returns the components to be rendered. |
| 42 |
} |
| 43 |
|
| 44 |
METHOD setVP void setViewportRegion(const SbViewportRegion ®ion) {} |
| 45 |
METHOD getVP const SbViewportRegion &getViewportRegion() const { |
| 46 |
Sets or returns the viewport region used for rendering. This will NOT |
| 47 |
be applied to the viewport region of any render action passed in. |
| 48 |
} |
| 49 |
|
| 50 |
METHOD setBkgCol void setBackgroundColor(const SbColor &c) {} |
| 51 |
METHOD getBkgCol const SbColor & getBackgroundColor() const { |
| 52 |
Sets or returns the background color for rendering. |
| 53 |
} |
| 54 |
|
| 55 |
METHOD setAct void setGLRenderAction(const SoGLRenderAction *ra) {} |
| 56 |
METHOD getAct SoGLRenderAction * getGLRenderAction() const { |
| 57 |
Set and get the render action to use for rendering. This will return |
| 58 |
any render action passed in by the caller. |
| 59 |
} |
| 60 |
|
| 61 |
METHOD rnd SbBool render(SoNode *scene) {} |
| 62 |
METHOD rndPath SbBool render(SoPath *scene) { |
| 63 |
Renders the given scene, specified as a node or a path, into an |
| 64 |
off-screen buffer. |
| 65 |
} |
| 66 |
|
| 67 |
METHOD getBuff unsigned char * getBuffer() const { |
| 68 |
Returns the buffer containing the rendered image. The buffer is an |
| 69 |
array of unsigned characters. Each pixel is stored sequentially by |
| 70 |
scanline, starting with the lower left corner. The data stored for |
| 71 |
each pixel is determined by the Components set before rendering. |
| 72 |
Pixels are stored in RGBA order and are packed without any padding |
| 73 |
between pixels or scanlines. The buffer is allocated by the offscreen |
| 74 |
renderer class and the space is deleted when the instance is destructed. |
| 75 |
|
| 76 |
} |
| 77 |
|
| 78 |
METHOD toRGB SbBool writeToRGB(FILE *fp) const { |
| 79 |
Writes the buffer as a .rgb file to the given file pointer. |
| 80 |
} |
| 81 |
|
| 82 |
METHOD toPS SbBool writeToPostScript(FILE *fp) const {} |
| 83 |
METHOD toPSSize SbBool writeToPostScript(FILE *fp, |
| 84 |
const SbVec2f &printSize) const { |
| 85 |
Writes the buffer as encapsulated PostScript. If a print size is not |
| 86 |
given, the size of the image in the buffer is adjusted so it is the |
| 87 |
same as the apparent size of the viewport region on the current |
| 88 |
device. |
| 89 |
} |