Draw a single line
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 );
ph
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().
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:
Photon
Safety: | |
---|---|
Interrupt handler | No |
Signal handler | No |
Thread | No |
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