HomeVDIEscape functionsControl functions

7.9 Colour table functions

v_color2nearest Inquires nearest colour value
v_color2value Translates colour value to pixel value
v_create_ctab Creates colour table
v_create_itab Creates inverse colour table reference
v_ctab_idx2value Inquires colour table value
v_ctab_idx2vdi Translates colour table index to VDI index
v_ctab_vdi2idx Translates VDI colour index to colour table index
v_delete_ctab Deletes colour table
v_delete_itab Deletes inverse colour table reference
v_get_ctab_id Gets unique ID for a new colour table
v_value2color Translates pixel value to colour entry
vq_ctab Inquires current colour table
vq_ctab_entry Inquires colour table entry
vq_ctab_id Inquires current colour table ID
vq_dflt_ctab Inquires default (system) colour table
vq_px_format Inquires pixel format and colour space
vs_ctab Sets colour table
vs_ctab_entry Sets colour value in the colour table
vs_dflt_ctab Sets defaut (system) colour table

See also: VDI workstations   Style guidelines

7.9.1 v_color2nearest

Name: »Inquire Nearest Color Entry«
Opcode: 204 (Sub-Opcode 2)
Syntax: int32_t v_color2nearest( int16_t handle, int32_t color_space, COLOR_ENTRY *color, COLOR_ENTRY *nearest_color );
Description: The call v_color2nearest returns the nearest colour value for the desired COLOR_ENTRY.
Parameter Meaning
   
handle Workstation identifier
color_space Colour space (at present only 0 for the colour space set, or CSPACE_RGB)
color COLOR_ENTRY of the colour
nearest_color COLOR_ENTRY of the colour
Return value: The function returns the colour value and the colour space of the nearest colour.
Availability: As of NVDI 5.00.
Group: Colour table functions
See also: Binding

7.9.2 Bindings for v_color2nearest

C: int32_t v_color2nearest( int16_t handle, int32_t color_space, COLOR_ENTRY *color, COLOR_ENTRY *nearest_color );
Binding:
int32_t v_color2nearest( int16_t handle, int32_t color_space,
                         COLOR_ENTRY *color,
                         COLOR_ENTRY *nearest_color )
{
   intin[0..1] = color_space;
   intin[2..5] = color;

   contrl[0] = 204;
   contrl[1] = 0;
   contrl[3] = 6;
   contrl[5] = 2;
   contrl[6] = handle;

   vdi ();

   nearest_color = intout[2..5];

   return ( (int32_t) intout[0] );
}
GEM-Arrays:

Address Element Contents
contrl contrl[0] 204 # Function opcode
contrl+2 contrl[1] 0 # Entry in ptsin
contrl+4 contrl[2] 0 # Entry in ptsout
contrl+6 contrl[3] 6 # Entry in intin
contrl+8 contrl[4] 6 # Entry in intout
contrl+10 contrl[5] 2 # Sub-opcode
contrl+12 contrl[6] handle
intin intin[0..1] color_space
intin+4 intin[2..5] color
intout intout[0..1] Return value
intout+4 intout[2..5] nearest_color

7.9.3 v_color2value

Name: »Translate colour entry to pixel value«
Opcode: 204 (Sub-Opcode 0)
Syntax: uint32_t v_color2value( int16_t handle, int32_t color_space, COLOR_ENTRY *color );
Description: The call v_color2value returns a colour value for a pixel value.
Parameter Meaning
   
handle Workstation identifier
color_space Colour space (at present only 0 for the colour space set, or CSPACE_RGB)
color COLOR_ENTRY of the background colour
Return value: The pixel value.
Availability: As of NVDI 5.00.
Group: Colour table functions
See also: Binding

7.9.4 Bindings for v_color2value

C: uint32_t v_color2value( int16_t handle, int32_t color_space, COLOR_ENTRY *color );
Binding:
uint32_t v_color2value( int16_t handle, int32_t color_space,
                        COLOR_ENTRY *color )
{
   intin[0..1] = color_space;
   intin[2..5] = color;

   contrl[0] = 204;
   contrl[1] = 0;
   contrl[3] = 6;
   contrl[5] = 0;
   contrl[6] = handle;

   vdi ();

   return ( (uint32_t) intout[0] );
}
GEM-Arrays:

