PALelements(3DTM)

NAME
PALsetSize, PALgetSizeP - Set and determine the number of colors in a palette.

SYNOPSIS
#include <ris.h>

PALsetSize(char *header, int num_elements)

PALgetSize(char *header, int *num_elements)

DESCRIPTION
PALsetSize and PALgetSize are macros that operate on a given DTM header.

PALsetSize inserts into the string header the tag PALentries followed by the number of elements as supplied by num_elements that are supposed to be available in the palette. It is up to the user to ensure that the exact number of entries specified are actually contained within the data portion of the message.

PALgetSize examines the header and returns the number declared to be the size of the palette contained in the dataset that is supposed to follow the header. If no size was found within the header, and since palettes are typically comprised of 256 elements, the value num_elements is assigned defaults to the value 256. It is the user's responsibility to ensure that the value returned by num_elements is exactly matches the number of elements that are actually contained in the dataset since PALgetSize has no way of reviewing and interpreting the data.

SEE ALSO
DTM, PALclass

DIAGNOSTICS
PALgetSize returns the error DTMERROR if the header does not contain the tag PALentries or if no value follows the PALentries tag. In either case, the value of num_elements still defaults to 256.

BUGS
PALsetSize has no way of determining if the header contains sufficient space to hold the tag PALentries and the number of elements specified. The results of attempting to store information beyond the end of the allocated space are undefined.