OpenRM - RM Library (rmvmap.c)

## Index of OpenRM - RM Library

     RMvisMap *rmVismapNew (int size)

     int size - an int that specifyingthe size of the visualization
        colormap (input).

Creates a new visualization Colormap, returning the handle to the caller. The caller should use rmVismapDelete() when the vismap is no longer needed to free memory.

The size of the visualization colormap is dictated by the input parameter. The newly created visualization colormap of length "size" is set to all zeroes.

librm library source file: rmvmap.c

     RMvisMap * rmVismapDup (const RMvisMap *toDuplicate)

     const RMvisMap *toDuplicate - a handle to an RMvisMap

Creates a new RMvisMap object that is an exact duplicate of the input RMvisMap object. Returns a handle to the newly created RMvisMap to the caller if successful, or returns NULL upon failure.

The caller should use rmVismapDelete() to free the new RMvisMap object when no longer needed.

librm library source file: rmvmap.c

     RMenum rmVismapDelete (RMvisMap *toDelete)

     RMvisMap *toDelete - a handle to an RMvisMap that will be deleted

Releases the resources associated with an RMvisMap object. This routine is the opposite of rmVismapNew(). The caller should not reference the RMvisMap object after making this call.

Returns RM_CHILL upon success, or RM_WHACKED upon failure.

librm library source file: rmvmap.c

     RMenum rmVismapSetColor3D (RMvisMap *toModify,
                               int indx,
    			   const RMcolor3D *newColor)

     RMvisMap *toModify - input RMvisMap object that will be modified.

     int index - an integer index of the entry in the RMvisMap that will
        be modified.

     const RMcolor3D *newColor - the 4-component color that will be copied
        into the RMvisMap at location "index".

Use this routine to set the 3-component color of an RMvisMap object. Each entry in the RMvisMap object is a 4-component color (RGBA), and this routine writes over the RGB channels at one such entry at location "index" in the RMvisMap with the caller supplied data. RM_CHILL is returned upon successful modification of the RMvisMap object. RM_WHACKED is returned if "toModify" is NULL, if "indx" is out of range, or if the input RMcolor3D object "newColor" is NULL.

librm library source file: rmvmap.c

     RMenum rmVismapGetColor3D (const RMvisMap *toQuery,
    	 	            int indx,
    		            RMcolor3D *retColor)

     RMvisMap *toQuery - input RMvisMap object that will be queried.

     int index - an integer index of the entry in the RMvisMap that will
        be returned to the caller.

     RMcolor3D *retColor - a handle to an RMcolor3D object that will be
        modified to contain the 3-component color at location "indx" from
        within the RMvisMap "toQuery." 3-component color means the R,G,B
        channels of the RMvisMap; the alpha channel is ignored.

Copies the 3-component color from the RMvisMap object "toQuery" at location "indx" into the caller supplied object. This routine returns RM_CHILL upon success, or RM_WHACKED if "toQuery" is NULL, if "indx" is out of range, or if the pointer to the caller supplied object is NULL.

librm library source file: rmvmap.c

     RMenum rmVismapSetColor4D (RMvisMap *toModify,
                                int index,
    			    const RMcolor4D *newColor)

     RMvisMap *toModify - input RMvisMap object that will be modified.

     int index - an integer index of the entry in the RMvisMap that will
        be modified.

     const RMcolor4D *newColor - the 4-component color that will be copied
        into the RMvisMap at location "index"

Use this routine to set the 4-component color of an RMvisMap object. Each entry in the RMvisMap object is a 4-component color, and this routine writes over one such entry at location "index" in the RMvisMap with the caller supplied data. RM_CHILL is returned upon successful modification of the RMvisMap object. RM_WHACKED is returned if "toModify" is NULL, if "indx" is out of range, or if the input RMcolor4D object "newColor" is NULL.

librm library source file: rmvmap.c

     RMenum rmVismapGetColor4D (const RMvisMap *toQuery,
    	 	            int indx,
    		            RMcolor4D *retColor)

     RMvisMap *toQuery - input RMvisMap object that will be queried.

     int index - an integer index of the entry in the RMvisMap that will
        be returned to the caller.

     RMcolor4D *retColor - a handle to an RMcolor4D object that will be
        modified to contain the 4-component color at location "indx" from
        within the RMvisMap "toQuery."

Copies the 4-component color from the RMvisMap object "toQuery" at location "indx" into the caller supplied object. This routine returns RM_CHILL upon success, or RM_WHACKED if "toQuery" is NULL, if "indx" is out of range, or if the pointer to the caller supplied object is NULL.

librm library source file: rmvmap.c

     RMenum rmVismapSetTfMin (RMvisMap *toModify,
    		          float newTFMin)

     RMvisMap *toModify - a handle to an RMvisMap object that will be
        modified by this routine (input).

     float newTFMin - a floating point value that will be assigned to the
        RMvisMap object's minimum transfer function attribute.

