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/pgdrawgradient.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/pgdrawgradient.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/pgdrawgradient.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/pgdrawgradient.html on line 8

PgDrawGradient(), PgDrawGradientCx()

Ask the graphics driver to render a gradient

Synopsis:

int PgDrawGradient( PhPoint_t *ul,
                    PhPoint_t *lr,
                    unsigned long gradient_type,
                    unsigned long transition_type,
                    unsigned long num_color_pts,
                    PgColor_t color1,
                    PgColor_t color2,
                    PgColor_t color3,
                    PgColor_t color4,
                    unsigned long table_size,
                    unsigned char *transition_table );

int PgDrawGradientCx( void *dc,
                      PhPoint_t *ul,
                      PhPoint_t *lr,
                      unsigned long gradient_type,
                      unsigned long transition_type,
                      unsigned long num_color_pts,
                      PgColor_t color1,
                      PgColor_t color2,
                      PgColor_t color3,
                      PgColor_t color4,
                      unsigned long table_size,
                      unsigned char *transition_table );

Arguments:

dc
PgDrawGradientCx() only. A void pointer to any type of draw context. Examples of draw contexts are:

Note: If the target offscreen context or device is of type Pg_IMAGE_PALETTE_BYTE, a filled rectangle will be drawn instead of a gradient.

ul, lr
Pointers to PhPoint_t structures that define the upper left and lower right corners of the rendering rectangle.
gradient_type
The type of gradient:

Boxy Gradients are similar to the nonboxy gradients, but are rendered using rectangles instead of horizontal lines while scaling the gradient information to the rendered rectangle. As a result, it takes less time to render boxy gradients. They don't look as precise as the nonboxy versions, but look cool anyway. ;-)

transition_type
One of the following:
num_color_pts
The resolution of the gradient. Basically it's the number of colors you want to have the driver calculate between the endpoint colors.
color1, color2, color3, color4
PgColor_t values that define the color endpoints.

The color3 and color4 arguments are used only in four-point gradients.

table_size
The size of the user-defined transition table. This needs to be set only if the transition type is Pg_GRAD_TABLE.
transition_table
A pointer to the user-defined transition table. This needs to be set only if the transition type is Pg_GRAD_TABLE.

Library:

ph

Description:

These functions request the graphics driver to render a gradient. PgDrawGradient() works on the current draw context, while you can specify the draw context for PgDrawGradientCx().

Returns:

0
Success.
-1
An error occurred.

Examples:

// Draw a basic horizontal gradient from blue to red,
// with 20 colors in a rectangle of size 100 x 200

PhRect_t GradRect={{0,0},{100,200}};

PgDrawGradient(&GradRect.ul,&GradRect.lr,Pg_GRAD_HORIZONTAL,
    Pg_GRAD_LINEAR,20,Pg_RED,Pg_BLUE,0,0,0,NULL);

Classification:

Photon

Safety:
Interrupt handler No
Signal handler No
Thread No

See also:

PgCalcColorContrast(), PgColor_t, PhPoint_t

Gradients 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/pgdrawgradient.html on line 292

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/pgdrawgradient.html on line 292