![]() |
![]() |
![]() |
![]() |
Ask the graphics driver to render a gradient
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 );
![]() |
If the target offscreen context or device is of type Pg_IMAGE_PALETTE_BYTE, a filled rectangle will be drawn instead of a 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. ;-)
The color3 and color4 arguments are used only in four-point gradients.
ph
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().
// 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);
Photon
| Safety: | |
|---|---|
| Interrupt handler | No |
| Signal handler | No |
| Thread | No |
PgCalcColorContrast(), PgColor_t, PhPoint_t
“Gradients” in the Raw Drawing and Animation chapter of the Photon Programmer's Guide
![]() |
![]() |
![]() |
![]() |