NAME¶
vpGetImage - get a field of the intermediate image
SYNOPSIS¶
#include <volpack.h>
vpResult
vpGetImage(vpc,
image, width, height, scan_bytes, pixel_type,
image_type)
-
- vpContext *vpc;
-
- void *image;
-
- int width, height;
-
- int scan_bytes;
-
- int pixel_type, image_type;
ARGUMENTS¶
- vpc
- VolPack context from vpCreateContext.
- image
- 2D array for storing result image.
- width
- Width of array in pixels.
- height
- Height of array in pixels.
- scan_bytes
- Number of bytes per scanline in array.
- pixel_type
- Code indicating the format of each pixel in the array.
- image_type
- Code indicating the source of the image data
(VP_IMAGE_BUFFER or VP_SHADOW_BUFFER).
DESCRIPTION¶
This is a debugging function. It is used to retrieve the contents of one of the
temporary rendering buffers used during rendering, namely the intermediate
image or the shadow buffer. Rendering consists of two stages: the volume is
resampled and composited into the intermediate image to produce a distorted
volume rendering, and then the intermediate image is warped into the final
image. If shadows are enabled then the shadow buffer is used during the first
stage to incrementally compute which voxels are illuminated by the light
source. This function returns images produced during the first stage, before
the final warp.
This function may be called after a call to one of the rendering routines (see
vpRenderRawVolume(3)). If the
image_type argument is VP_IMAGE_BUFFER
then data will be copied from the intermediate image. The
pixel_type
argument specifies what information to copy and the format for storing the
data in the output array. The possible values for
pixel_type are the
same as for the
pixel_type argument to
vpSetImage. For instance,
use VP_LUMINANCE to extract the grayscale intensity (assuming the current
shader produces grayscale pixels).
If the
image_type argument is VP_SHADOW_BUFFER then data will be copied
from the shadow buffer. The only valid option for
pixel_type is
VP_ALPHA, since no color information is stored in the shadow buffer.
See
vpSetImage for details on the pixel formats, the layout of the output
array, and the remaining arguments.
To find the required size for the result array, use
vpGeti with the
VP_INTERMEDIATE_WIDTH and VP_INTERMEDIATE_HEIGHT options (when
image_type is VP_IMAGE_BUFFER) or the VP_SHADOW_WIDTH and
VP_SHADOW_HEIGHT options (when
image_type is VP_SHADOW_BUFFER).
ERRORS¶
The normal return value is VP_OK. The following error return values are
possible:
- VPERROR_BAD_SIZE
- The destination array size is incorrect or there is no
intermediate image.
- VPERROR_BAD_OPTION
- The field argument is invalid.
SEE ALSO¶
VolPack(3), vpRenderRawVolume(3), vpGeti(3)