Address Element Contents
contrl contrl[0] 204 # Function opcode
contrl+2 contrl[1] 0 # Entry in ptsin
contrl+4 contrl[2] 0 # Entry in ptsout
contrl+6 contrl[3] 6 # Entry in intin
contrl+8 contrl[4] 2 # Entry in intout
contrl+10 contrl[5] 0 # Sub-opcode
contrl+12 contrl[6] handle
intin intin[0..1] color_space
intin+4 intin[2..5] color
intout intout[0..1] Return value

7.9.5 v_create_ctab

Name: »Create colour table«
Opcode: 206 (Sub-Opcode 8)
Syntax: COLOR_TAB *v_create_ctab( int16_t handle, int32_t color_space, uint32_t px_format );
Description: The call v_create_ctab creates a colour table in the colour space color_space for a bitmap with px_format & PX_BITS bits. The colour table is initialized with the standard colours for this bit-depth. The application can write to the colour table and alter the colour entries; however if the colours are altered, one has to obtain a new ID by calling rev_get_ctab_id and enter this in the structure element . Otherwise false colours will be output.

After use the colour table can be cleared with v_delete_ctab.
Parameter Meaning
   
handle Workstation identifier
color_space Colour space (at present only 0 for the colour space set, or CSPACE_RGB)
px_format Pixel format (only the lower 8 bits will be evaluated, i.e. bits per pixel)
Return value: The function returns a pointer to the colour table.
Availability: As of NVDI 5.00.
Group: Colour table functions
See also: Binding

7.9.6 Bindings for v_create_ctab

C: COLOR_TAB *v_create_ctab( int16_t handle, int32_t color_space, uint32_t px_format );
Binding:
COLOR_TAB *v_create_ctab( int16_t handle, int32_t color_space,
                          uint32_t px_format )
{
   intin[0..1] = color_space;
   intin[2..3] = px_format;

   contrl[0] = 206;
   contrl[1] = 0;
   contrl[3] = 4;
   contrl[5] = 8;
   contrl[6] = handle;

   vdi ();

   return ( (uint32_t) intout[0] );
}
GEM-Arrays:

Address Element Contents
contrl contrl[0] 206 # Function opcode
contrl+2 contrl[1] 0 # Entry in ptsin
contrl+4 contrl[2] 0 # Entry in ptsout
contrl+6 contrl[3] 4 # Entry in intin
contrl+8 contrl[4] 2 # Entry in intout
contrl+10 contrl[5] 8 # Sub-opcode
contrl+12 contrl[6] handle
intin intin[0..1] color_space
intin+4 intin[2..3] px_format
intout intout[0..1] Return value

7.9.7 v_create_itab

Name: »Create inverse colour table reference«
Opcode: 208 (Sub-Opcode 0)
Syntax: ITAB_REF v_create_itab( int16_t handle, COLOR_TAB *ctab, int16_t bits );
Description: The call v_create_itab creates an inverse colour table of the colour table passsed to it and returns a reference to it. Programs need to call this function only if they themselves manage bitmaps that are the destination of a vr_transfer_bits operation (if the off-screen bitmap is created by the VDI, i.e with v_opnbm or v_open_bm, the VDI does this automatically). See also the description of vr_transfer_bits.
Parameter Meaning
   
handle Workstation identifier
ctab Pointer to colour table
bits Preferred resolution of the inverse colour table (3-5)
Return value: The function returns the reference to the inverse colour table.
Availability: As of NVDI 5.00.
Group: Colour table functions
See also: Binding

7.9.8 Bindings for v_create_itab

C: ITAB_REF v_create_itab( int16_t handle, COLOR_TAB *ctab, int16_t bits );
Binding:
ITAB_REF v_create_itab( int16_t handle, COLOR_TAB *ctab,
                        int16_t bits )
{
   intin[0..1] = ctab;
   intin[2] = bits;
   intin[3] = 0;
   intin[4] = 0;

   contrl[0] = 208;
   contrl[1] = 0;
   contrl[3] = 5;
   contrl[5] = 0;
   contrl[6] = handle;

   vdi ();

   return ( (uint32_t) intout[0] );
}
GEM-Arrays:

