View Raw SPL
/*****************************************************************************
*                                                                            *
*   PINK.SPL       Copyright (C) 1997 DSP Development Corporation            *
*                               All Rights Reserved                          *
*                                                                            *
*   Author:      Randy Race                                                  *
*                                                                            *
*   Synopsis:    Generate a colormap of pinks                                *
*                                                                            *
*   Revisions:    4 Aug 1997  RRR  Creation                                  *
*                                                                            *
*****************************************************************************/


#if @HELP_PINK

    PINK

    Purpose: Generates a colormap of black, red, yellow, white.

    Syntax:  PINK(len)

               len - optional colormap length, defaults to
                     the length of the current colormap


    Returns: A table of RGB triples suitable for the SETCOLORMAP function.

    Example:

             clen = length(getcolormap());
             density(ravel(rep(0..(clen-1), 32), clen)');
             pink();

             Creates a table of 32 x colormap length RBG values and
             displays the resulting colors. The resulting image is a
             vertical plot of colors ranging from black (lowest) to pink
             to yellow to white (highest).

     Remarks:

             Pink() by itself sets the colormap and shading.

             a = pink() or setcolormap(pink()) returns the rgb values.
             In this case, use SETSHADING to make the new colormap
             take effect on an existing density or 2D plot.

     See Also:

             Cool
             Rainbow
             Setcolormap
             Setshading
             Showcmap

#endif


pink(mlen)
{
        local cmap;

        if (argc < 1)
        {
                mlen = length(getcolormap());
        }

        cmap = sqrt((2 * gray(mlen) + hot(mlen)) / 3);

        if (outargc == 0)
        {
                setplotshading(cmap);
        }
        else
        {
                /* return the colormap */
                setrgbprops(cmap);
                
                return(cmap);
        }
}