# WoopsiUI::Gradient Class Reference

`#include <gradient.h>`

Inheritance diagram for WoopsiUI::Gradient:

List of all members.

## Public Member Functions
| Gradient (s16 x, s16 y, u16 width, u16 height, u16 fromColour, u16 toColour)
virtual void | draw (Rect clipRect)
virtual bool | resize (u16 width, u16 height)
## Protected Member Functions
virtual void | calculate ()
virtual void | cacheRowColours ()
virtual | ~Gradient ()
| Gradient (const Gradient &gradient)
## Protected Attributes
u16 | _fromColour
u16 | _toColour
s16 | _numberR
s16 | _numberG
s16 | _numberB
s16 | _deltaR
s16 | _deltaG
s16 | _deltaB
s16 * | _rowColour

## Detailed Description

Class providing a vertical gradient-filled background.

## Constructor & Destructor Documentation

WoopsiUI::Gradient::Gradient | ( | s16 | x,
|  | s16 | y,
|  | u16 | width,
|  | u16 | height,
|  | u16 | fromColour,
|  | u16 | toColour |
| ) |  |  |

Constructor.

Parameters:

  | x | The x co-ordinate of the gadget.
  | y | The y co-ordinate of the gadget.
  | width | The width of the gadget.
  | height | The height of the gadget.
  | fromColour | The start colour for the gradient (top colour).
  | toColour | The end colour for the gradient (bottom colour).

virtual WoopsiUI::Gradient::~Gradient | ( |  | ) | `[inline, protected, virtual]`

Destructor.

WoopsiUI::Gradient::Gradient | ( | const Gradient & | gradient | ) | `[inline, protected]`

Copy constructor is protected to prevent usage.

## Member Function Documentation

virtual void WoopsiUI::Gradient::cacheRowColours | ( |  | ) | `[protected, virtual]`

Precalculate the gradient colours to save processing time when drawing.

virtual void WoopsiUI::Gradient::calculate | ( |  | ) | `[protected, virtual]`

Precalculates the properties of the gradient to save processing time later.

virtual void WoopsiUI::Gradient::draw | ( | Rect | clipRect | ) | `[virtual]`

Draw the region of the gadget that falls within the clipping rectangle. Should not be called.

Parameters:

  | clipRect | The clipping region to draw within.

Reimplemented from WoopsiUI::Gadget.

virtual bool WoopsiUI::Gradient::resize | ( | u16 | width,
|  | u16 | height |
| ) |  |  | `[virtual]`

Resize the gadget and recalculate the gradient.

Parameters:

  | width | The new gadget width.
  | height | The new gadget height.

Reimplemented from WoopsiUI::Gadget.

## Member Data Documentation

s16 WoopsiUI::Gradient::_deltaB`[protected]`

Value that blue component is incremented at each new gradient step

s16 WoopsiUI::Gradient::_deltaG`[protected]`

Value that green component is incremented at each new gradient step

s16 WoopsiUI::Gradient::_deltaR`[protected]`

Value that red component is incremented at each new gradient step

u16 WoopsiUI::Gradient::_fromColour`[protected]`

Initial gradient colour

s16 WoopsiUI::Gradient::_numberB`[protected]`

Number of steps to get from start to finish colour in blue component

s16 WoopsiUI::Gradient::_numberG`[protected]`

Number of steps to get from start to finish colour in green component

s16 WoopsiUI::Gradient::_numberR`[protected]`

Number of steps to get from start to finish colour in red component

s16* WoopsiUI::Gradient::_rowColour`[protected]`

Array of precalculated gradient colours for each step

u16 WoopsiUI::Gradient::_toColour`[protected]`

Final gradient colour

The documentation for this class was generated from the following file:

- C:/Documents and Settings/Administrator/Desktop/woopsi-src-0.40/Woopsi/libwoopsi/include/gradient.h