Address Element Contents
contrl contrl[0] 208 # Function opcode
contrl+2 contrl[1] 0 # Entry in ptsin
contrl+4 contrl[2] 0 # Entry in ptsout
contrl+6 contrl[3] 5 # Entry in intin
contrl+8 contrl[4] 2 # Entry in intout
contrl+10 contrl[5] 0 # Sub-opcode
contrl+12 contrl[6] handle
intin intin[0..1] ctab
intin+4 intin[2] bits
intin+6 intin[3] 0
intin+8 intin[4] 0
intout intout[0..1] Return value

7.9.9 v_ctab_idx2value

Name: »Inquire colour table value« - Return pixel value.
Opcode: 206 (Sub-Opcode 5)
Syntax: uint32_t v_ctab_idx2value( int16_t handle, int16_t index );
Description: The call v_ctab_idx2value returns the pixel value for an entry in the colour table. If the passed index is larger than the number of colour pens, then the pixel value of the colour black will be returned.
Parameter Meaning
   
handle Workstation identifier
index Colour table index
Return value: The function returns the pixel value.
Availability: As of NVDI 5.00.
Group: Colour table functions
See also: Binding

7.9.10 Bindings for v_ctab_idx2value

C: uint32_t v_ctab_idx2value( int16_t handle, int16_t index );
Binding:
uint32_t v_ctab_idx2value( int16_t handle, int16_t index )
{
   intin[0] = index;

   contrl[0] = 206
   contrl[1] = 0;
   contrl[3] = 1;
   contrl[5] = 5;
   contrl[6] = handle;

   vdi ();

   return ( (uint32_t) intout[0] );
}
GEM-Arrays:

Address Element Contents
contrl contrl[0] 206 # Function opcode
contrl+2 contrl[1] 0 # Entry in ptsin
contrl+4 contrl[2] 0 # Entry in ptsout
contrl+6 contrl[3] 1 # Entry in intin
contrl+8 contrl[4] 2 # Entry in intout
contrl+10 contrl[5] 5 # Sub-opcode
contrl+12 contrl[6] handle
intin intin[0] index
intout intout[0..1] Return value

7.9.11 v_ctab_idx2vdi

Name: »Translate VDI colour index to colour table index«
Opcode: 206 (Sub-Opcode 3)
Syntax: int16_t v_ctab_idx2vdi( int16_t handle, int16_t index );
Description: The call v_ctab_idx2vdi converts the colour table index into a VDI colour index.
Parameter Meaning
   
handle Workstation identifier
index Index for the colour table


For resolutions up to 256 colours, index is the index for the COLOR_ENTRY in the current colour table and simultaneously also the actual pixel value that is entererd in the bitmap. For graphic formats with more than 256 colours, index continues to denote the entry in the colour table; the pixel value however is output by the VDI as a direct RGB value in the bitmap.
Return value: The function returns the old VDI colour index for vsl_color or similar functions
Availability: As of NVDI 5.00.
Group: Colour table functions
See also: Binding

7.9.12 Bindings for v_ctab_idx2vdi

C: int16_t v_ctab_idx2vdi( int16_t handle, int16_t index );
Binding:
int16_t v_ctab_idx2vdi( int16_t handle, int16_t index )
{
   intin[0] = index;

   contrl[0] = 206
   contrl[1] = 0;
   contrl[3] = 1;
   contrl[5] = 3;
   contrl[6] = handle;

   vdi ();

   return ( intout[0] );
}
GEM-Arrays:

Address Element Contents
contrl contrl[0] 206 # Function opcode
contrl+2 contrl[1] 0 # Entry in ptsin
contrl+4 contrl[2] 0 # Entry in ptsout
contrl+6 contrl[3] 1 # Entry in intin
contrl+8 contrl[4] 1 # Entry in intout
contrl+10 contrl[5] 3 # Sub-opcode
contrl+12 contrl[6] handle
intin intin[0] index
intout intout[0] Return value

7.9.13 v_ctab_vdi2idx

Name: »Translate VDI Color Index To Color Table Index«
Opcode: 206 (sub-opcode 4)
Syntax: int16_t v_ctab_vdi2idx( int16_t handle, int16_t vdi_index );
Description: The call v_ctab_vdi2idx translates the VDI colour index to a colour table index.
Parameter Meaning
   
