Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Watcom C Library Reference - <u>synopsis:</u> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Synopsis:
    #include <pgchart.h>
    short _FAR _pg_setpalette( paletteentry _FAR *pal );

Description:
    The _pg_setpalette function sets the internal palette of the
    presentation graphics system.  The palette controls the colors, line
    styles, fill patterns and plot characters used to display each series of
    data in a chart.

    The argument pal is an array of palette structures containing the new
    palette.  Each element of the palette is a structure containing the
    following fields:

    color
        color used to display series

    style
        line style used for line and scatter charts

    fill
        fill pattern used to fill interior of bar and pie sections

    plotchar
        character plotted on line and scatter charts


Returns:
    The _pg_setpalette function returns zero if successful; otherwise, a
    non-zero value is returned.

Example:
    #include <graph.h>
    #include <pgchart.h>
    #include <string.h>
    #include <conio.h>

    #if defined ( __386__ )
        #define _FAR
    #else
        #define _FAR    __far
    #endif

    #define NUM_VALUES 4

    char _FAR *categories[ NUM_VALUES ] = {
        "Jan", "Feb", "Mar", "Apr"
    };

    float values[ NUM_VALUES ] = {
        20, 45, 30, 25
    };

    char bricks[ 8 ] = {
        0xff, 0x80, 0x80, 0x80, 0xff, 0x08, 0x08, 0x08
    };

    main()
    {
        chartenv env;
        palettetype pal;

        _setvideomode( _VRES16COLOR );
        _pg_initchart();
        _pg_defaultchart( &env,
                          _PG_COLUMNCHART, _PG_PLAINBARS );
        strcpy( env.maintitle.title, "Column Chart" );
        /* get default palette and change 1st entry */
        _pg_getpalette( &pal );
        pal[ 1 ].color = 12;
        memcpy( pal[ 1 ].fill, bricks, 8 );
        /* use new palette */
        _pg_setpalette( &pal );
        _pg_chart( &env, categories, values, NUM_VALUES );
        /* reset palette to default */
        _pg_resetpalette();
        getch();
        _setvideomode( _DEFAULTMODE );
    }

Classification:
    PC Graphics

Systems:
    DOS, QNX

See Also:
    _pg_defaultchart, _pg_initchart, _pg_chart, _pg_chartpie,
    _pg_chartscatter, _pg_getpalette, _pg_resetpalette

See Also: _pg_defaultchart _pg_initchart

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson