Watcom C Library Reference : _pie, pie_w, pie_wxy, _polygon, _polygon_w, _polygon_wxy, pow

 

 

 

 

_pie, pie_w, pie_wxy

 

Synopsis : #include <graph.h> 

              short _FAR _pie( short fill, short x1, short y1,
                                 short x2, short y2,

                                 short x3, short y3,

                                 short x4, short y 4 );


              short _FAR _pie_w( short fill, double x1, double y1,
                                   double x2, double y2,

                                   double x3, double y3,

                                   double x4, double y4 );


              short _FAR _pie_wxy( short fill,       

                                      struct _wxycoord _FAR *p1, 

                                      struct _wxycoord _FAR *p2,

                                      struct _wxycoord _FAR *p3,

                                      struct _wxycoord _FAR *p4 );


Description : The _pie functions draw pie-shaped wedges. The _pie function uses the view coordinate system. The _pie_w and _pie_wxy functions use the window coordinate system.


The pie wedges are drawn by drawing an elliptical arc (in the way described for the _arc functions) and then joining the center of the rectangle that contains the ellipse to the two endpoints of the arc.


The elliptical arc is drawn with its center at the center of the rectangle established by the points (x1, y1) and (x2, y2). The arc is a segment of the ellipse drawn within this bounding rectangle. The arc starts at the point on this ellipse that intersects the vector from the centre of the ellipse to the point (x3, y3).

 

The arc ends at the point on this ellipse that intersects the vector from the centre of the ellipse to the point (x4, y4). The arc is drawn in a counter-clockwise direction with the current plot action using the current color and the current line style.


The following picture illustrates the way in which the bounding rectangle and the vectors specifying the start and end points are defined.

 

When the coordinates (x1, y1) and (x2 , y2) establish a line or a point this happens when one or more of the x-coordinates or y-coordinates are equal), nothing is drawn.


The argument fill determines whether the figure is filled in or has only its outline drawn. The argument can have one of two values:

 Constant  Meaning
 _GFILLINTERIOR  fill the interior by writing pixels with the current plot action using the current color and the current fill mask
 _GBORDER  leave the interior unchanged; draw the outline of the figure with the current plot action using the current color and line style

 


Returns : The _pie functions return a non-zero value when the figure was successfully drawn; otherwise, zero is returned.

 

 

See Also : _arc, _ellipse, _setcolor, _setfillmask, _setlinestyle, _setplotaction

 


Example :

#include <conio.h> 

#include <graph.h>


main( )

{
    _setvideomode( _VRES16COLOR );

    _pie(_GBORDER, 120, 90, 520, 390, 140, 20, 190, 460 ); 

   

    getch( );

    _setvideomode( _DEFAULTMODE );.

}

 


produces the following :

 

Classification : PC Graphics
Systems : _pie - DOS, QNX

             _pie_w - DOS, QNX

             _pie_wxy - DOS, QNX

 

 

 

 

 

 

 

_polygon, _polygon_w, _polygon_wxy

 

Synopsis : #include <graph.h> 

              short _FAR _polygon( short fill, short numpts, struct xycoord _FAR *points ) ;

              short _FAR _polygon_w( short fill, short numpts, double FAR *points );
              short _FAR _polygon_wxy( short fill, short numpts, struct _wxycoord _FAR *points );

 


Description : The _polygon functions draw polygons. The _polygon function uses the view coordinate system. The _polygon_w and _polygon_wxy functions use the window coordinate system.


The polygon is defined as containing numpts points whose coordinates are given in the array points.


The argument fill determines whether the polygon is filled in or has only its outline drawn. The argument can have one of two values:

 Constant  Meaning
 _GFILLINTERIOR  fill the interior by writing pixels with the current plot action using the current color and the current fill mask
 _GBORDER  leave the interior unchanged; draw the outline of the figure with the current plot action using the current color and line style

 


Returns : The _polygon functions return a non-zero value when the polygon was successfully drawn, otherwise, zero is returned.

 

 

See Also : _setcolor, _setfillmask, _setlinestyle, _setplotaction

 


Example :

#include <conio.h>

 #include <graph.h>


struct xycoord points[5] = { 319, 140, 224, 209, 261, 320, 378, 320, 415, 209 };

 

main( )

{
    _setvideomode( _VRES16COLOR );

    _polygon( _GBORDER, 5, &points );

 

    getch( );

    _setvideomode( _DEFAULTMODE );

}

 


produces the following :

Classification : PC Graphics
Systems : _polygon - DOS, QNX

             _polygon_w - DOS, QNX

             _polygon_wxy - DOS, QNX

 

 

 

 

 

 

 

pow

 

Synopsis : #include <math.h> 

              double pow( double x, double y );

 


Description : The pow function computes x raised to the power y. A domain error occurs if x is zero and y is less than or equal to 0, or if x is negative and y is not an integer. A range error may occur.

 

 

Returns : The pow function returns the value of x raised to the power y. When the argument is outside the permissible range, the matherr function is called. Unless the default matherr function is replaced, it will set the global variable errno to EDOM, and print a "DOMAIN error" diagnostic message using the stderr stream.

 

 

See Also : exp, log, sort

 


Example :

#include <stdio.h> 

#include <math.h>


void main( )

{
    printf( "%f\n", pow ( 1.5, 2.5 ) );

}

 


produces the following :
2.755676

 

Classification : ANSI
Systems : All

 

 

 

 

 

 

 

 

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 전화카드
,