handle Workstation identifier
vdi_index Index for the colour table


For resolutions up to 256 colours, index is the index for the COLOR_ENTRY in the current colour table and simultaneously also the actual pixel value that is entererd in the bitmap. For graphic formats with more than 256 colours, index continues to denote the entry in the colour table; the pixel value however is output by the VDI as a direct RGB value in the bitmap.
Return value: The function returns the index for the colour table.
Availability: As of NVDI 5.00.
Group: Colour table functions
See also: Binding

7.9.14 Bindings for v_ctab_vdi2idx

C: int16_t v_ctab_idx2vdi( int16_t handle, int16_t vdi_index );
Binding:
int16_t v_ctab_idx2vdi( int16_t handle, int16_t vdi_index )
{
   intin[0] = vdi_index;

   contrl[0] = 206
   contrl[1] = 0;
   contrl[3] = 1;
   contrl[5] = 4;
   contrl[6] = handle;

   vdi ();

   return ( intout[0] );
}
GEM-Arrays:

Address Element Contents
contrl contrl[0] 206 Function Opcode
contrl+2 contrl[1] 0 # entry in ptsin
contrl+4 contrl[2] 0 # entry in ptsout
contrl+6 contrl[3] 1 # entry in intin
contrl+8 contrl[4] 1 # entry in intout
contrl+10 contrl[5] 4
contrl+12 contrl[6] handle
intin intin[0] vdi_index
intout intout[0] Rückgabewert

7.9.15 v_delete_ctab

Name: »Delete colour table«
Opcode: 206 (Sub-Opcode 9)
Syntax: int16_t v_delete_ctab( int16_t handle, COLOR_TAB *ctab );
Description: The call v_delete_ctab clears a colour table created with v_create_ctab.
Parameter Meaning
   
handle Workstation identifier
ctab Pointer to colour table
Return value: 0: Error
1: All OK
Availability: As of NVDI 5.00.
Group: Colour table functions
See also: Binding   v_create_ctab

7.9.16 Bindings for v_delete_ctab

C: int16_t v_delete_ctab( int16_t handle, COLOR_TAB *ctab );
Binding:
int16_t v_delete_ctab( int16_t handle, COLOR_TAB *ctab )
{
   intin[0..1] = ctab;

   contrl[0] = 206
   contrl[1] = 0;
   contrl[3] = 2;
   contrl[5] = 9;
   contrl[6] = handle;

   vdi ();

   return ( intout[0] );
}
GEM-Arrays:

Address Element Contents
contrl contrl[0] 206 # Function opcode
contrl+2 contrl[1] 0 # Entry in ptsin
contrl+4 contrl[2] 0 # Entry in ptsout
contrl+6 contrl[3] 2 # Entry in intin
contrl+8 contrl[4] 1 # Entry in intout
contrl+10 contrl[5] 9 # Sub-opcode
contrl+12 contrl[6] handle
intin intin[0..1] ctab
intout intout[0] Return value

7.9.17 v_delete_itab

Name: »Delete inverse colour table reference«
Opcode: 208 (Sub-Opcode 1)
Syntax: int16_t v_delete_itab( int16_t handle, ITAB_REF *itab );
Description: The call v_delete_itab releases the memory used for an inverse colour table.
Parameter Meaning
   
handle Workstation identifier
itab Reference to inverse colour table
Return value: 0: Error
1: All OK
Availability: As of NVDI 5.00.
Group: Colour table functions
See also: Binding

7.9.18 Bindings for v_delete_itab

C: int16_t v_delete_itab( int16_t handle, ITAB_REF *itab );
Binding:
int16_t  v_delete_itab( int16_t handle, ITAB_REF *itab )
{
   intin[0..1] = itab;

   contrl[0] = 208;
   contrl[1] = 0;
   contrl[3] = 2;
   contrl[5] = 1;
   contrl[6] = handle;

   vdi ();

   return ( intout[0] );
}
GEM-Arrays:

Address Element Contents
contrl contrl[0] 208 # Function opcode
contrl+2 contrl[1] 0 # Entry in ptsin
contrl+4 contrl[2] 0 # Entry in ptsout
contrl+6 contrl[3] 3 # Entry in intin
contrl+8 contrl[4] 2 # Entry in intout
contrl+10 contrl[5] 1 # Sub-opcode
contrl+12 contrl[6] handle
intin intin[0..1] itab
intout intout[0] Return value

