patternCreateForSurface

fncairo.pattern.Pattern patternCreateForSurface(cairo.surface.Surface surface)

Create a new #cairo_pattern_t for the given surface.

Parameters

surfacethe surface

Returns

the newly created #cairo_pattern_t if successful, or

an error pattern in case of no memory. The caller owns the returned object and should call [cairo.pattern.Pattern.destroy] 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 [cairo.pattern.Pattern.status].