# The "vc" Package

These routines are meant to provide an abstracted interface to a VX display and colourmaps, used in the kcmap routines.

Library: karmavx
Link With: -lkarmavx

#### Functions

vc_get_dpy_handle | Generate a display handle for later use.
vc_alloc_colours | Allocate colourcells.
vc_free_colours | Free a number of colourcells in a low level colourmap.
vc_store_colours | Store colours into a low level colourmap.
vc_store_colours_24bit | Store colours into a low level colourmap.
vc_get_location | Determine the location of the graphics display being used.
vc_set_visualtype | Set the current visual of the viewable colourmap.
vc_get_visualtype | Get the current visual of the viewable colourmap.

## Functions

Kdisplay vc_get_dpy_handle ()

Generate a display handle for later use.

Parameters:

This function takes no parameters

Returns: A pointer to the display handle on success, else NULL.
Multithreading Level: Unsafe

unsigned int vc_alloc_colours (unsigned int num_cells, unsigned long *pixel_values, unsigned int min_cells, Kdisplay dpy_handle)

This routine will allocate a number of colourcells in a low level colourmap (e.g. using the Xlib routine XAllocColorCells).

Parameters:

- num_cells : The number of colourcells to allocate.
- pixel_values : A pointer to the array where the pixel values allocated will be written.
- min_cells : The minimum number of colourcells to allocate. The routine will try to allocate at least this number of colourcells.
- dpy_handle : The low level display handle. The meaning of this value depends on the lower level graphics library used.

Returns: The number of colourcells allocated.
Multithreading Level: Unsafe

void vc_free_colours (unsigned int num_cells, unsigned long *pixel_values, Kdisplay dpy_handle)

Free a number of colourcells in a low level colourmap.

Parameters:

- num_cells : The number of colourcells to free.
- pixel_values : The array of pixel values (colourcells) to free.
- dpy_handle : The low level display handle. The meaning of this value depends on the lower level graphics library used.

Returns: Nothing.
Multithreading Level: Unsafe

void vc_store_colours (unsigned int num_cells, unsigned long *pixel_values, unsigned short *reds, unsigned short *greens, unsigned short *blues, unsigned int stride, Kdisplay dpy_handle)

Store colours into a low level colourmap.

Parameters:

- num_cells : The number of colourcells to store.
- pixel_values : The array of pixel values.
- reds : The array of red intensity values.
- greens : The array of green intensity values.
- blues : The array of blue intensity values.
- stride : The stride (in unsigned shorts) between intensity values in each array.
- dpy_handle : The low level display handle. The meaning of this value depends on the lower level graphics library used.

Returns: Nothing.
Multithreading Level: Unsafe

void vc_store_colours_24bit (unsigned int num_cells, unsigned long *pixel_values, unsigned short *reds, unsigned short *greens, unsigned short *blues, unsigned int stride, Kdisplay dpy_handle)

This routine will store colours into a low level colourmap. The colours are stored for the DirectColour (24 bit) visual type.

Parameters:

- num_cells : The number of colourcells to store.
- pixel_values : The array of pixel values.
- reds : The array of red intensity values.
- greens : The array of green intensity values.
- blues : The array of blue intensity values.
- stride : The stride (in unsigned shorts) between intensity values in each array.
- dpy_handle : The low level display handle. The meaning of this value depends on the lower level graphics library used.

Returns: Nothing.
Multithreading Level: Unsafe

void vc_get_location (Kdisplay dpy_handle, unsigned long *serv_hostaddr, unsigned long *serv_display_num)

Determine the location of the graphics display being used.

Parameters:

- dpy_handle : The low level display handle. The meaning of this value depends on the lower level graphics library used.
- serv_hostaddr : The Internet address of the host on which the display is running will be written here.
- serv_display_num : The number of the display will be written here.

Returns: Nothing.
Multithreading Level: Unsafe

void vc_set_visualtype (Kdisplay dpy_handle, unsigned int visual, flag overlay)

Set the current visual of the viewable colourmap.

Parameters:

- dpy_handle : The low level display handle.
- visual : The visual type for the canvas. Legal values are: VC_VX_VISUAL_PSEUDOCOLOUR0 8 bits deep (alpha/overlay channel) VC_VX_VISUAL_PSEUDOCOLOUR1 8 bits deep (blue channel) VC_VX_VISUAL_PSEUDOCOLOUR2 8 bits deep (green channel) VC_VX_VISUAL_PSEUDOCOLOUR3 8 bits deep (red channel) VC_VX_VISUAL_DIRECTCOLOUR 24 bits deep
- overlay : If TRUE and PseudoColour channel 0 is NOT selected, the overlay channel is displayed. A non-zero pixel in the overlay channel will override the PseudoColour/DirectColour pixel.

Returns: Nothing.
Multithreading Level: Unsafe
Note:

- PseudoColour channels 1, 2 and 3 occupy the same area of screen memory as the DirectColour channel. When viewing a PseudoColour canvas, the lower appropriate 8 bits are used. When viewing a DirectColour canvas, the lower 24 bits (big endian) are used. Bits 0-7, 8-15 and 16-23 contain the red, green and blue components, respectively.

void vc_get_visualtype (Kdisplay dpy_handle, unsigned int *visual, flag *overlay)

Get the current visual of the viewable colourmap.

Parameters:

- dpy_handle : The low level display handle.
- visual : The visual type for the canvas will be written here.
- overlay : If the overlay channel is visible, the value TRUE will be written here, else the value FALSE will be written here.

Returns: Nothing.
Multithreading Level: Unsafe

Back to Karma Home Page