7.9.19 v_get_ctab_id

Name: »Get unique colour table ID« - Return unique ID for a new colour table.
Opcode: 206 (Sub-Opcode 6)
Syntax: int32_t v_get_ctab_id( int16_t handle );
Description: If a program builds up its own colour table, a unique ID has to be obtained from the VDI, so that different tables also have different IDs. v_get_ctab_id returns an ID for this case.
Parameter Meaning
   
handle Workstation identifier
Return value: The function returns a unique ID for a new colour table.
Availability: As of NVDI 5.00.
Group: Colour table functions
See also: Binding

7.9.20 Bindings for v_get_ctab_id

C: int32_t v_get_ctab_id( int16_t handle );
Binding:
int32_t v_get_ctab_id( int16_t handle )
{
   contrl[0] = 206
   contrl[1] = 0;
   contrl[3] = 0;
   contrl[5] = 6;
   contrl[6] = handle;

   vdi ();

   return ( (int32_t) intout[0] );
}
GEM-Arrays:

Address Element Contents
contrl contrl[0] 206 # Function opcode
contrl+2 contrl[1] 0 # Entry in ptsin
contrl+4 contrl[2] 0 # Entry in ptsout
contrl+6 contrl[3] 0 # Entry in intin
contrl+8 contrl[4] 2 # Entry in intout
contrl+10 contrl[5] 6 # Sub-opcode
contrl+12 contrl[6] handle
intout intout[0..1] Return value

7.9.21 v_value2color

Name: »Translate pixel value to colour entry«
Opcode: 204 (Sub-Opcode 1)
Syntax: int32_t v_value2color( int16_t handle, uint32_t value, COLOR_ENTRY *color );
Description: The call v_value2color returns the colour of a pixel value.
Parameter Meaning
   
handle Workstation identifier
value Pixel value
color COLOR_ENTRY of the colour
Return value: The function returns the colour value and the set colour space.
Availability: As of NVDI 5.00.
Group: Colour table functions
See also: Binding

7.9.22 Bindings for v_value2color

C: int32_t v_value2color( int16_t handle, uint32_t value, COLOR_ENTRY *color );
Binding:
int32_t v_value2color( int16_t handle, uint32_t value,
                       COLOR_ENTRY *color )
{
   intin[0..1] = value;

   contrl[0] = 204;
   contrl[1] = 0;
   contrl[3] = 2;
   contrl[5] = 1;
   contrl[6] = handle;

   vdi ();

   color = intout[2..5];

   return ( (int32_t) intout[0] );
}
GEM-Arrays:

Address Element Contents
contrl contrl[0] 204 # Function opcode
contrl+2 contrl[1] 0 # Entry in ptsin
contrl+4 contrl[2] 0 # Entry in ptsout
contrl+6 contrl[3] 2 # Entry in intin
contrl+8 contrl[4] 6 # Entry in intout
contrl+10 contrl[5] 1 # Sub-opcode
contrl+12 contrl[6] handle
intin intin[0..1] value
intout intout[0..1] Return value
intout+4 intout[2..5] color

7.9.23 vq_ctab

Name: »Inquire current colour table«
Opcode: 206 (Sub-Opcode 0)
Syntax: int16_t vq_ctab( int16_t handle, int32_t ctab_length, COLOR_TAB *ctab );
Description: The call vq_ctab copies the current colour table, which the VDI manages under the passed handle, into the region to which ctab points. If the colour table is longer than ctab_length, then no value is returned in intout, and contrl[4] is then 0. A colour table can hold a maximum of 256 entries (as the VDI supports a maximum of 256 colour pens, there cannot be more) and hence this gives the maximum length from the size of the header plus 256 * sizeof( COLOR_ENTRY ).
Parameter Meaning
   
handle Workstation identifier
ctab_length Length of memory block to which ctab points
ctab Memory block to which the colour table is copied
Return value: The function returns 0 for an error, or 1 for 'All OK'.
Availability: As of NVDI 5.00.
Group: Colour table functions
See also: Binding

