![]() |
nomlib
|
Rectangle fill class with dithered, linear gradient colors. More...
#include <Gradient.hpp>
Public Types | |
| enum | FillDirection { Top = 0 , Bottom , Left , Right } |
| typedef Gradient | self_type |
| typedef Transformable | derived_class |
| typedef self_type * | raw_ptr |
| typedef std::unique_ptr< self_type > | unique_ptr |
| typedef std::shared_ptr< self_type > | shared_ptr |
| Public Types inherited from nom::Transformable | |
| typedef Transformable | self_type |
| Public Types inherited from nom::IDrawable | |
| typedef IDrawable | self_type |
| typedef self_type * | raw_ptr |
| A type definition for a C pointer – raw pointer – to an IDrawable object. | |
| typedef std::unique_ptr< self_type > | unique_ptr |
| A type definition for a C++11 std::unique_ptr to an IDrawable object. | |
| typedef std::shared_ptr< self_type > | shared_ptr |
| A type definition for a C++11 std::shared_ptr to an IDrawable object. | |
| typedef const RenderWindow | RenderTarget |
| Public Types inherited from nom::IObject | |
| typedef IObject | self_type |
| typedef IObject * | raw_ptr |
Public Member Functions | |
| Gradient (void) | |
| Default constructor; initialize the object to an invalid state. | |
| Gradient (const Color4iColors &colors, const Point2i &pos, const Size2i &size, const Point2i &margin, Gradient::FillDirection direction) | |
| Construct a complete object state. | |
| virtual | ~Gradient (void) |
| Destructor. | |
| IDrawable::raw_ptr | clone (void) const |
| Implements the required IDrawable::clone method. | |
| ObjectTypeInfo | type (void) const |
| Re-implements the IObject::type method. | |
| Texture * | texture () const |
| Get the underlying texture of the rendered gradient. | |
| bool | valid (void) const |
| Query the validity of the object. | |
| const Color4i & | start_color (void) const |
| Get the first (starting) color used in the gradient fill. | |
| const Color4i & | end_color (void) const |
| Get the last (ending) color used in the gradient fill. | |
| Gradient::FillDirection | fill_direction (void) const |
| bool | dithering (void) const |
| const Point2i & | margins (void) const |
| const Color4iColors & | colors (void) const |
| Get the gradient colors container. | |
| void | set_position (const Point2i &coords) |
| Re-implements the Transformable::set_position method. | |
| void | set_size (const Size2i &size) |
| Re-implements the Transformable::set_size method. | |
| void | set_colors (const Color4iColors &colors) |
| Set the gradient colors used in the rendering of the gradient fill. | |
| void | reverse_colors (void) |
| Swap the first and last color used in the gradient fill. | |
| void | set_fill_direction (Gradient::FillDirection direction) |
| void | set_margins (const Point2i &margin) |
| void | set_dithering (bool state) |
| void | draw (RenderTarget &target) const |
| Implements the IDrawable::draw method. | |
| Public Member Functions inherited from nom::Transformable | |
| Transformable (const Point2i &pos, const Size2i &size) | |
| Transformable (const IntRect &bounds) | |
| Construct an object using a complete set of coordinates (bounds). | |
| ObjectTypeInfo | type () const override |
| Re-implements the IObject::type method. | |
| const Point2i & | position (void) const |
| Getter for stored positioning coordinates. | |
| const Size2i & | size (void) const |
| Getter for stored size dimensions. | |
| virtual void | set_bounds (const IntRect &bounds) |
| Set the complete bounds of the object – position (X, Y) and size (width and height) dimensions. | |
| void | set_position (int x, int y) |
| void | set_size (int w, int h) |
| virtual void | translate (const Point2i &pos) |
| Public Member Functions inherited from nom::IDrawable | |
| IDrawable (void) | |
| Do nothing at all default constructor. | |
| virtual | ~IDrawable (void) |
| Do nothing at all destructor. | |
| Public Member Functions inherited from nom::IObject | |
| IObject (void) | |
| Default constructor. | |
| virtual | ~IObject (void) |
| Virtual destructor. | |
| virtual bool | is_type (const ObjectTypeInfo &rhs) const |
| Compare this object type with another object's type. | |
Private Member Functions | |
| void | update (void) |
| Implements the IDrawable::update method. | |
| void | strategy_top_down (void) |
| void | strategy_left_right (void) |
| bool | update_cache () |
| Synchronize the texture cache with the generated rectangles. | |
Private Attributes | |
| std::vector< Rectangle > | rectangles_ |
| Rectangles cache; this is used to build the texture cache. | |
| std::shared_ptr< Texture > | texture_ |
| Render cache for the gradient. | |
| Color4iColors | gradient_ |
| The starting & ending colors used in the gradient fill. | |
| Point2i | margins_ |
| Additional offset coordinates, in pixels. | |
| enum Gradient::FillDirection | fill_direction_ |
| Color fill axis – X or Y increment. | |
| bool | dithering_ |
| Dithering (of gradient colors) state. | |
Additional Inherited Members | |
| Static Public Member Functions inherited from nom::IObject | |
| template<typename Base, typename Derived> | |
| static bool | is_a (const Derived object) |
| Compare two objects to determine if a derived class inherits from a base class object. | |
| static void * | operator new (nom::size_type mem) |
| static void | operator delete (void *ptr) |
| Static Public Attributes inherited from nom::IObject | |
| static uint64 | total_alloc_bytes |
| static uint64 | total_dealloc_bytes |
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 51 of file Gradient.hpp.
| typedef Transformable nom::Gradient::derived_class |
Definition at line 56 of file Gradient.hpp.
| typedef self_type* nom::Gradient::raw_ptr |
Definition at line 58 of file Gradient.hpp.
| typedef Gradient nom::Gradient::self_type |
Definition at line 55 of file Gradient.hpp.
| typedef std::shared_ptr<self_type> nom::Gradient::shared_ptr |
Definition at line 60 of file Gradient.hpp.
| typedef std::unique_ptr<self_type> nom::Gradient::unique_ptr |
Definition at line 59 of file Gradient.hpp.
Definition at line 65 of file Gradient.hpp.
| nom::Gradient::Gradient | ( | void | ) |
Default constructor; initialize the object to an invalid state.
| nom::Gradient::Gradient | ( | const Color4iColors & | colors, |
| const Point2i & | pos, | ||
| const Size2i & | size, | ||
| const Point2i & | margin, | ||
| Gradient::FillDirection | direction ) |
Construct a complete object state.
| colors | The list of Color4i objects to be used in the gradient. |
|
virtual |
Implements the IDrawable::draw method.
Implements nom::IDrawable.
|
virtual |
Re-implements the Transformable::set_position method.
Reimplemented from nom::Transformable.
|
virtual |
Re-implements the Transformable::set_size method.
Reimplemented from nom::Transformable.
| Texture * nom::Gradient::texture | ( | ) | const |
Get the underlying texture of the rendered gradient.
|
virtual |
Re-implements the IObject::type method.
Reimplemented from nom::IDrawable.
|
privatevirtual |
Implements the IDrawable::update method.
Implements nom::IDrawable.
|
private |
Synchronize the texture cache with the generated rectangles.
| bool nom::Gradient::valid | ( | void | ) | const |
Query the validity of the object.
|
private |
Dithering (of gradient colors) state.
Definition at line 203 of file Gradient.hpp.
|
private |
Color fill axis – X or Y increment.
Definition at line 200 of file Gradient.hpp.
|
private |
The starting & ending colors used in the gradient fill.
Definition at line 194 of file Gradient.hpp.
|
private |
Additional offset coordinates, in pixels.
Definition at line 197 of file Gradient.hpp.
|
private |
Rectangles cache; this is used to build the texture cache.
Definition at line 180 of file Gradient.hpp.
|
private |
Render cache for the gradient.
Definition at line 187 of file Gradient.hpp.