Expression painter:setpattern(pattern,[x,y]) creates a textured pattern brush. This brush is used to set both the current brush and the brush of the current pen.

Argument p can be either a Qt variant of type qt.QImage or an object equipped with a method image returning a suitable image. Such objects include instances of qt.QtLuaPainter as well as the return values of functions qtwidget.newwindow or qtwidget.newimage

The optional arguments x and y specify the origin of the pattern in the source image.