7.9.24 Bindings for vq_ctab

C: int16_t vq_ctab( int16_t handle, int32_t ctab_length, COLOR_TAB *ctab );
Binding:
int16_t vq_ctab( int16_t handle, int32_t ctab_length,
                 COLOR_TAB *ctab )
{
   intin[0..1] = ctab_length;

         intout points to ctab

   contrl[0] = 206;
   contrl[1] = 0;
   contrl[3] = 2;
   contrl[5] = 0;
   contrl[6] = handle;

   vdi ();

   if ( contrl[4] )
     return( 1 );                   /* All OK */
   else
     return( 0 );
}
GEM-Arrays:

Address Element Contents
contrl contrl[0] 206 # Function opcode
contrl+2 contrl[1] 0 # Entry in ptsin
contrl+4 contrl[2] 0 # Entry in ptsout
contrl+6 contrl[3] 2 # Entry in intin
contrl+8 contrl[4] n # Entry in intout
contrl+10 contrl[5] 0 # Sub-opcode
contrl+12 contrl[6] handle
intin intin[0..1] ctab_length
intout intout[0..n] ctab

7.9.25 vq_ctab_entry

Name: »Inquire colour table entry«
Opcode: 206 (Sub-Opcode 1)
Syntax: int32_t vq_ctab_entry( int16_t handle, int16_t index, COLOR_ENTRY *color );
Description: The call vq_ctab_entry obtains the colour space and the colour of a colour table entry.
Parameter Meaning
   
handle Workstation identifier
index Colour table index
color Holds colour of colour table entry after the call
Return value: The function returns the colour space of a colour table entry.
Availability: As of NVDI 5.00.
Group: Colour table functions
See also: Binding

7.9.26 Bindings for vq_ctab_entry

C: int32_t vq_ctab_entry( int16_t handle, int16_t index, COLOR_ENTRY *color );
Binding:
int32_t vq_ctab_entry( int16_t handle, int16_t index,
                       COLOR_ENTRY *color )
{
   intin[0] = index;

   contrl[0] = 206;
   contrl[1] = 0;
   contrl[3] = 1;
   contrl[5] = 1;
   contrl[6] = handle;

   vdi ();

   color = intout[2..5];

   return( ( int32_t ) intout [0] );
}
GEM-Arrays:

Address Element Contents
contrl contrl[0] 206 # Function opcode
contrl+2 contrl[1] 0 # Entry in ptsin
contrl+4 contrl[2] 0 # Entry in ptsout
contrl+6 contrl[3] 1 # Entry in intin
contrl+8 contrl[4] 6 # Entry in intout
contrl+10 contrl[5] 1 # Sub-opcode
contrl+12 contrl[6] handle
intin intin[0] index
intout intout[0..1] Return value
intout+4 intout[2..5] color

7.9.27 vq_ctab_id

Name: »Inquire current colour table ID«
Opcode: 206 (Sub-Opcode 2)
Syntax: int32_t vq_ctab_id( int16_t handle );
Description: The call vq_ctab_id returns the ID of the current colour table for handle. From this ID a program can ascertain whether the colour table of the device that it is using has been changed.
Parameter Meaning
   
handle Workstation identifier
Return value: The function returns the ID of the current colour
Availability: As of NVDI 5.00.
Group: Colour table functions
See also: Binding

7.9.28 Bindings for vq_ctab_id

C: int32_t vq_ctab_id( int16_t handle );
Binding:
int32_t vq_ctab_id( int16_t handle )
{
   contrl[0] = 206;
   contrl[1] = 0;
   contrl[3] = 0;
   contrl[5] = 2;
   contrl[6] = handle;

   vdi ();

   return( ( int32_t ) intout [0] );
}
GEM-Arrays:

Address Element Contents
contrl contrl[0] 206 # Function opcode
contrl+2 contrl[1] 0 # Entry in ptsin
contrl+4 contrl[2] 0 # Entry in ptsout
contrl+6 contrl[3] 0 # Entry in intin
contrl+8 contrl[4] 2 # Entry in intout
contrl+10 contrl[5] 2 # Sub-opcode
contrl+12 contrl[6] handle
intout intout[0..1] Return value

7.9.29 vq_dflt_ctab

