(define-entity Pattern
  (in-module "Cairo")
  (c-name "cairo_pattern_t")
)

(define-method destroy
  (of-object "cairo_pattern_t")
  (c-name "cairo_pattern_destroy")
  (return-type "none")
)

(define-method reference
  (of-object "cairo_pattern_t")
  (c-name "cairo_pattern_reference")
  (return-type "cairo_pattern_t*")
  (caller-owns-return #t)
)

;; Have to munge the name of this function so it comes out as
;; createForSurface() in the generated translation layer.

(define-function cairo_pattern_new_for_surface
  (of-object "cairo_pattern_t")
  (is-constructor-of "cairo_t")
  (caller-owns-return #t)
  (c-name "cairo_pattern_create_for_surface")
  (return-type "cairo_pattern_t*")
  (parameters
    '("cairo_surface_t*" "surface")
  )
)

(define-function cairo_pattern_new_rgba
  (of-object "cairo_pattern_t")
  (is-constructor-of "cairo_t")
  (caller-owns-return #t)
  (c-name "cairo_pattern_create_rgba")
  (return-type "cairo_pattern_t*")
  (parameters
    '("double" "red")
    '("double" "green")
    '("double" "blue")
    '("double" "alpha")
  )
)

(define-function cairo_pattern_new_linear
  (of-object "cairo_pattern_t")
  (is-constructor-of "cairo_t")
  (caller-owns-return #t)
  (c-name "cairo_pattern_create_linear")
  (return-type "cairo_pattern_t*")
  (parameters
    '("double" "x0")
    '("double" "y0")
    '("double" "x1")
    '("double" "y1")
  )
)

(define-function cairo_pattern_new_radial
  (of-object "cairo_pattern_t")
  (is-constructor-of "cairo_t")
  (caller-owns-return #t)
  (c-name "cairo_pattern_create_radial")
  (return-type "cairo_pattern_t*")
  (parameters
    '("double" "cx0")
    '("double" "cy0")
    '("double" "radius0")
    '("double" "cx1")
    '("double" "cy1")
    '("double" "radius1")
  )
)

(define-method add_color_stop_rgb
  (of-object "cairo_pattern_t")
  (c-name "cairo_pattern_add_color_stop_rgb")
  (return-type "none")
  (parameters
    '("double" "offset")
    '("double" "red")
    '("double" "green")
    '("double" "blue")
  )
)

(define-method add_color_stop_rgba
  (of-object "cairo_pattern_t")
  (c-name "cairo_pattern_add_color_stop_rgba")
  (return-type "none")
  (parameters
    '("double" "offset")
    '("double" "red")
    '("double" "green")
    '("double" "blue")
    '("double" "alpha")
  )
)

(define-method status
  (of-object "cairo_pattern_t")
  (c-name "cairo_pattern_status")
  (return-type "cairo_status_t")
)

(define-method set_extend
  (of-object "cairo_pattern_t")
  (c-name "cairo_pattern_set_extend")
  (return-type "none")
  (parameters
    '("cairo_extend_t" "extend")
  )
)

(define-method set_filter
  (of-object "cairo_pattern_t")
  (c-name "cairo_pattern_set_filter")
  (return-type "none")
  (parameters
    '("cairo_filter_t" "filter")
  )
)
