- nom
- Gradient
Rectangle fill class with dithered, linear gradient colors. More...
#include <Gradient.hpp>
Public Types | |
| enum | FillDirection { Top = 0, Bottom, Left, Right } |
| typedef std::shared_ptr< Gradient > | SharedPtr |
| typedef std::unique_ptr< Gradient > | UniquePtr |
| typedef Gradient * | RawPtr |
Public Types inherited from nom::IDrawable | |
|
typedef std::unique_ptr < IDrawable > | UniquePtr |
| std::unique_ptr definition type for your convenience, sir! | |
|
typedef std::shared_ptr < IDrawable > | SharedPtr |
| std::shared_ptr definition type at your leisure, sir! | |
|
typedef std::vector < std::shared_ptr< IDrawable > > | SharedDrawables |
| Vector of std::shared_ptr definition type for the brotherhood, sir! | |
|
typedef std::vector < std::unique_ptr< IDrawable > > | UniqueDrawables |
| std::unique_ptr vector container type | |
| typedef const Window & | RenderTarget |
Public Member Functions | |
| Gradient (void) | |
| Gradient (Color gradient_color[2], const Coords &bounds, int32 x_margin, int32 y_margin, Gradient::FillDirection direction) | |
| virtual | ~Gradient (void) |
| Destructor; OK to inherit me. | |
| void | initialize (Color gradient_color[2], const Coords &bounds, int32 x_margin, int32 y_margin, Gradient::FillDirection direction) |
| Fully initialize this object. | |
| const Coords | getPosition (void) const |
| const Coords | getSize (void) const |
| Color | getStartColor (void) const |
| Color | getEndColor (void) const |
| Gradient::FillDirection | getFillDirection (void) const |
| bool | dithering (void) const |
| void | setStartColor (const Color &starting_color) |
| void | setEndColor (const Color &ending_color) |
| void | reverseColors (void) |
| void | setFillDirection (Gradient::FillDirection direction) |
| void | setPosition (int32 x, int32 y) |
| void | setSize (int32 width, int32 height) |
| void | setMargins (int32 x, int32 y) |
| void | enableDithering (bool toggle) |
| void | update (void) |
| void | draw (RenderTarget target) const |
| Render the object onto the primary video buffer – your visible screen. | |
Public Member Functions inherited from nom::IDrawable | |
| IDrawable (void) | |
| Do nothing at all default constructor. | |
| virtual | ~IDrawable (void) |
| Do nothing at all destructor. | |
Private Member Functions | |
| void | strategyTopDown (void) |
| void | strategyLeftToRight (void) |
Private Attributes | |
| IDrawable::UniqueDrawables | rectangles |
| Color | gradient [2] |
| Coords | coords |
| Rendering coordinates (X, Y, width & height) | |
| int32 | x_margin |
| x coordinate offset | |
| int32 | y_margin |
| y coordinate offset | |
| enum Gradient::FillDirection | fill_direction |
| Color fill axis – X or Y increment. | |
| bool | enable_dithering |
| Toggle automatic dithering of colors. | |
Rectangle fill class with dithered, linear gradient colors.
nom::Gradient is a beautiful class that paints as rectangle coordinates would, but with dithered, linear gradient effects applied. Color range and fill direction are the two likely features of your interest.
Usage example:
Definition at line 48 of file Gradient.hpp.
Definition at line 60 of file Gradient.hpp.
| nom::Gradient::Gradient | ( | void | ) |
Default construct for initializing instance variables to their respective defaults.
Definition at line 33 of file Gradient.cpp.
| nom::Gradient::Gradient | ( | Color | gradient_color[2], |
| const Coords & | bounds, | ||
| int32 | x_margin, | ||
| int32 | y_margin, | ||
| Gradient::FillDirection | direction | ||
| ) |
Construct an object, fully initializing it.
Definition at line 45 of file Gradient.cpp.
|
virtual |
Intended to be used internally by the class re-implementing this method; for use in preparing the buffer to be drawn using the draw method call. Whereas both Update & Draw are typically publicly exposed to the end-user, only the Draw method call should be expected of the end-user to be explicitly called.
Implements nom::IDrawable.
Definition at line 209 of file Gradient.cpp.
|
private |
The starting & ending colors (nom::Color objects) used in the gradient.
Definition at line 129 of file Gradient.hpp.
|
private |
Drawables vector containing rectangle objects to be blit
Definition at line 120 of file Gradient.hpp.