PgDrawBeveled(), PgDrawBeveledCx()

Draw a beveled rectangle or arrow

Synopsis:

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

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

Arguments:

dc
PgDrawBeveledCx() and PgDrawIBevelBoxCx() only. A void pointer to any type of draw context. Examples of draw contexts are:
rect
A pointer to a PhRect_t that defines the area that the object fills.
radii
A pointer to a PhPoint_t structure. The interpretation of the contents of this structure depends on the flags.
secondary
A PgColor_t object that specifies the colors that you want to use for the lower and right edges of the object.
width
The thickness of the lines. When you increase the thickness, the lines grow toward the middle of the beveled object.
flags
Flags that control how the object is drawn; see below.

Library:

ph

Description:

These functions build a command in the draw buffer to draw a beveled rectangle or arrow. The flags parameter defines how the object is drawn, and includes options for defining the types of corners that it has. PgDrawBeveled() works on the current draw context, while you can specify the draw context for PgDrawBeveledCx().

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 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:

PgColor_t, PgDrawArrow*(), PgDrawBevelBox*(), PgDrawRect*(), PgDrawIRect*(), PgDrawRoundRect*(), PgSetFillColor*(), PgSetFillDither*(), PgSetFillTransPat*(), PgSetStrokeColor*(), PgSetStrokeDither*(), PgSetStrokeTransPat*(), PhPoint_t, PhRect_t

Arcs, ellipses, polygons, and rectangles in the Raw Drawing and Animation chapter of the Photon Programmer's Guide