View Raw SPL
/*****************************************************************************
*                                                                            *
*   CLEARSHADING.SPL Copyright (C) 2011, 2014 DSP Development Corporation    *
*                               All Rights Reserved                          *
*                                                                            *
*   Author:      Randy Race                                                  *
*                                                                            *
*   Synopsis:    Clears window shading                                       *
*                                                                            *
*   Revisions:   20 Jan 2011  RRR  Creation                                  *
*                12 Jul 2014  RRR  window list                               *
*                                                                            *
*****************************************************************************/


#if @HELP_CLEARSHADING

    CLEARSHADING

    Purpose: Clears window shading.

    Syntax:  CLEARSHADING(win1, win2, ..., winN)

               winN - Optional. A list fo windows, the target windows
                      to unshade. Defaults to the current window.

    Returns: Nothing, the shading is disabled.

    Example:
             W1: integ(gnorm(1000, 1));rainbow;

             clearshading(w1);

             W1 contains a shaded series plot. CLEARSHADING disables
             the shading.

    Remarks:
             CLEARSHADING disables any shading for the target windows
             and restores the default series color.

    See Also:
             Mappalette
             Setshading
             Shadewith
#endif


/* clear shading for a window */
clearshading(argv)
{
        local cwin, j, w;

        if (argc < 1)
        {
                /* clear current window */
                clearshading_clear();
        }
        else
        {
                cwin = refwindow(w0);

                loop (j = 1..argc)
                {
                        w = getargv(j);

                        if (iswindow(w))
                        {
                                moveto(w);

                                clearshading_clear();
                        }
                }

                moveto(cwin);
        }
}


/* clear shading of current window */
clearshading_clear()
{
        setshading();
        shadewith();

        /* restore original RGB image */
        if (rgbimage())
        {
                rgbimage(1);
        }
}