![]() |
![]() |
![]() |
![]() |
Draw a list of spans
int PgDrawSpan( PgSpan_t const *ptr,
int num,
PhPoint_t const *pos,
int flags );
int PgDrawSpanv( PgSpan_t const *ptr,
int num,
PhPoint_t const *pos,
int flags );
int PgDrawSpanCx( void *dc,
PgSpan_t const *ptr,
int num,
PhPoint_t const *pos,
int flags );
int PgDrawSpanCxv( void *dc,
PgSpan_t const *ptr,
int num,
PhPoint_t const *pos,
int flags );
ph
These low-level draw primitives let you render complex shapes not supported by the Photon graphics drivers.
The functions draw a list of spans. The spans are defined as a list of PgSpan_t records. Here are the members of PgSpan_t:
The number of spans is defined by the num parameter. The location of the spans is offset by the pos parameter.
You can set flags to one of the following:
![]() |
If you call the “v” forms of this function, the data isn't physically copied into the draw buffer. Instead, a pointer to the list of spans is stored until the draw buffer is flushed. Make sure you call PgFlush() or PgFlushCx() before you modify the list. |
PgDrawSpan() and PgDrawSpanv() work on the current draw context, while you can specify the draw context dc for PgDrawSpanCx() and PgDrawSpanCxv().
The following example:
void DrawSpan() {
PgSpan_t spans[152];
PgSpan_t *sp = spans;
PhPoint_t p = { 12, 10 };
int i, v, n=0;
for (i=0; i<=100; i++) {
sp->x1 = (i*i)>>6;
v = 100 - i;
sp->x2 = 160 - ((v*v)>>6);
sp->y = i;
sp++; n++;
}
for (i=0; i<=50; i++) {
sp->x1 = 100 - ((i*i)>>6);
v = 50 - i;
sp->x2 = 60 + ((v*v)>>6);
sp->y = i+25;
sp++; n++;
}
PgSetFillColor( Pg_WHITE );
PgDrawSpan( spans, n, &p, Pg_DRAW_FILL );
}
will draw:
Photon
| Safety: | |
|---|---|
| Interrupt handler | No |
| Signal handler | No |
| Thread | No |
PgDrawPolygon*(), PgSetFillColor*(), PgSetStrokeColor*(), PgSetTextColor*(), PgFlush*(), PhPoint_t
“Arcs, ellipses, polygons, and rectangles” in the Raw Drawing and Animation chapter of the Photon Programmer's Guide
![]() |
![]() |
![]() |
![]() |