Name: »Inquire default colour table« - Return system colour table.
Opcode: 206 (Sub-Opcode 7)
Syntax: int16_t vq_dflt_ctab( int16_t handle, int32_t ctab_length, COLOR_TAB *ctab );
Description: The call vq_dflt_ctab copies the preferred system colour table for the set colour depth into the memory block to which ctab points. If the colour table is longer than ctab_length, then no value is returned in intout, and contrl[4] is then 0. A colour table can hold a maximum of 256 entries (as the VDI supports a maximum of 256 colour pens, there cannot be more) and hence this gives the maximum length from the size of the header plus 256 * sizeof( COLOR_ENTRY ).
Parameter Meaning
   
handle Workstation identifier
ctab_length Length of memory block to which ctab points
ctab Memory block to which the colour table is copied
Return value: The function returns 0 for an error, or 1 for 'All OK'.
Availability: As of NVDI 5.00.
Group: Colour table functions
See also: Binding

7.9.30 Bindings for vq_dflt_ctab

C: int16_t vq_dflt_ctab( int16_t handle, int32_t ctab_length, COLOR_TAB *ctab );
Binding:
int16_t vq_dflt_ctab( int16_t handle, int32_t ctab_length,
                      COLOR_TAB *ctab )
{
   intin[0..1] = ctab_length;

   intout zeigt auf ctab

   contrl[0] = 206;
   contrl[1] = 0;
   contrl[3] = 2;
   contrl[5] = 7;
   contrl[6] = handle;

   vdi ();

   if ( contrl[4] )
     return( 1 );                   /* All OK */
   else
     return( 0 );
}
GEM-Arrays:

Address Element Contents
contrl contrl[0] 206 # Function opcode
contrl+2 contrl[1] 0 # Entry in ptsin
contrl+4 contrl[2] 0 # Entry in ptsout
contrl+6 contrl[3] 2 # Entry in intin
contrl+8 contrl[4] n # Entry in intout
contrl+10 contrl[5] 7 # Sub-opcode
contrl+12 contrl[6] handle
intin intin[0] ctab_length
intout intout[0..n] ctab

7.9.31 vq_px_format

Name: »Inquire pixel format and colour space«
Opcode: 204 (Sub-Opcode 3)
Syntax: int32_t vq_px_format( int16_t handle, uint32_t *px_format );
Description: The call vq_px_format obtains the set pixel format and the set colour space.
Parameter Meaning
   
handle Workstation identifier
px_format Holds the set pixel format after the call
Return value: The function returns the colour space set.
Availability: As of NVDI 5.00.
Group: Colour table functions
See also: Binding

7.9.32 Bindings for vq_px_format

C: int32_t vq_px_format( int16_t handle, uint32_t *px_format );
Binding:
int32_t  vq_px_format( int16_t handle, uint32_t *px_format )
{
   contrl[0] = 204;
   contrl[1] = 0;
   contrl[3] = 0;
   contrl[5] = 3;
   contrl[6] = handle;

   vdi ();

   px_format = intout[2..3];

   return ( (int32_t) intout[0] );
}
GEM-Arrays:

Address Element Contents
contrl contrl[0] 204 # Function opcode
contrl+2 contrl[1] 0 # Entry in ptsin
contrl+4 contrl[2] 0 # Entry in ptsout
contrl+6 contrl[3] 0 # Entry in intin
contrl+8 contrl[4] 4 # Entry in intout
contrl+10 contrl[5] 3 # Sub-opcode
contrl+12 contrl[6] handle
intout intout[0..1] Return value
intout+4 intout[2..3] px_format

7.9.33 vs_ctab

Name: »Set colour table«
Opcode: 205 (Sub-Opcode 0)
Syntax: int16_t vs_ctab( int16_t handle, COLOR_TAB *ctab );
Description: The call vs_ctab copies the colour table, sets the colours in the hardware if a CLUT is present, and returns the number of set colour entries. If at all possible, programs should not change the colours of the screen!
Parameter Meaning
   
handle Workstation identifier
ctab Memory block to which the colour table is copied
Return value: The function returns the number of entries set.
Availability: As of NVDI 5.00.
Group: Colour table functions
See also: Binding

7.9.34 Bindings for vs_ctab

