cairomm 1.18.0
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
Cairo::LinearGradient Class Reference

#include <cairomm/pattern.h>

Inheritance diagram for Cairo::LinearGradient:
Inheritance graph
[legend]

Public Member Functions

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

Static Public Member Functions

static RefPtr< LinearGradientcreate (double x0, double y0, double x1, double y1)
 Create a new linear gradient Cairo::Pattern along the line defined by (x0, y0) and (x1, y1).
 

Protected Member Functions

 LinearGradient (double x0, double y0, double x1, double y1)
 
- Protected Member Functions inherited from Cairo::Gradient
 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
cobjectm_cobject
 

Constructor & Destructor Documentation

◆ LinearGradient() [1/2]

Cairo::LinearGradient::LinearGradient ( double  x0,
double  y0,
double  x1,
double  y1 
)
protected

◆ LinearGradient() [2/2]

Cairo::LinearGradient::LinearGradient ( 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
cobjectThe C instance.
has_referenceWhether we already have a reference. Otherwise, the constructor will take an extra reference.

◆ ~LinearGradient()

Cairo::LinearGradient::~LinearGradient ( )
override

Member Function Documentation

◆ create()

static RefPtr< LinearGradient > Cairo::LinearGradient::create ( double  x0,
double  y0,
double  x1,
double  y1 
)
static

Create a new linear gradient Cairo::Pattern along the line defined by (x0, y0) and (x1, y1).

Before using the gradient pattern, a number of color stops should be defined using Cairo::Gradient::add_color_stop_rgb() or Cairo::Gradient::add_color_stop_rgba().

Note: The coordinates here are in pattern space. For a new pattern, pattern space is identical to user space, but the relationship between the spaces can be changed with Cairo::Pattern::set_matrix().

Parameters
x0x coordinate of the start point
y0y coordinate of the start point
x1x coordinate of the end point
y1y coordinate of the end point

◆ get_linear_points()

void Cairo::LinearGradient::get_linear_points ( double &  x0,
double &  y0,
double &  x1,
double &  y1 
) const
Parameters
x0return value for the x coordinate of the first point
y0return value for the y coordinate of the first point
x1return value for the x coordinate of the second point
y1return value for the y coordinate of the second point

Gets the gradient endpoints for a linear gradient.

Since
1.4

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