[Previous] [Contents] [Index] [Next]

PgDrawBeveled()

Draw a beveled rectangle or arrow

Synopsis:

int  PgDrawBeveled( PhRect_t const *rect,
                    PhPoint_t const *radii,
                    PgColor_t secondary,
                    short width,
                    int flags );

Description:

This function builds a command in the draw buffer to draw a beveled rectangle or arrow. The rect parameter defines the area that the object will fill. The flags parameter defines how the object will be drawn, and includes options for defining the types of corners that it will have.

The upper and left edges of the object are drawn in the current stroke color; the lower and right edges are drawn in the secondary color.

The width argument determines the thickness of the lines. When you increase the thickness, the lines grow toward the middle of the beveled object.

The flags argument must be one of the following:

Pg_BEVEL_CLIP
Draw a box with clipped corners. The radii argument determines how much each corner is clipped.
Pg_BEVEL_ROUND
Draw a box with rounded corners. The radii argument determines how much each corner is rounded.
Pg_BEVEL_SQUARE
Draw a box with square corners (default). The radii argument isn't used with this option. The corners will look like those created by PgDrawBevelBox().
Pg_BEVEL_AUP
Draw an arrow pointing up. The radii argument isn't used with this option.
Pg_BEVEL_ADOWN
Draw an arrow pointing down. The radii argument isn't used with this option.
Pg_BEVEL_ALEFT
Draw an arrow pointing left. The radii argument isn't used with this option.
Pg_BEVEL_ARIGHT
Draw an arrow pointing right. The radii argument isn't used with this option.

You can OR the flags argument with one of the following:

You can also OR the flags argument with the following:

Returns:

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

Examples:

The following example:

DrawBeveled() {
    PhRect_t rc = { 8, 8, 152, 56 };
    PhRect_t rr = { 8, 64, 152, 112 };
    PhPoint_t pc = { 8, 8 };
    PhPoint_t pr = { 12, 12 };

    PgSetFillColor( Pg_GREY );
    PgSetStrokeColor( Pg_WHITE );
    PgDrawBeveled( &rc, &pc, Pg_DGREY, 2, 
                   Pg_DRAW_FILL_STROKE | Pg_BEVEL_CLIP );
    PgDrawBeveled( &rr, &pr, Pg_DGREY, 2, 
                   Pg_DRAW_FILL_STROKE | Pg_BEVEL_ROUND );
}

will draw:

PgDrawBeveled

The following example:

DrawBevelArrow() {
    PhRect_t rup = { 20, 4, 44, 16 };
    PhRect_t rdown = { 20, 48, 44, 60 };
    PhRect_t rleft = { 4, 20, 16, 44 };
    PhRect_t rright = { 48, 20, 60, 44 };
    
    PgSetFillColor( Pg_GREY );
    PgSetStrokeColor( Pg_WHITE );
    PgDrawBeveled( &rup, NULL, Pg_DGREY, 1, 
                       Pg_DRAW_FILL_STROKE | Pg_BEVEL_AUP );
    PgDrawBeveled( &rdown, NULL, Pg_DGREY, 1, 
                       Pg_DRAW_FILL_STROKE | Pg_BEVEL_ADOWN );
    PgDrawBeveled( &rleft, NULL, Pg_DGREY, 1, 
                       Pg_DRAW_FILL_STROKE | Pg_BEVEL_ALEFT );
    PgDrawBeveled( &rright, NULL, Pg_DGREY, 1, 
                       Pg_DRAW_FILL_STROKE | Pg_BEVEL_ARIGHT );
}

will draw:

PgDrawBeveled

Classification:

Photon

Safety:
Interrupt handler No
Signal handler No
Thread No

See also:

PgDrawBevelBox(), PgDrawRect(), PgDrawIRect(), PgDrawRoundRect(), PgSetFillColor(), PgSetFillDither(), PgSetFillTransPat(), PgSetStrokeColor(), PgSetStrokeDither(), PgSetStrokeTransPat()


[Previous] [Contents] [Index] [Next]