cairo-pattern {RGtk2} | R Documentation

## cairo_pattern_t

### Description

Sources for drawing

### Methods and Functions

`cairoPatternAddColorStopRgb(pattern, offset, red, green, blue)`
`cairoPatternAddColorStopRgba(pattern, offset, red, green, blue, alpha)`
`cairoPatternGetColorStopCount(pattern)`
`cairoPatternGetColorStopRgba(pattern, index)`
`cairoPatternCreateRgb(red, green, blue)`
`cairoPatternCreateRgba(red, green, blue, alpha)`
`cairoPatternGetRgba(pattern)`
`cairoPatternCreateForSurface(surface)`
`cairoPatternGetSurface(pattern)`
`cairoPatternCreateLinear(x0, y0, x1, y1)`
`cairoPatternGetLinearPoints(pattern)`
`cairoPatternCreateRadial(cx0, cy0, radius0, cx1, cy1, radius1)`
`cairoPatternGetRadialCircles(pattern)`
`cairoPatternStatus(pattern)`
`cairoPatternSetExtend(pattern, extend)`
`cairoPatternGetExtend(pattern)`
`cairoPatternSetFilter(pattern, filter)`
`cairoPatternGetFilter(pattern)`
`cairoPatternSetMatrix(pattern, matrix)`
`cairoPatternGetMatrix(pattern, matrix)`
`cairoPatternGetType(pattern)`
`cairoPatternSetUserData(pattern, key, user.data)`
`cairoPatternGetUserData(pattern, key)`
`cairoPattern(red, green, blue, alpha, surface, x0, y0, x1, y1, cx0, cy0, radius0, cx1, cy1, radius1)`

### Detailed Description

`CairoPattern` is the paint with which cairo draws. The primary use of patterns is as the source for all cairo drawing operations, although they can also be used as masks, that is, as the brush too.

A cairo pattern is created by using one of the many constructors, of the form cairo_pattern_create_type() or implicitly through cairo_set_source_type() functions.

### Structures

`CairoPattern`

  A `CairoPattern` represents a source when drawing onto a surface. There are different subtypes of `CairoPattern`, for different types of sources; for example, `cairoPatternCreateRgb` creates a pattern for a solid opaque color.

  Other than various cairo_pattern_create_type() functions, some of the pattern types can be implicitly created using various cairo_set_source_type() functions; for example `cairoSetSourceRgb`.

  The type of a pattern can be queried with `cairoPatternGetType`.

  Memory management of `CairoPattern` is done with `cairoPatternReference()` and `cairoPatternDestroy()`.

### Convenient Construction

`cairoPattern` is the result of collapsing the constructors of `cairo_pattern_t` (`cairoPatternCreateRgb`, `cairoPatternCreateRgba`, `cairoPatternCreateForSurface`, `cairoPatternCreateLinear`, `cairoPatternCreateRadial`) and accepts a subset of its arguments matching the required arguments of one of its delegate constructors.

### Enums and Flags

`CairoExtend`

  `CairoExtend` 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).

  The default extend mode is `CAIRO_EXTEND_NONE` for surface patterns and `CAIRO_EXTEND_PAD` for gradient patterns.

  New entries may be added in future versions.

  `none`

    pixels outside of the source pattern are fully transparent

  `repeat`

    the pattern is tiled by repeating

  `reflect`

    the pattern is tiled by reflecting at the edges (Implemented for surface patterns since 1.6)

`CairoFilter`

  `CairoFilter` is used to indicate what filtering should be applied when reading pixel values from patterns. See `cairoPatternSetSource()` for indicating the desired filter to be used with a particular pattern.

  `fast`

    A high-performance filter, with quality similar to `CAIRO_FILTER_NEAREST`

  `good`

    A reasonable-performance filter, with quality similar to `CAIRO_FILTER_BILINEAR`

  `best`

    The highest-quality available, performance may not be suitable for interactive use.

  `nearest`

    Nearest-neighbor filtering

  `bilinear`

    Linear interpolation in two dimensions

  `gaussian`

    This filter value is currently unimplemented, and should not be used in current code.

`CairoPatternType`

  `CairoPatternType` is used to describe the type of a given pattern.

  The type of a pattern is determined by the function used to create it. The `cairoPatternCreateRgb` and `cairoPatternCreateRgba` functions create SOLID patterns. The remaining cairo_pattern_create functions map to pattern types in obvious ways.

  The pattern type can be queried with `cairoPatternGetType`

  Most `CairoPattern` functions can be called with a pattern of any type, (though trying to change the extend or filter for a solid pattern will have no effect). A notable exception is `cairoPatternAddColorStopRgb` and `cairoPatternAddColorStopRgba` which must only be called with gradient patterns (either LINEAR or RADIAL). Otherwise the pattern will be shutdown and put into an error state.

  New entries may be added in future versions. Since 1.2

  `solid`

    The pattern is a solid (uniform) color. It may be opaque or translucent.

  `surface`

    The pattern is a based on a surface (an image).

  `linear`

    The pattern is a linear gradient.

  `radial`

    The pattern is a radial gradient.

### Author(s)

Derived by RGtkGen from GTK+ documentation

### References

https://www.cairographics.org/manual/cairo-cairo-pattern-t.html

[Package RGtk2 version 2.20.36.3 Index]