### ----------------------------------------------------
### -- Gnome::Cairo
### -- Licenses: Artistic-2.0
### -- Authors: Marcel Timmerman
### -- File: lib/Gnome/Cairo/Pattern.rakumod
### ----------------------------------------------------
### -- Chunk 2 of 3
TM:1:_cairo_pattern_create_rgba:
#`{{
=begin pod
=head2 create-rgba

Creates a new B<cairo_pattern_t> corresponding to a translucent color. The color components are floating point numbers in the range 0 to 1.  If the values passed in are outside that range, they will be clamped.  Return value: the newly created B<cairo_pattern_t> if successful, or an error pattern in case of no memory.  The caller owns the returned object and should call C<clear-object()> when finished with it.  This function will always return a valid pointer, but if an error occurred the pattern status will be set to an error.  To inspect the status of a pattern use C<status()>.

  method create-rgba ( Num $red, Num $green, Num $blue, Num $alpha --> cairo_pattern_t )

=item Num $red;  cairo_pattern_create_rgba:
=item Num $green; red component of the color
=item Num $blue; green component of the color
=item Num $alpha; blue component of the color
=end pod

method create-rgba ( Num $red, Num $green, Num $blue, Num $alpha --> cairo_pattern_t ) {

  cairo_pattern_create_rgba(
    self._get-native-object-no-reffing, $red, $green, $blue, $alpha
  )
}
}}

sub _cairo_pattern_create_rgba (
  gdouble $red, gdouble $green, gdouble $blue, gdouble $alpha --> cairo_pattern_t
) is native(&cairo-lib)
  is symbol('cairo_pattern_create_rgba')
  { * }

#-------------------------------------------------------------------------------
#TM:1:_cairo_pattern_destroy:
#`{{
=begin pod
=head2 destroy

Decreases the reference count on I<pattern> by one. If the result is zero, then I<pattern> and all associated resources are freed.  See C<reference()>.

  method destroy ( )

=end pod

method destroy ( ) {

  _cairo_pattern_destroy(
    self._get-native-object-no-reffing,
  )
}
}}

sub _cairo_pattern_destroy (
  cairo_pattern_t $pattern
) is native(&cairo-lib)
  is symbol('cairo_pattern_destroy')
  { * }

#-------------------------------------------------------------------------------
#TM:2:get-color-stop-count:
=begin pod
=head2 get-color-stop-count

Gets the number of color stops specified in the given gradient pattern.

  method get-color-stop-count ( --> List )

List returns;
=item $count; return value for the number of color stops, or C<Any>
=item cairo_status_t; values can be C<CAIRO_STATUS_SUCCESS>, or C<CAIRO_STATUS_PATTERN_TYPE_MISMATCH> if I<pattern> is not a gradient pattern.
=end pod

method get-color-stop-count ( --> List ) {
  my gint $count;
  my GEnum $s = cairo_pattern_get_color_stop_count(
    self._get-native-object-no-reffing, $count
  );

  ( $count, cairo_status_t($s) )
}

