Warning: main(/www/www/htdocs/style/globals.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/photon/lib_ref/pg/pgdrawgrid.html on line 1
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/globals.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/photon/lib_ref/pg/pgdrawgrid.html on line 1
Warning: main(/www/www/htdocs/style/header.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/photon/lib_ref/pg/pgdrawgrid.html on line 8
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/header.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/photon/lib_ref/pg/pgdrawgrid.html on line 8
Draw a grid
int PgDrawGrid( PhRect_t const *r,
PhPoint_t const *g );
int PgDrawGridCx( void *dc,
PhRect_t const *r,
PhPoint_t const *g );
- dc
- PgDrawGridCx() only.
A void pointer to any type of draw context. Examples of draw contexts are:
- r
- A pointer to a PhRect_t structure that
defines the upper left and lower right corners of the grid box.
- g
- A pointer to a PhPoint_t
structure that defines the number of divisions in the grid. The number of lines drawn equals
the number of divisions plus 1.
ph
These functions draw a rectangular grid.
PgDrawGrid() works on the current
draw context, while you can specify the draw context for PgDrawGridCx().
These functions build a draw command to draw the grid. The
size of the grid is defined by the r
argument with g.x+1 vertical lines and
g.y+1 horizontal lines. If
g.x is 0, no vertical lines are
drawn; if g.y is 0, no horizontal
lines are drawn.
- 0
- Success.
- -1
- The draw buffer is too small to hold the current draw state and
the draw command.
The following example uses PgDrawGrid()
to make a grid of 8 squares by 8 squares; each square is 8 by 8
pixels:
void GridStandard() {
PhRect_t r = { 8, 8, 72, 72 };
PhPoint_t g = { 8, 8 };
PgSetStrokeColor( Pg_WHITE );
PgDrawGrid( &r, &g );
}
This code draws:
The following example uses PgDrawGrid()
to generate 20 ticks. Every 5th tick is made larger
by calling PgDrawGrid() again with
different parameters:
void GridTicks() {
PhRect_t r = { 8, 24, 108, 28 };
PhPoint_t g = { 20, 0 };
PgSetStrokeColor( Pg_WHITE );
PgDrawGrid( &r, &g );
r.ul.y-=1;
r.lr.y+=1;
g.x=4;
PgSetStrokeWidth( 3 );
PgSetStrokeCap( Pg_POINT_CAP );
PgDrawGrid( &r, &g );
PgSetStrokeWidth( 0 );
}
This code draws:
Photon
Safety: | |
Interrupt handler |
No |
Signal handler |
No |
Thread |
No |
PgSetStrokeCap*(),
PgSetStrokeColor*(),
PgSetStrokeDash*(),
PgSetStrokeDither*(),
PgSetStrokeJoin*(),
PgSetStrokeTransPat*(),
PgSetStrokeWidth*(),
PgSetStrokeXORColor*(),
PhPoint_t,
PhRect_t
“Drawing attributes”
and
“Lines, pixels, and pixel arrays”
in the Raw Drawing and Animation chapter of the
Photon Programmer's Guide
Warning: main(/www/www/htdocs/style/footer.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/photon/lib_ref/pg/pgdrawgrid.html on line 216
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/footer.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/photon/lib_ref/pg/pgdrawgrid.html on line 216