status, count = cpattern:GetPatchCount()
The number only includes patches which have been finished by calling cpattern:EndPatch(). For example it will be 0 during the definition of the first patch.
This function also returns #CAIRO_STATUS_SUCCESS, or
#CAIRO_STATUS_PATTERN_TYPE_MISMATCH if the pattern is not a mesh
pattern.
#CAIRO_STATUS_SUCCESS or #CAIRO_STATUS_PATTERN_TYPE_MISMATCH