sub cairo_pattern_get_color_stop_count (
  cairo_pattern_t $pattern, gint $count is rw --> GEnum
) is native(&cairo-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:get-color-stop-rgba:
=begin pod
=head2 get-color-stop-rgba

Gets the color and offset information at the given I<index> for a gradient pattern.  Values of I<index> range from 0 to n-1 where n is the number returned by C<get-color-stop-count()>.

  method get-color-stop-rgba ( Int $index --> List )

=item $index; index of the stop to return data for

The List returns;
=item $offset; return value for the offset of the stop, or C<Any>
=item $red; return value for red component of color, or C<Any>
=item $green; return value for green component of color, or C<Any>
=item $blue; return value for blue component of color, or C<Any>
=item $alpha; return value for alpha component of color, or C<Any>
=item cairo_status_t; values can be C<CAIRO_STATUS_SUCCESS>, or C<CAIRO_STATUS_INVALID_INDEX> if I<index> is not valid for the given pattern.  If the pattern is not a gradient pattern, C<CAIRO_STATUS_PATTERN_TYPE_MISMATCH>
=end pod

method get-color-stop-rgba ( Int $index --> List ) {
  my gdouble $offset;
  my gdouble $red;
  my gdouble $green;
  my gdouble $blue;
  my gdouble $alpha;
  my GEnum $s = cairo_pattern_get_color_stop_rgba(
    self._get-native-object-no-reffing, $index, $offset, $red, $green, $blue, $alpha
  );

  ( Num($offset), Num($red), Num($green), Num($blue), Num($alpha), cairo_status_t($s) )
}

sub cairo_pattern_get_color_stop_rgba (
  cairo_pattern_t $pattern, int32 $index, gdouble $offset is rw, gdouble $red is rw, gdouble $green is rw, gdouble $blue is rw, gdouble $alpha is rw
  --> GEnum
) is native(&cairo-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:get-extend:
=begin pod
=head2 get-extend

Gets the current extend mode for a pattern. See B<cairo_extend_t> for details on the semantics of each extend strategy.

Return value: the current extend strategy used for drawing the pattern.

  method get-extend ( --> cairo_extend_t )

=end pod

method get-extend ( --> cairo_extend_t ) {
  cairo_pattern_get_extend(self._get-native-object-no-reffing)
}

sub cairo_pattern_get_extend (
  cairo_pattern_t $pattern --> GEnum
) is native(&cairo-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:get-filter:
=begin pod
=head2 get-filter

Gets the current filter for a pattern. See B<cairo_filter_t> for details on each filter.

Return value: the current filter used for resizing the pattern.

  method get-filter ( --> cairo_filter_t )

=end pod

method get-filter ( --> cairo_filter_t ) {
  cairo_pattern_get_filter(self._get-native-object-no-reffing)
}

sub cairo_pattern_get_filter (
  cairo_pattern_t $pattern --> GEnum
) is native(&cairo-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:get-linear-points:
=begin pod
=head2 get-linear-points

Gets the gradient endpoints for a linear gradient.

  method get-linear-points ( --> List )

List returns;
=item $x0; return value for the x coordinate of the first point, or C<Any>
=item $y0; return value for the y coordinate of the first point, or C<Any>
=item $x1; return value for the x coordinate of the second point, or C<Any>
=item $y1; return value for the y coordinate of the second point, or C<Any>
=item cairo_status_t; values can be C<CAIRO_STATUS_SUCCESS>, or C<CAIRO_STATUS_PATTERN_TYPE_MISMATCH> if I<pattern> is not a linear gradient pattern.
=end pod

method get-linear-points ( --> List ) {

  my gdouble $x0;
  my gdouble $y0;
  my gdouble $x1;
  my gdouble $y1;

  my GEnum $s = cairo_pattern_get_linear_points(
    self._get-native-object-no-reffing, $x0, $y0, $x1, $y1
  );

  ( Num($x0), Num($y0), Num($x1), Num($y1), cairo_status_t($s) )
}

sub cairo_pattern_get_linear_points (
  cairo_pattern_t $pattern, gdouble $x0 is rw, gdouble $y0 is rw, gdouble $x1 is rw, gdouble $y1 is rw --> GEnum
) is native(&cairo-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:get-matrix:
=begin pod
=head2 get-matrix

Returns the pattern's transformation matrix

  method get-matrix ( --> cairo_matrix_t )

=end pod

method get-matrix ( --> cairo_matrix_t ) {
  my cairo_matrix_t $matrix .= new;
  cairo_pattern_get_matrix( self._get-native-object-no-reffing, $matrix);

  $matrix
}

sub cairo_pattern_get_matrix (
  cairo_pattern_t $pattern, cairo_matrix_t $matrix
) is native(&cairo-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:get-radial-circles:
=begin pod
=head2 get-radial-circles

Gets the gradient endpoint circles for a radial gradient, each specified as a center coordinate and a radius.

  method get-radial-circles ( --> List )

=item $x0; return value for the x coordinate of the center of the first circle, or C<Any>
=item $y0; return value for the y coordinate of the center of the first circle, or C<Any>
=item $r0; return value for the radius of the first circle, or C<Any>
=item $x1; return value for the x coordinate of the center of the second circle, or C<Any>
=item $y1; return value for the y coordinate of the center of the second circle, or C<Any>
=item $r1; return value for the radius of the second circle, or C<Any>
=item cairo_status_t; value can be C<CAIRO_STATUS_SUCCESS>, or C<CAIRO_STATUS_PATTERN_TYPE_MISMATCH> if I<pattern> is not a radial gradient pattern.
=end pod

method get-radial-circles ( --> List ) {
  my gdouble $x0;
  my gdouble $y0;
  my gdouble $r0;
  my gdouble $x1;
  my gdouble $y1;
  my gdouble $r1;

  my GEnum $s = cairo_pattern_get_radial_circles(
    self._get-native-object-no-reffing, $x0, $y0, $r0, $x1, $y1, $r1
  );

  ( $x0, $y0, $r0, $x1, $y1, $r1, cairo_status_t($s) )
}

sub cairo_pattern_get_radial_circles (
  cairo_pattern_t $pattern, gdouble $x0 is rw, gdouble $y0 is rw, gdouble $r0 is rw, gdouble $x1 is rw, gdouble $y1 is rw, gdouble $r1 is rw --> GEnum
) is native(&cairo-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:get-reference-count:
#`{{
=begin pod
=head2 get-reference-count

Returns the current reference count of I<pattern>.  Return value: the current reference count of I<pattern>.  If the object is a nil object, 0 will be returned.

  method get-reference-count ( --> Int )

=end pod

method get-reference-count ( --> Int ) {
  cairo_pattern_get_reference_count(self._get-native-object-no-reffing)
}
}}

sub _cairo_pattern_get_reference_count (
  cairo_pattern_t $pattern --> guint
) is native(&cairo-lib)
  is symbol('cairo_pattern_get_reference_count')
  { * }

#-------------------------------------------------------------------------------
#TM:0:get-rgba:
=begin pod
=head2 get-rgba

Gets the solid color for a solid color pattern.

  method get-rgba ( --> List )

=item $red; return value for red component of color, or C<Any>
=item $green; return value for green component of color, or C<Any>
=item $blue; return value for blue component of color, or C<Any>
=item $alpha; return value for alpha component of color, or C<Any>
=item cairo_status_t; value can be C<CAIRO_STATUS_SUCCESS>, or C<CAIRO_STATUS_PATTERN_TYPE_MISMATCH> if the pattern is not a solid color pattern.
=end pod

method get-rgba ( --> List ) {
  my gdouble $red;
  my gdouble $green;
  my gdouble $blue;
  my gdouble $alpha;

  my GEnum $s = cairo_pattern_get_rgba(
    self._get-native-object-no-reffing, $red, $green, $blue, $alpha
  );

  ( $red, $green, $blue, $alpha, cairo_status_t($s) )
}

sub cairo_pattern_get_rgba (
  cairo_pattern_t $pattern, gdouble $red, gdouble $green, gdouble $blue, gdouble $alpha --> GEnum
) is native(&cairo-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:get-surface:
=begin pod
=head2 get-surface

Gets the surface of a surface pattern.  The reference returned in I<surface> is owned by the pattern; the caller should call C<surface-reference()> if the surface is to be retained.

  method get-surface ( --> List )

List holds;
=item Gnome::Cairo::Surface; surface of pattern, or C<Any>
=item cairo_status_t; value can be C<CAIRO_STATUS_SUCCESS>, or C<CAIRO_STATUS_PATTERN_TYPE_MISMATCH> if the pattern is not a surface pattern.

=end pod

method get-surface ( --> List ) {
  my cairo_surface_t $surface .= new;
  my GEnum $s = cairo_pattern_get_surface(
    self._get-native-object-no-reffing, $surface
  );

  ( self._wrap-native-type( 'Gnome::Cairo::Surface', $surface),
    cairo_status_t($s)
  )
}

sub cairo_pattern_get_surface (
  cairo_pattern_t $pattern, cairo_surface_t $surface --> GEnum
) is native(&cairo-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:get-type:
=begin pod
=head2 get-type

Get the pattern's type. See B<cairo_pattern_type_t> for available types.  Return value: The type of I<pattern>.

  method get-type ( --> cairo_pattern_type_t )

=end pod

method get-type ( --> cairo_pattern_type_t ) {
  cairo_pattern_type_t(
    cairo_pattern_get_type(self._get-native-object-no-reffing,)
  )
}

sub cairo_pattern_get_type (
  cairo_pattern_t $pattern --> GEnum
) is native(&cairo-lib)
  { * }

#`{{
#-------------------------------------------------------------------------------
#TM:0:get-user-data:
=begin pod
=head2 get-user-data

Return user data previously attached to I<pattern> using the specified key.  If no user data has been attached with the given key this function returns C<Any>.  Return value: the user data previously attached or C<Any>.

  method get-user-data ( cairo_user_data_key_t $key )

=item cairo_user_data_key_t $key; a B<cairo_pattern_t>
=end pod

method get-user-data ( cairo_user_data_key_t $key ) {

  cairo_pattern_get_user_data(
    self._get-native-object-no-reffing, $key
  )
}

sub cairo_pattern_get_user_data (
  cairo_pattern_t $pattern, cairo_user_data_key_t $key
) is native(&cairo-lib)
  { * }
}}

#-------------------------------------------------------------------------------
#TM:0:mesh-begin-patch:
=begin pod
=head2 mesh-begin-patch

Begin a patch in a mesh pattern.  After calling this function, the patch shape should be defined with C<mesh-move-to()>, C<mesh-line-to()> and C<mesh-curve-to()>.  After defining the patch, C<mesh-end-patch()> must be called before using I<pattern> as a source or mask.  Note: If I<pattern> is not a mesh pattern then I<pattern> will be put into an error status with a status of C<CAIRO_STATUS_PATTERN_TYPE_MISMATCH>. If I<pattern> already has a current patch, it will be put into an error status with a status of C<CAIRO_STATUS_INVALID_MESH_CONSTRUCTION>.

  method mesh-begin-patch ( )

=end pod

method mesh-begin-patch ( ) {
  cairo_mesh_pattern_begin_patch(self._get-native-object-no-reffing)
}

sub cairo_mesh_pattern_begin_patch (
  cairo_pattern_t $pattern
) is native(&cairo-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:mesh-curve-to:
=begin pod
=head2 mesh-curve-to

Adds a cubic Bézier spline to the current patch from the current point to position (I<x3>, I<y3>) in pattern-space coordinates, using (I<x1>, I<y1>) and (I<x2>, I<y2>) as the control points.  If the current patch has no current point before the call to C<mesh-curve-to()>, this function will behave as if preceded by a call to cairo_mesh_pattern_move_to(I<pattern>, I<x1>, I<y1>).  After this call the current point will be (I<x3>, I<y3>).  Note: If I<pattern> is not a mesh pattern then I<pattern> will be put into an error status with a status of C<CAIRO_STATUS_PATTERN_TYPE_MISMATCH>. If I<pattern> has no current patch or the current patch already has 4 sides, I<pattern> will be put into an error status with a status of C<CAIRO_STATUS_INVALID_MESH_CONSTRUCTION>.

  method mesh-curve-to (
    Num $x1, Num $y1, Num $x2, Num $y2, Num $x3, Num $y3
  )

=item $x1; the X coordinate of the first control point
=item $y1; the Y coordinate of the first control point
=item $x2; the X coordinate of the second control point
=item $y2; the Y coordinate of the second control point
=item $x3; the X coordinate of the end of the curve
=item $y3; the Y coordinate of the end of the curve
=end pod

method mesh-curve-to ( Num $x1, Num $y1, Num $x2, Num $y2, Num $x3, Num $y3 ) {

  cairo_mesh_pattern_curve_to(
    self._get-native-object-no-reffing, $x1, $y1, $x2, $y2, $x3, $y3
  )
}

sub cairo_mesh_pattern_curve_to (
  cairo_pattern_t $pattern, gdouble $x1, gdouble $y1, gdouble $x2, gdouble $y2, gdouble $x3, gdouble $y3
) is native(&cairo-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:mesh-end-patch:
=begin pod
=head2 mesh-end-patch

Indicates the end of the current patch in a mesh pattern.  If the current patch has less than 4 sides, it is closed with a straight line from the current point to the first point of the patch as if C<mesh-line-to()> was used.  Note: If I<pattern> is not a mesh pattern then I<pattern> will be put into an error status with a status of C<CAIRO_STATUS_PATTERN_TYPE_MISMATCH>. If I<pattern> has no current patch or the current patch has no current point, I<pattern> will be put into an error status with a status of C<CAIRO_STATUS_INVALID_MESH_CONSTRUCTION>.

  method mesh-end-patch ( )

=end pod

method mesh-end-patch ( ) {

  cairo_mesh_pattern_end_patch(
    self._get-native-object-no-reffing,
  )
}

sub cairo_mesh_pattern_end_patch (
  cairo_pattern_t $pattern
) is native(&cairo-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:mesh-get-control-point:
=begin pod
=head2 mesh-get-control-point

Gets the control point I<point_num> of patch I<patch_num> for a mesh pattern.  I<patch_num> can range from 0 to n-1 where n is the number returned by C<mesh_pattern-get-patch-count()>.  Valid values for I<point_num> are from 0 to 3 and identify the control points as explained in C<create-mesh()>.  Return value: C<CAIRO_STATUS_SUCCESS>, or C<CAIRO_STATUS_INVALID_INDEX> if I<patch_num> or I<point_num> is not valid for I<pattern>. If I<pattern> is not a mesh pattern, C<CAIRO_STATUS_PATTERN_TYPE_MISMATCH> is returned.

  method mesh-get-control-point ( Int $patch_num, Int $point_num, Num $x, Num $y --> cairo_status_t )

=item Int $patch_num; a B<cairo_pattern_t>
=item Int $point_num; the patch number to return data for
=item Num $x; the control point number to return data for
=item Num $y; return value for the x coordinate of the control point, or C<Any>
=end pod

method mesh-get-control-point ( Int $patch_num, Int $point_num, Num $x, Num $y --> cairo_status_t ) {

  cairo_mesh_pattern_get_control_point(
    self._get-native-object-no-reffing, $patch_num, $point_num, $x, $y
  )
}

sub cairo_mesh_pattern_get_control_point (
  cairo_pattern_t $pattern, guint $patch_num, guint $point_num, gdouble $x, gdouble $y --> GEnum
) is native(&cairo-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:mesh-get-corner-color-rgba:
=begin pod
=head2 mesh-get-corner-color-rgba

Gets the color information in corner I<corner_num> of patch I<patch_num> for a mesh pattern.  I<patch_num> can range from 0 to n-1 where n is the number returned by C<mesh-get-patch-count()>.  Valid values for I<corner_num> are from 0 to 3 and identify the corners as explained in C<create-mesh()>.  Return value: C<CAIRO_STATUS_SUCCESS>, or C<CAIRO_STATUS_INVALID_INDEX> if I<patch_num> or I<corner_num> is not valid for I<pattern>. If I<pattern> is not a mesh pattern, C<CAIRO_STATUS_PATTERN_TYPE_MISMATCH> is returned.

  method mesh-get-corner-color-rgba ( Int $patch_num, Int $corner_num, Num $red, Num $green, Num $blue, Num $alpha --> cairo_status_t )

=item Int $patch_num; a B<cairo_pattern_t>
=item Int $corner_num; the patch number to return data for
=item Num $red; the corner number to return data for
=item Num $green; return value for red component of color, or C<Any>
=item Num $blue; return value for green component of color, or C<Any>
=item Num $alpha; return value for blue component of color, or C<Any>
=end pod

method mesh-get-corner-color-rgba ( Int $patch_num, Int $corner_num, Num $red, Num $green, Num $blue, Num $alpha --> cairo_status_t ) {

  cairo_mesh_pattern_get_corner_color_rgba(
    self._get-native-object-no-reffing, $patch_num, $corner_num, $red, $green, $blue, $alpha
  )
}

sub cairo_mesh_pattern_get_corner_color_rgba (
  cairo_pattern_t $pattern, guint $patch_num, guint $corner_num, gdouble $red, gdouble $green, gdouble $blue, gdouble $alpha --> GEnum
) is native(&cairo-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:mesh-get-patch-count:
=begin pod
=head2 mesh-get-patch-count

Gets the number of patches specified in the given mesh pattern. The number only includes patches which have been finished by calling C<mesh-end-patch()>. For example it will be 0 during the definition of the first patch.

  method mesh-get-patch-count ( --> List )

Returned List holds;
=item Int; The count of patches
=item cairo_status_t; The status, C<CAIRO_STATUS_SUCCESS>, or C<CAIRO_STATUS_PATTERN_TYPE_MISMATCH> if I<pattern> is not a mesh pattern.
=end pod

method mesh-get-patch-count ( --> List ) {
  my guint $count;
  my GEnum  $s = cairo_status_t(
    cairo_mesh_pattern_get_patch_count(
      self._get-native-object-no-reffing, $count
    )
  );

  ( $count, $s)
}

sub cairo_mesh_pattern_get_patch_count (
  cairo_pattern_t $pattern, guint $count is rw --> GEnum
) is native(&cairo-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:mesh-get-path:
=begin pod
=head2 mesh-get-path

Gets path defining the patch I<patch_num> for a mesh pattern.  I<patch_num> can range from 0 to n-1 where n is the number returned by C<mesh-get-patch-count()>.  Return value: the path defining the patch, or a path with status C<CAIRO_STATUS_INVALID_INDEX> if I<patch_num> or I<point_num> is not valid for I<pattern>. If I<pattern> is not a mesh pattern, a path with status C<CAIRO_STATUS_PATTERN_TYPE_MISMATCH> is returned.

  method mesh-get-path ( Int $patch_num --> cairo_path_t )

=item Int $patch_num; a B<cairo_pattern_t>
=end pod

method mesh-get-path ( Int $patch_num --> cairo_path_t ) {

  cairo_mesh_pattern_get_path(
    self._get-native-object-no-reffing, $patch_num
  )
}

sub cairo_mesh_pattern_get_path (
  cairo_pattern_t $pattern, guint $patch_num --> cairo_path_t
) is native(&cairo-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:mesh-line-to:
=begin pod
=head2 mesh-line-to

Adds a line to the current patch from the current point to position (I<x>, I<y>) in pattern-space coordinates.  If there is no current point before the call to C<mesh-line-to()> this function will behave as cairo_mesh_pattern_move_to(I<pattern>, I<x>, I<y>).  After this call the current point will be (I<x>, I<y>).  Note: If I<pattern> is not a mesh pattern then I<pattern> will be put into an error status with a status of C<CAIRO_STATUS_PATTERN_TYPE_MISMATCH>. If I<pattern> has no current patch or the current patch already has 4 sides, I<pattern> will be put into an error status with a status of C<CAIRO_STATUS_INVALID_MESH_CONSTRUCTION>.

  method mesh-line-to ( Num $x, Num $y )

=item Num $x; a B<cairo_pattern_t>
=item Num $y; the X coordinate of the end of the new line
=end pod

method mesh-line-to ( Num $x, Num $y ) {

  cairo_mesh_pattern_line_to(
    self._get-native-object-no-reffing, $x, $y
  )
}

sub cairo_mesh_pattern_line_to (
  cairo_pattern_t $pattern, gdouble $x, gdouble $y
) is native(&cairo-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:mesh-move-to:
=begin pod
=head2 mesh-move-to

Define the first point of the current patch in a mesh pattern.  After this call the current point will be (I<x>, I<y>).  Note: If I<pattern> is not a mesh pattern then I<pattern> will be put into an error status with a status of C<CAIRO_STATUS_PATTERN_TYPE_MISMATCH>. If I<pattern> has no current patch or the current patch already has at least one side, I<pattern> will be put into an error status with a status of C<CAIRO_STATUS_INVALID_MESH_CONSTRUCTION>.

  method mesh-move-to ( Num $x, Num $y )

=item Num $x; a B<cairo_pattern_t>
=item Num $y; the X coordinate of the new position
=end pod

method mesh-move-to ( Num $x, Num $y ) {

  cairo_mesh_pattern_move_to(
    self._get-native-object-no-reffing, $x, $y
  )
}

sub cairo_mesh_pattern_move_to (
  cairo_pattern_t $pattern, gdouble $x, gdouble $y
) is native(&cairo-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:mesh-set-control-point:
=begin pod
=head2 mesh-set-control-point

Set an internal control point of the current patch.  Valid values for I<point_num> are from 0 to 3 and identify the control points as explained in C<create-mesh()>.  Note: If I<pattern> is not a mesh pattern then I<pattern> will be put into an error status with a status of C<CAIRO_STATUS_PATTERN_TYPE_MISMATCH>. If I<point_num> is not valid, I<pattern> will be put into an error status with a status of C<CAIRO_STATUS_INVALID_INDEX>.  If I<pattern> has no current patch, I<pattern> will be put into an error status with a status of C<CAIRO_STATUS_INVALID_MESH_CONSTRUCTION>.

  method mesh-set-control-point ( Int $point_num, Num $x, Num $y )

=item Int $point_num; a B<cairo_pattern_t>
=item Num $x; the control point to set the position for
=item Num $y; the X coordinate of the control point
=end pod

method mesh-set-control-point ( Int $point_num, Num $x, Num $y ) {

  cairo_mesh_pattern_set_control_point(
    self._get-native-object-no-reffing, $point_num, $x, $y
  )
}

sub cairo_mesh_pattern_set_control_point (
  cairo_pattern_t $pattern, guint $point_num, gdouble $x, gdouble $y
) is native(&cairo-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:mesh-set-corner-color-rgb:
=begin pod
=head2 mesh-set-corner-color-rgb

Sets the color of a corner of the current patch in a mesh pattern.  The color is specified in the same way as in C<set-source-rgb()>.  Valid values for I<corner_num> are from 0 to 3 and identify the corners as explained in C<create-mesh()>.  Note: If I<pattern> is not a mesh pattern then I<pattern> will be put into an error status with a status of C<CAIRO_STATUS_PATTERN_TYPE_MISMATCH>. If I<corner_num> is not valid, I<pattern> will be put into an error status with a status of C<CAIRO_STATUS_INVALID_INDEX>.  If I<pattern> has no current patch, I<pattern> will be put into an error status with a status of C<CAIRO_STATUS_INVALID_MESH_CONSTRUCTION>.

  method mesh-set-corner-color-rgb ( Int $corner_num, Num $red, Num $green, Num $blue )

=item Int $corner_num; a B<cairo_pattern_t>
=item Num $red; the corner to set the color for
=item Num $green; red component of color
=item Num $blue; green component of color
=end pod

method mesh-set-corner-color-rgb ( Int $corner_num, Num $red, Num $green, Num $blue ) {

  cairo_mesh_pattern_set_corner_color_rgb(
    self._get-native-object-no-reffing, $corner_num, $red, $green, $blue
  )
}

sub cairo_mesh_pattern_set_corner_color_rgb (
  cairo_pattern_t $pattern, guint $corner_num, gdouble $red, gdouble $green, gdouble $blue
) is native(&cairo-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:mesh-set-corner-color-rgba:
=begin pod
=head2 mesh-set-corner-color-rgba

Sets the color of a corner of the current patch in a mesh pattern.  The color is specified in the same way as in C<set-source-rgba()>.  Valid values for I<corner_num> are from 0 to 3 and identify the corners as explained in C<create-mesh()>.  Note: If I<pattern> is not a mesh pattern then I<pattern> will be put into an error status with a status of C<CAIRO_STATUS_PATTERN_TYPE_MISMATCH>. If I<corner_num> is not valid, I<pattern> will be put into an error status with a status of C<CAIRO_STATUS_INVALID_INDEX>.  If I<pattern> has no current patch, I<pattern> will be put into an error status with a status of C<CAIRO_STATUS_INVALID_MESH_CONSTRUCTION>.

  method mesh-set-corner-color-rgba ( Int $corner_num, Num $red, Num $green, Num $blue, Num $alpha )

=item Int $corner_num; a B<cairo_pattern_t>
=item Num $red; the corner to set the color for
=item Num $green; red component of color
=item Num $blue; green component of color
=item Num $alpha; blue component of color
=end pod

method mesh-set-corner-color-rgba ( Int $corner_num, Num $red, Num $green, Num $blue, Num $alpha ) {

  cairo_mesh_pattern_set_corner_color_rgba(
    self._get-native-object-no-reffing, $corner_num, $red, $green, $blue, $alpha
  )
}

sub cairo_mesh_pattern_set_corner_color_rgba (
  cairo_pattern_t $pattern, guint $corner_num, gdouble $red, gdouble $green, gdouble $blue, gdouble $alpha
) is native(&cairo-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:1:_cairo_pattern_reference:native-object-ref
#`{{
=begin pod
=head2 reference

Increases the reference count on I<pattern> by one. This prevents I<pattern> from being destroyed until a matching call to C<clear-object()> is made.  Use C<get-reference-count()> to get the number of references to a B<cairo_pattern_t>.  Return value: the referenced B<cairo_pattern_t>.

  method reference ( --> cairo_pattern_t )

=end pod

method reference ( --> cairo_pattern_t ) {

  cairo_pattern_reference(
    self._get-native-object-no-reffing,
  )
}
}}

sub _cairo_pattern_reference ( cairo_pattern_t $pattern --> cairo_pattern_t )
  is native(&cairo-lib)
  is symbol('cairo_pattern_reference')
  { * }

#-------------------------------------------------------------------------------
#TM:0:set-extend:
=begin pod
=head2 set-extend

Sets the mode to be used for drawing outside the area of a pattern. See B<cairo_extend_t> for details on the semantics of each extend strategy.  The default extend mode is C<CAIRO_EXTEND_NONE> for surface patterns and C<CAIRO_EXTEND_PAD> for gradient patterns.

  method set-extend ( cairo_extend_t $extend )

=item $extend; a B<cairo-extend-t> describing how the area outside of the pattern will be drawn
=end pod

method set-extend ( cairo_extend_t $extend ) {
  cairo_pattern_set_extend( self._get-native-object-no-reffing, $extend)
}

sub cairo_pattern_set_extend (
  cairo_pattern_t $pattern, GEnum $extend
) is native(&cairo-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:set-filter:
=begin pod
=head2 set-filter

Sets the filter to be used for resizing when using this pattern. See B<cairo_filter_t> for details on each filter.

Note that you might want to control filtering even when you do not have an explicit B<cairo_pattern_t> object, (for example when using C<set-source-surface()>). In these cases, it is convenient to use C<get-source()> to get access to the pattern that cairo creates implicitly. For example:

=begin code
  $cairo.set-source-surface( $image, $x, $y);
  $pattern.set-filter( $cairo.get-source, CAIRO_FILTER_NEAREST);
=end code

=begin code
  method set-filter ( cairo_filter_t $filter )
=end code

=item $filter; a B<cairo-filter-t> describing the filter to use for resizing the pattern
=end pod

method set-filter ( cairo_filter_t $filter ) {
  cairo_pattern_set_filter( self._get-native-object-no-reffing, $filter)
}

sub cairo_pattern_set_filter (
  cairo_pattern_t $pattern, GEnum $filter
) is native(&cairo-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:set-matrix:
=begin pod
=head2 set-matrix

Sets the pattern's transformation matrix to I<matrix>. This matrix is a transformation from user space to pattern space.  When a pattern is first created it always has the identity matrix for its transformation matrix, which means that pattern space is initially identical to user space.  Important: Please note that the direction of this transformation matrix is from user space to pattern space. This means that if you imagine the flow from a pattern to user space (and on to device space), then coordinates in that flow will be transformed by the inverse of the pattern matrix.  For example, if you want to make a pattern appear twice as large as it does by default the correct code to use is:

 cairo_matrix_init_scale (&amp;matrix, 0.5, 0.5); cairo_pattern_set_matrix (pattern, &amp;matrix);

   Meanwhile, using values of 2.0 rather than 0.5 in the code above would cause the pattern to appear at half of its default size.  Also, please note the discussion of the user-space locking semantics of C<set-source()>.

  method set-matrix ( cairo_matrix_t $matrix )

=item $matrix; a B<cairo-matrix-t>
=end pod

method set-matrix ( cairo_matrix_t $matrix ) {

  cairo_pattern_set_matrix(
    self._get-native-object-no-reffing, $matrix
  )
}

sub cairo_pattern_set_matrix (
  cairo_pattern_t $pattern, cairo_matrix_t $matrix
) is native(&cairo-lib)
  { * }

#`{{
#-------------------------------------------------------------------------------
#TM:0:set-user-data:
=begin pod
=head2 set-user-data

Attach user data to I<pattern>.  To remove user data from a surface, call this function with the key that was used to set it and C