1vpSetImage(3)              Library Functions Manual              vpSetImage(3)
2
3
4

NAME

6       vpSetImage - specify an image array
7

SYNOPSIS

9       #include <volpack.h>
10
11       vpResult
12       vpSetImage(vpc, image, width, height, scan_bytes, pixel_type)
13           vpContext *vpc;
14           unsigned char *image;
15           int width, height;
16           int scan_bytes;
17           int pixel_type;
18

ARGUMENTS

20       vpc    VolPack context from vpCreateContext.
21
22       image  2D array for storing result images.
23
24       width  Width of image in pixels.
25
26       height Height of image in pixels.
27
28       scan_bytes
29              Number of bytes per scanline in image array.
30
31       pixel_type
32              Code indicating the format of each pixel in the array.
33

DESCRIPTION

35       vpSetImage  is  used  to  specify a buffer for storing the result image
36       during rendering.  The width and height parameters specify the size  of
37       the  result  image.   The clipping window (see vpWindow(3) or vpWindow‐
38       PHIGS(3))  is  scaled  to  exactly  match  the  specified  size.    The
39       scan_bytes  argument  specifies  the  size  of  a scanline in the image
40       array, in bytes.  This argument can be used to add padding to  the  end
41       of  each scanline to satisfy alignment restrictions (e.g. raster opera‐
42       tions sometimes require the beginning of each scanline to lie on a word
43       boundary).   The  pixel_type  argument specifies the format of a pixel.
44       The following formats are supported:
45
46       VP_ALPHA
47              Each pixel is one byte and contains an 8-bit alpha channel (con‐
48              taining an opacity or coverage value for the pixel).
49
50       VP_LUMINANCE
51              Each  pixel  is  one byte and contains an 8-bit grayscale inten‐
52              sity.
53
54       VP_LUMINANCEA
55              Each pixel is two bytes and contains an 8-bit  grayscale  inten‐
56              sity followed by an 8-bit alpha channel.
57
58       VP_RGB Each  pixel  is  three  bytes  and  contains  an  RGB  color  (8
59              bits/channel).  The R channel is stored first, followed by G and
60              then B.
61
62       VP_RGBA
63              Each  pixel  is  four  bytes  and contains an RGBA color with an
64              alpha channel (8 bits/channel).  The R channel is stored  first,
65              followed by G, B and A.
66
67       VP_BGR Each  pixel  is  three  bytes  and  contains  an  RGB  color  (8
68              bits/channel).  The B channel is stored first, follow by  G  and
69              then R.
70
71       VP_ABGR
72              Each  pixel  is  four  bytes  and contains an RGBA color with an
73              alpha channel (8 bits/channel).  The A channel is stored  first,
74              followed by B, G and R.
75
76       The  formats  VP_LUMINANCE  and  VP_LUMINANCEA  may  only  be used with
77       grayscale shaders (the  color_channels  argument  to  vpSetLookupShader
78       must be 1, or if you are using a callback function for shading you must
79       use the VP_GRAY_SHADE_FUNC argument  to  vpSetCallback).   The  formats
80       VP_RGB,  VP_RGBA,  VP_BGR  and  VP_ABGR  may  only  be  used with color
81       shaders.  The format VP_ALPHA may be used with either type of shader.
82
83       The   size   of   the   image   array   must    be:    unsigned    char
84       image[height][scan_bytes];  The  scan_bytes  argument  must be at least
85       width times the number of bytes per  pixel.   Pixels  in  a  horizontal
86       scanline  are  packed next to each other, regardless of the size of the
87       pixel.  Any extra padding bytes at the end of a scanline are not  modi‐
88       fied.
89
90       The alpha channel may be used to composite the rendered image against a
91       background image.  Alpha gives the fraction of the background  that  is
92       visible  through the rendered image (0 for fully visible, 255 for fully
93       obscured).  As an example, to change the background color of the  image
94       to a solid color C, modify the color of each pixel in the image accord‐
95       ing to the formula: color(x,y) += C * (1 - alpha(x,y)/255)
96

STATE VARIABLES

98       The current image array properties can be retrieved with the  following
99       state   variable   codes  (see  vpGeti(3)):  VP_IMAGE,  VP_IMAGE_WIDTH,
100       VP_IMAGE_HEIGHT, VP_IMAGE_SCAN_SIZE, VP_PIXEL_TYPE.
101

ERRORS

103       The return value is always VP_OK.
104

SEE ALSO

106       VolPack(3), vpCreateContext(3), vpRenderRawVolume(3)
107
108
109
110VolPack                                                          vpSetImage(3)
Impressum