Gradient

Allows for gradient lighting, shadow and transparency effects.

float topLeftOpacity, float topRightOpacity,
float bottomRightOpacity, float bottomLeftOpacity )

Create a gradient mode with different opacity values for each Bitmap corner.

Rgba topLeft, Rgba topRight,
Rgba bottomRight, Rgba bottomLeft )

Create a gradient mode with different color channel cofficients for each Bitmap corner.

Examples

// Load a bitmap //
Bitmap myBmp( ... );

// Render the bitmap to the screen such as the top-left corner is at x = 200.0, y = 100.0 //
// and the transparency of the Bitmap changes gradually from full opaque (top) //
// to full transparent (bottom) //
myBmp.Blit200.0100.0Gradient1.01.00.00.0 ));


// Render the bitmap at the same position such as the lightness of the Bitmap changes gradually //
// from dark (lower-left corner) to normal brightness (top-right corner) //

Rgba lightnessInDark( 0.30.30.3 );
Rgba lightnessInBright( 1.01.01.0 );

// Make an even mix of the darkness and bright cofficients //
Rgba lightnessInMiddle = lightnessInDark.MixWith( lightnessInBright, 0.5 );

myBmp.Blit200.0100.0Gradient( lightnessInMiddle, lightnessInBright, lightnessInMiddle, lightnessInDark ));


Parent Class


Questions about Gradient? Click here.