# synfig::Gradient Class Reference

Color Gradient Class. More...

`#include <gradient.h>`

List of all members.

## Public Types

typedef GradientCPoint | CPoint
typedef vector< CPoint > | CPointList
typedef CPointList::const_iterator | const_iterator
typedef CPointList::iterator | iterator
typedef CPointList::const_reverse_iterator | const_reverse_iterator
typedef CPointList::reverse_iterator | reverse_iterator

## Public Member Functions

| Gradient ()
| Gradient (const Color &c1, const Color &c2)
| Two-Tone Color Gradient Convenience Constructor.
| Gradient (const Color &c1, const Color &c2, const Color &c3)
| Three-Tone Color Gradient Convenience Constructor.
void | sync ()
| Alias for sort (Implemented for consistency).
void | sort ()
| You should call this function after changing stuff.
void | push_back (const CPoint cpoint)
iterator | erase (iterator iter)
bool | empty () const
size_t | size () const
iterator | begin ()
iterator | end ()
reverse_iterator | rbegin ()
reverse_iterator | rend ()
const_iterator | begin () const
const_iterator | end () const
const_reverse_iterator | rbegin () const
const_reverse_iterator | rend () const
Gradient & | operator+= (const Gradient &rhs)
Gradient & | operator-= (const Gradient &rhs)
Gradient & | operator*= (const float &rhs)
Gradient & | operator/= (const float &rhs)
Gradient | operator+ (const Gradient &rhs) const
Gradient | operator- (const Gradient &rhs) const
Gradient | operator* (const float &rhs) const
Gradient | operator/ (const float &rhs) const
Color | operator() (const Real &x, float supersample=0) const
iterator | proximity (const Real &x)
| Returns the iterator of the CPoint closest to x.
const_iterator | proximity (const Real &x) const
| Returns the const_iterator of the CPoint closest to x.
iterator | find (const UniqueID &id)
| Returns the iterator of the CPoint with UniqueID id.
const_iterator | find (const UniqueID &id) const
| Returns the const_iterator of the CPoint with UniqueID id.

## Detailed Description

Color Gradient Class.

## Member Typedef Documentation

typedef GradientCPoint synfig::Gradient::CPoint

typedef vector<CPoint> synfig::Gradient::CPointList

typedef CPointList::const_iterator synfig::Gradient::const_iterator

typedef CPointList::iterator synfig::Gradient::iterator

typedef CPointList::const_reverse_iterator synfig::Gradient::const_reverse_iterator

typedef CPointList::reverse_iterator synfig::Gradient::reverse_iterator

## Constructor & Destructor Documentation

synfig::Gradient::Gradient | ( |  | ) | `[inline]`

Referenced by operator*(), operator+(), operator-(), and operator/().

synfig::Gradient::Gradient | ( | const Color & | c1,
|  | const Color & | c2 |
| ) |  |  |

Two-Tone Color Gradient Convenience Constructor.

References push_back().

synfig::Gradient::Gradient | ( | const Color & | c1,
|  | const Color & | c2,
|  | const Color & | c3 |
| ) |  |  |

Three-Tone Color Gradient Convenience Constructor.

References push_back().

## Member Function Documentation

void synfig::Gradient::sync | ( |  | ) | `[inline]`

Alias for sort (Implemented for consistency).

References sort().

void synfig::Gradient::sort | ( |  | ) |

You should call this function after changing stuff.

References begin(), and end().

Referenced by encode_gradient(), and sync().

void synfig::Gradient::push_back | ( | const CPoint | cpoint | ) | `[inline]`

Referenced by Gradient(), synfig::ValueNode_Stripes::operator()(), and synfig::ValueNode_Repeat_Gradient::operator()().

iterator synfig::Gradient::erase | ( | iterator | iter | ) | `[inline]`

bool synfig::Gradient::empty | ( |  | ) | const`[inline]`

size_t synfig::Gradient::size | ( |  | ) | const`[inline]`

iterator synfig::Gradient::begin | ( |  | ) | `[inline]`

Referenced by encode_gradient(), find(), synfig::ValueNode_Repeat_Gradient::operator()(), synfig::ValueNode_GradientRotate::operator()(), operator()(), operator+=(), proximity(), and sort().

iterator synfig::Gradient::end | ( |  | ) | `[inline]`

Referenced by encode_gradient(), find(), synfig::ValueNode_Repeat_Gradient::operator()(), synfig::ValueNode_GradientRotate::operator()(), operator()(), operator+=(), proximity(), and sort().

reverse_iterator synfig::Gradient::rbegin | ( |  | ) | `[inline]`

Referenced by synfig::ValueNode_Repeat_Gradient::operator()().

reverse_iterator synfig::Gradient::rend | ( |  | ) | `[inline]`

Referenced by synfig::ValueNode_Repeat_Gradient::operator()().

const_iterator synfig::Gradient::begin | ( |  | ) | const`[inline]`

const_iterator synfig::Gradient::end | ( |  | ) | const`[inline]`

const_reverse_iterator synfig::Gradient::rbegin | ( |  | ) | const`[inline]`

const_reverse_iterator synfig::Gradient::rend | ( |  | ) | const`[inline]`

Gradient & synfig::Gradient::operator+= | ( | const Gradient & | rhs | ) |

References begin(), synfig::GradientCPoint::color, cpoints, end(), synfig::GradientCPoint::pos, and show_gradient().

Gradient & synfig::Gradient::operator-= | ( | const Gradient & | rhs | ) |

Gradient & synfig::Gradient::operator*= | ( | const float & | rhs | ) |

Gradient & synfig::Gradient::operator/= | ( | const float & | rhs | ) |

Gradient synfig::Gradient::operator+ | ( | const Gradient & | rhs | ) | const`[inline]`

References Gradient().

Gradient synfig::Gradient::operator- | ( | const Gradient & | rhs | ) | const`[inline]`

References Gradient().

Gradient synfig::Gradient::operator* | ( | const float & | rhs | ) | const`[inline]`

References Gradient().

Gradient synfig::Gradient::operator/ | ( | const float & | rhs | ) | const`[inline]`

References Gradient().

Color synfig::Gradient::operator() | ( | const Real & | x,
|  | float | supersample = `0` |
| ) |  |  | const

As a future optimization, this could be performed faster using a binary search.

References synfig::Color::alpha(), begin(), synfig::Color::blend(), synfig::Color::BLEND_STRAIGHT, end(), synfig::error(), synfig::Color::get_a(), synfig::Color::get_b(), synfig::Color::get_g(), synfig::Color::get_r(), synfig::Color::is_valid(), synfig::Color::premult_alpha(), synfig::Color::set_b(), synfig::Color::set_g(), synfig::Color::set_r(), and supersample_helper().

synfig::Gradient::iterator synfig::Gradient::proximity | ( | const Real & | x | ) |

Returns the iterator of the CPoint closest to x.

References std::abs(), begin(), and end().

Referenced by proximity().

synfig::Gradient::const_iterator synfig::Gradient::proximity | ( | const Real & | x | ) | const

Returns the const_iterator of the CPoint closest to x.

References proximity().

synfig::Gradient::iterator synfig::Gradient::find | ( | const UniqueID & | id | ) |

Returns the iterator of the CPoint with UniqueID id.

References begin(), and end().

synfig::Gradient::const_iterator synfig::Gradient::find | ( | const UniqueID & | id | ) | const

Returns the const_iterator of the CPoint with UniqueID id.

References begin(), and end().

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

- gradient.h
- gradient.cpp