cairomm 1.16.1

Public Member Functions | Protected Member Functions | List of all members
Cairo::Gradient Class Reference

`#include <cairomm/pattern.h>`

Inheritance diagram for Cairo::Gradient:
[legend]

## Public Member Functions
| Gradient (cairo_pattern_t*cobject, bool has_reference=false)
| Create a C++ wrapper for the C instance. More...
| ~Gradient () override
void | add_color_stop_rgb (double offset, double red, double green, double blue)
| Adds an opaque color stop to a gradient pattern. More...
void | add_color_stop_rgba (double offset, double red, double green, double blue, double alpha)
| Adds a translucent color stop to a gradient pattern. More...
std::vector< ColorStop > | get_color_stops () const
| Gets the color stops and offsets for this Gradient. More...
Public Member Functions inherited from Cairo::Pattern
| Pattern (cairo_pattern_t*cobject, bool has_reference=false)
| Create a C++ wrapper for the C instance. More...
| Pattern (const Pattern&)=delete
Pattern& | operator= (const Pattern&)=delete
virtual | ~Pattern ()
void | set_matrix (const Matrix& matrix)
| Sets the pattern's transformation matrix to @matrix. More...
void | get_matrix (Matrix& matrix) const
| Returns the pattern's transformation matrix. More...
Matrix | get_matrix () const
| Returns the pattern's transformation matrix. More...
Type | get_type () const
| Returns the type of the pattern. More...
void | set_extend (Extend extend)
| Sets the mode to be used for drawing outside the area of a pattern. More...
Extend | get_extend () const
| Gets the current extend mode See Cairo::Extend for details on the semantics of each extend strategy. More...
cobject* | cobj ()
const cobject* | cobj () const
void | reference () const
void | unreference () const

## Protected Member Functions
| Gradient ()
Protected Member Functions inherited from Cairo::Pattern
| Pattern ()

## Additional Inherited Members
Public Types inherited from Cairo::Pattern
enum class | Type { SOLID = CAIRO_PATTERN_TYPE_SOLID , SURFACE = CAIRO_PATTERN_TYPE_SURFACE , LINEAR = CAIRO_PATTERN_TYPE_LINEAR , RADIAL = CAIRO_PATTERN_TYPE_RADIAL }
| Type is used to describe the type of a given pattern. More...
enum class | Extend { NONE = CAIRO_EXTEND_NONE , REPEAT = CAIRO_EXTEND_REPEAT , REFLECT = CAIRO_EXTEND_REFLECT , PAD = CAIRO_EXTEND_PAD }
| Cairo::Extend is used to describe how pattern color/alpha will be determined for areas "outside" the pattern's natural area, (for example, outside the surface bounds or outside the gradient geometry). More...
typedef cairo_pattern_t | cobject
Protected Attributes inherited from Cairo::Pattern
cobject* | m_cobject

## Constructor & Destructor Documentation

## ◆ Gradient() [1/2]

Cairo::Gradient::Gradient | ( | cairo_pattern_t * | cobject,
|  | bool | has_reference = `false`
| ) |  |
| explicit

Create a C++ wrapper for the C instance.

This C++ instance should then be given to a RefPtr.

Parameters

  cobject | The C instance.
  has_reference | Whether we already have a reference. Otherwise, the constructor will take an extra reference.

## ◆ ~Gradient()

Cairo::Gradient::~Gradient | ( |  | ) |
| override

## ◆ Gradient() [2/2]

Cairo::Gradient::Gradient | ( |  | ) |
| protected

## Member Function Documentation

## ◆ add_color_stop_rgb()

void Cairo::Gradient::add_color_stop_rgb | ( | double | offset,
|  | double | red,
|  | double | green,
|  | double | blue
| ) |  |

Adds an opaque color stop to a gradient pattern.

The offset specifies the location along the gradient's control vector. For example, a linear gradient's control vector is from (x0,y0) to (x1,y1) while a radial gradient's control vector is from any point on the start circle to the corresponding point on the end circle.

The color is specified in the same way as in Context::set_source_rgb().

If two (or more) stops are specified with identical offset values, they will be sorted according to the order in which the stops are added, (stops added earlier will compare less than stops added later). This can be useful for reliably making sharp color transitions instead of the typical blend.

Parameters

  offset | an offset in the range [0.0 .. 1.0]
  red | red component of color
  green | green component of color
  blue | blue component of color

## ◆ add_color_stop_rgba()

void Cairo::Gradient::add_color_stop_rgba | ( | double | offset,
|  | double | red,
|  | double | green,
|  | double | blue,
|  | double | alpha
| ) |  |

Adds a translucent color stop to a gradient pattern.

The offset specifies the location along the gradient's control vector. For example, a linear gradient's control vector is from (x0,y0) to (x1,y1) while a radial gradient's control vector is from any point on the start circle to the corresponding point on the end circle.

The color is specified in the same way as in Context::set_source_rgba().

If two (or more) stops are specified with identical offset values, they will be sorted according to the order in which the stops are added, (stops added earlier will compare less than stops added later). This can be useful for reliably making sharp color transitions instead of the typical blend.

Parameters

  offset | an offset in the range [0.0 .. 1.0]
  red | red component of color
  green | green component of color
  blue | blue component of color
  alpha | alpha component of color

## ◆ get_color_stops()

std::vector<ColorStop> Cairo::Gradient::get_color_stops | ( |  | ) | const

Gets the color stops and offsets for this Gradient.

Since
  1.4

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

- cairomm/pattern.h