C: int16_t vs_ctab( int16_t handle, COLOR_TAB *ctab );
Binding:
int16_t vs_ctab( int16_t handle, COLOR_TAB *ctab )
{
   contrl[0] = 205;
   contrl[1] = 0;
   contrl[3] = ctab->length / 2;  /* Length of colour table / 2 */
   contrl[5] = 0;
   contrl[6] = handle;

   intin points to ctab

   vdi ();

   return ( intout[0] );
}
GEM-Arrays:

Address Element Contents
contrl contrl[0] 205 # Function opcode
contrl+2 contrl[1] 0 # Entry in ptsin
contrl+4 contrl[2] 0 # Entry in ptsout
contrl+6 contrl[3] n # Entry in intin
contrl+8 contrl[4] 1 # Entry in intout
contrl+10 contrl[5] 0 # Sub-opcode
contrl+12 contrl[6] handle
intin intin Replace by ctab
intout intout[0] Return value

7.9.35 vs_ctab_entry

Name: »Set colour table entry«
Opcode: 205 (sub-opcode 1)
Syntax: int16_t vs_ctab_entry( int16_t handle, int16_t index, int32_t color_space, COLOR_ENTRY *color );
Description: The call vs_ctab_entry sets a colour value in the colour table, i.e. for modes with up to 256 colours a CLUT entry will be changed. If at all possible, programs should not change the colours of the screen!
Parameter Meaning
   
handle Workstation identifier
index Colour table index
color_space Colour space (at present only 0 for the colour space set, or CSPACE_RGB)
color Colour table index
Return value: The function returns the number of entries set.
Availability: As of NVDI 5.00.
Group: Colour table functions
See also: Binding

7.9.36 Bindings for vs_ctab_entry

C: int16_t vs_ctab_entry( int16_t handle, int16_t index, int32_t color_space, COLOR_ENTRY *color );
Binding:
int16_t vs_ctab_entry( int16_t handle, int16_t index,
                       int32_t color_space, COLOR_ENTRY *color )
{
   intin[0] = index;
   intin[1..2] = color_space;
   intin[3..6] = color;


   contrl[0] = 205;
   contrl[1] = 0;
   contrl[3] = 7;
   contrl[5] = 1;
   contrl[6] = handle;

   vdi ();

   return ( intout[0] );
}
GEM-Arrays:

Address Element Contents
contrl contrl[0] 205 # Function opcode
contrl+2 contrl[1] 0 # Entry in ptsin
contrl+4 contrl[2] 0 # Entry in ptsout
contrl+6 contrl[3] 7 # Entry in intin
contrl+8 contrl[4] 1 # Entry in intout
contrl+10 contrl[5] 1 # Sub-opcode
contrl+12 contrl[6] handle
intin intin[0] index
intin+2 intin[1..2] color_space
intin+6 intin[3..6] color
intout intout[0] Return value

7.9.37 vs_dflt_ctab

Name: »Set default colour table« - Set system colour table.
Opcode: 205 (Sub-Opcode 2)
Syntax: int16_t vs_dflt_ctab( int16_t handle );
Description: The call vs_dflt_ctab sets the system colour table for the current bit-depth.
Parameter Meaning
   
handle Workstation identifier
Return value: The function returns the number of entries set.
Availability: As of NVDI 5.00.
Group: Colour table functions
See also: Binding

7.9.38 Bindings for vs_dflt_ctab

C: int16_t vs_dflt_ctab( int16_t handle );
Binding:
int16_t vs_dflt_ctab( int16_t handle )
{
   contrl[0] = 205;
   contrl[1] = 0;
   contrl[3] = 0;
   contrl[5] = 2;
   contrl[6] = handle;

   vdi ();

   return ( intout[0] );
}
GEM-Arrays:

Address Element Contents
contrl contrl[0] 205 # Function opcode
contrl+2 contrl[1] 0 # Entry in ptsin
contrl+4 contrl[2] 0 # Entry in ptsout
contrl+6 contrl[3] 0 # Entry in intin
contrl+8 contrl[4] 1 # Entry in intout
contrl+10 contrl[5] 2 # Sub-opcode
contrl+12 contrl[6] handle
intout intout[0] Return value

HomeVDIEscape functionsControl functions