Use this routine in conjunction with rmVismapSetTfMax to define a linear transfer function for the RMvisMap object. Returns RM_CHILL upon success, or RM_WHACKED if the input RMvisMap object is NULL.

librm library source file: rmvmap.c

     float rmVismapGetTfMin (const RMvisMap *toQuery)

     const RMvisMap *toQuery - a handle to an RMvisMap object (input)

Returns to the caller a floating point value that is the RMvisMap object's transfer function lower bound.

librm library source file: rmvmap.c

     RMenum rmVismapSetTfMax (RMvisMap *toModify,
    		          float newTFMax)

     RMvisMap *toModify - a handle to an RMvisMap object that will be
        modified by this routine (input).

     float newTFMax - a floating point value that will be assigned to the
        RMvisMap object's maximum transfer function attribute (input).

Use this routine in conjunction with rmVismapSetTfMin to define a linear transfer function for the RMvisMap object. Returns RM_CHILL upon success, or RM_WHACKED if the input RMvisMap object is NULL.

librm library source file: rmvmap.c

     float rmVismapGetTfMax (const RMvisMap *toQuery)

     const RMvisMap *toQuery - a handle to an RMvisMap object (input)

Returns to the caller a floating point value that is the RMvisMap object's transfer function upper bound.

librm library source file: rmvmap.c

     int rmVismapIndexFromData (const RMvisMap *map,
                                float val)

     const RMvisMap *map - a handle to an RMvisMap object (input).

     float val - a floating point value (input).

Use this routine to compute an index from a raw data value. RMvisMap objects contain internal parameters to define a transfer function (see rmVismapSetTfMin() and rmVismapSetTfMax() ). This routine computes an integer index thus: ((val-min)/(max-min))*(size-1). The return value is clamped to be in the range 0..size-1, where "size" is the number of entries in the RMvisMap object.

librm library source file: rmvmap.c

     RMenum rmVismapSetSize (RMvisMap *toModify,
    		         int newSize)

     RMvisMap *toModify - a handle to an RMvisMap object.

     int newSize - an integer value defining the new number of entries in
        the RMvisMap object "toModify."

This routine is used to modify the number of entries in the RMvisMap object. The new requested size must be greater than 0 and less than 256. As of 1/15/2000, 256 is the current maximum and default size of the RMvisMap object. This routine does not cause any internal tables to be realloced, it just changes the size attribute of the table. The size attribute is checked by routines that set/get RMvisMap entries in validity checking input.

This routine will return RM_CHILL to the caller upon success, or RM_WHACKED if the input RMvisMap object is NULL or if the "newSize" parameter is out of range.

librm library source file: rmvmap.c

     int rmVismapGetSize (const RMvisMap *toQuery)

     const RMvisMap *toQuery - a handle to the RMvisMap object to be
        queried.

Returns to the caller the number of entries in the visualization colormap of the of the RMvisMap object. A non-negative integer is returned upon success, or -1 is returned if the input RMvisMap object is NULL.

librm library source file: rmvmap.c

     RMenum rmVismapSetAlpha (RMvisMap *toModify,
    		          int indx,
    			  float newAlpha)

     RMvisMap *toModify - a handle to an RMvisMap object (input).

     int indx - an integer value specifying which entry of the RMvisMap
        object will be modified by this routine (input).

     float newAlpha - a floating point value that will be copied into the
        RMvisMap object "toModify" at location "indx". Alpha values
        usually range between 0.0 and 1.0.

Sets that alpha component of the 4-component color in the RMvisMap object "toModify" at entry "indx." Returns RM_CHILL to the caller if successful. RM_WHACKED is returned if "toModify" is NULL, or if "indx" is out of range.

librm library source file: rmvmap.c

     float rmVismapGetAlpha (const RMvisMap *toQuery,
    	 	         int indx)

     const RMvisMap *toQuery - a handle to an RMvisMap object to be
        queried (input).

     int indx - the index of the entry in the RMvisMap object to query
        (input).

Returns to the caller the alpha component of the RMvisMap object at entry "indx." If "indx" is out of range, rmWarning() is called issuing an error message, and -1.0 is returned to the caller. Alpha values usually range between 0.0 and 1.0.

librm library source file: rmvmap.c

     RMvisMap *rmDefaultVismap (void)

     No arguments.

This routine performs a two-fold function. First, it creates a new RMvisMap object containing 256 entries. Second, it assigns default values to the RGBA channels of the new colormap. A handle to the new RMvisMap object is returned to the caller. When caller no longer needs the RMvisMap object, use "rmVismapDelete()" to free the object. The default colormap will be set to:

1. A hue ramp from .66 to 0.0 (blue-cyan-green-yellow-orange-red) 2. Constant saturation & brightness of 1.0 3. Alpha ramp from 0..1 (low to high) 4. transfer function min/max of 0..1

librm library source file: rmvmap.c