'_pg_setchardef func'에 해당되는 글 1건

  1. 2021.09.02 Watcom C Library : _pg_initchart, _pg_resetpalette, _pg_resetstyleset, _pg_setchardef

 

 

Watcom C Library Reference : _pg_initchart, _pg_resetpalette, _pg_resetstyleset, _pg_setchardef

 

 

 

 

_pg_initchart

 

Synopsis : #include <pgchart.h> 

              short _FAR _pg_initchart( void );

 


Description : The _pg_initchart function initializes the presentation graphics system. This includes initializing the internal palette and style-set used when drawing charts. This function must be called before any of the other presentation graphics functions.


The initialization of the presentation graphics system requires that a valid graphics mode has been selected. For this reason the _setvideomode function must be called before _pg_initchart is called. If a font has been selected (with the _setfont function), that font will be used when text is displayed in a chart. Font selection should also be done before initializing the presentation graphics system.

 

 

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

 

 

See Also : _pg_defaultchart, _pg_chart, _pg_chartpie, _pg_chartscatter, _setvideomode, _setfont, _registerfonts

 


Example :

#include <graph.h> 

#include <pgchart.h> 

#include <string.h> 

#include <conio.h>


#define NUM_VALUES     4


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


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


main( )

{
    charteny     eny;


    _setvideomode( _VRES16COLOR );

    _pg_initchart( );

    _pg_defaultchart ( &eny, _PG_COLUMNCHART, _PG_PLAINBARS ); 

    strcpy( env.maintitle.title, "Column Chart" );

    _pg_chart( &env, categories, values, NUM_VALUES );

 

    getch( );

    _setvideomode( _DEFAULTMODE );

}

 

Classification : PC Graphics
Systems : DOS, QNX

 

 

 

 

 

 

_pg_resetpalette

 

Synopsis : #include <pgchart.h> 

              short _FAR _pg_resetpalette( void );

 


Description : The _pg_resetpalette function resets the internal palette of the presentation graphics system to default values. The palette controls the colors, line styles, fill patterns and plot characters used to display each series of data in a chart. The default palette chosen is dependent on the current video mode.

 

 

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

 

 

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

 


Example :

#include <graph.h> 

#include <pgchart.h> 

#include <string.h> 

#include <conio.h>


#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( &eny, _PG_COLUMNCHART, _PG_PLAINBARS ); 

    strcpy( eny.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( &eny, categories, values, NUM_VALUES );

 

    /* reset palette to default */

    _pg_resetpalette( );

    getch( );

    _setvideomode( _DEFAULTMODE );

}

 

Classification : PC Graphics
Systems : DOS, QNX

 

 

 

 

 

 

_pg_resetstyleset

 

Synopsis : #include <pgchart.h> 

              void _FAR _pg_resetstyleset( void );

 


Description : The _pg_resetstyleset function resets the internal style-set of the presentation graphics system to default values. The style-set is a set of line styles used for drawing window borders and grid-lines.

 

 

Returns : The _pg_resetstyleset function does not return a value.

 

 

See Also : _pg_defaultchart, _pg_initchart, _pg_chart, _pg_chartpie, _pg_chartscatter, _pg_getstyleset, _pg_setstyleset

 


Example :

#include <graph.h> 

#include <pgchart.h> 

#include <string.h> 

#include <conio.h>


#define NUM_VALUES     4


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


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


main( )

{
    chartenv     env;

    styleset      style;


    _setvideomode( _VRES16COLOR );

    _pg_initchart( );

    _pg_defaultchart ( &eny, _PG_COLUMNCHART, _PG_PLAINBARS ); 

    strcpy( eny.maintitle.title, "Column Chart" );

 

    /* turn on yaxis grid, and use style 2 */

    env.yaxis.grid = 1;

    env.yaxis.gridstyle = 2;

 

    /* get default style-set and change entry 2 */

    _pg_getstyleset( &style );

    style[2] = 0x8888;

 

    /* use new style-set */

    _pg_setstyleset( &style );

    _pg_chart( &eny, categories, values, NUM_VALUES );

 

    /* reset style-set to default */

    _pg_resetstyleset( );

    getch( );

    _setvideomode( _DEFAULTMODE );

}

 

Classification : PC Graphices
Systems : DOS, QNX

 

 

 

 

 

 

_pg_setchardef

 

Synopsis : #include <pgchart.h> 

              short _FAR _pg_setchardef( short ch, unsigned char _FAR *def );


Description : The _pg_setchardef function sets the current bit-map definition for the character ch. The bit-map is contained in the array def. The current font must be an 8-by-8 bit-mapped font.

 

 

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

 

 

See Also :  _pg_defaultchart, _pg_initchart, _pg_chart, _pg_chartpie, _pg_chartscatter, _pg_getchardef

 


Example :

#include <graph.h> 

#include <pgchart.h> 

#include <string.h> 

#include <conio.h>


#define NUM_VALUES     4


float x[NUM_VALUES] = { 5, 25, 45, 65 };

float y[NUM_VALUES] = { 5, 45, 25, 65 };


char diamond[8] = { 0x10, 0x28, 0x44, 0x82, 0x44, 0x28, 0x10, 0x00 };


main( )

{

    charteny     env;

    char          old_def[8];


    _setvideomode( _VRES16COLOR );

    _pg_initchart( );

    _pg_defaultchart( &eny, _PG_SCATTERCHART, _PG_POINTANDLINE ); 

    strcpy( env.maintitle.title, "Scatter Chart" );

 

    /* change asterisk character to diamond */

    _pg_getchardef( '*', old_def );

    _pg_setchardef( '*', diamond );

    _pg_chartscatter( &env, x, y, NUM_VALUES );

    _pg_setchardef( '*', old_def );

 

    getch( );

    _setvideomode( _DEFAULTMODE );

}

 

Classification : PC Graphics
Systems : DOS, QNX

 

 

 

 

 

 

 

 

 

This manual describes the WATCOM C library for DOS, Windows, and OS/2, It includes the Standard C Library (as defined in the ANSI C Standard).

 

WATCOM C Language Reference manual describes the ANSI C Programming language and extensions to it which are supported by WATCOM C/C++ (32bit)

 

 

 

728x90
반응형
Posted by 전화카드
,