vpSetImage(3) | Library Functions Manual | vpSetImage(3) |
vpSetImage - specify an image array
#include <volpack.h>
vpResult
vpSetImage(vpc, image, width, height, scan_bytes, pixel_type)
vpSetImage is used to specify a buffer for storing the result image during rendering. The width and height parameters specify the size of the result image. The clipping window (see vpWindow(3) or vpWindowPHIGS(3)) is scaled to exactly match the specified size. The scan_bytes argument specifies the size of a scanline in the image array, in bytes. This argument can be used to add padding to the end of each scanline to satisfy alignment restrictions (e.g. raster operations sometimes require the beginning of each scanline to lie on a word boundary). The pixel_type argument specifies the format of a pixel. The following formats are supported:
The formats VP_LUMINANCE and VP_LUMINANCEA may only be used with grayscale shaders (the color_channels argument to vpSetLookupShader must be 1, or if you are using a callback function for shading you must use the VP_GRAY_SHADE_FUNC argument to vpSetCallback). The formats VP_RGB, VP_RGBA, VP_BGR and VP_ABGR may only be used with color shaders. The format VP_ALPHA may be used with either type of shader.
The size of the image array must be:
The scan_bytes argument must be at least width times the number of bytes per pixel. Pixels in a horizontal scanline are packed next to each other, regardless of the size of the pixel. Any extra padding bytes at the end of a scanline are not modified.
The alpha channel may be used to composite the rendered image against a background image. Alpha gives the fraction of the background that is visible through the rendered image (0 for fully visible, 255 for fully obscured). As an example, to change the background color of the image to a solid color C, modify the color of each pixel in the image according to the formula:
The current image array properties can be retrieved with the following state variable codes (see vpGeti(3)): VP_IMAGE, VP_IMAGE_WIDTH, VP_IMAGE_HEIGHT, VP_IMAGE_SCAN_SIZE, VP_PIXEL_TYPE.
The return value is always VP_OK.
VolPack |