PgDrawLine(), PgDrawILine(), PgDrawLineCx(), PgDrawILineCx()

Draw a single line

Synopsis:

int  PgDrawLine( PhPoint_t const *p1,
                 PhPoint_t const *p2 );

int  PgDrawILine( int x1, int y1,
                  int x2, int y2 );

int  PgDrawLineCx( void *dc,
                   PhPoint_t const *p1,
                   PhPoint_t const *p2 );

int  PgDrawILineCx( void *dc,
                    int x1, int y1,
                    int x2, int y2 );

Library:

ph

Description:

These functions build a command in the draw buffer to draw a line. Note that PgDrawLine() and PgDrawLineCx() require two pointers to PhPoint_t structures, whereas PgDrawILine() and PgDrawILineCx() take individual arguments.

PgDrawLine() and PgDrawILine() work on the current draw context, while you can specify the draw context dc for PgDrawLineCx() and PgDrawILineCx().

Returns:

0
Success.
-1
The draw buffer is too small to hold the current draw state and the draw command.

Examples:

The following example:

DrawLines() {
    PgSetStrokeColor( Pg_RED );
    PgDrawILine( 8, 8, 152, 8 );
    PgSetStrokeColor( Pg_GREEN );
    PgDrawILine( 8, 8, 152, 60 );
    PgSetStrokeColor( Pg_YELLOW );
    PgDrawILine( 8, 8, 152, 112 );
}

will draw:

PgDrawLine

Classification:

Photon

Safety:
Interrupt handler No
Signal handler No
Thread No

See also:

PgSetStrokeCap*(), PgSetStrokeColor*(), PgSetStrokeDash*(), PgSetStrokeDither*(), PgSetStrokeJoin*(), PgSetStrokeWidth*(), PhPoint_t

Drawing attributes and Lines, pixels, and pixel arrays in the Raw Drawing and Animation chapter of the Photon Programmer's Guide