A basic procedural pen could be implemented as following:
width and height property. Used for repeating procedure (like tiling effects)
procedure callable slot. Called upon every fill operation for each pixel on the mask to acquire the current color for that pixel.
The procedure callable could have something like the following signature:
//procfunc(curx, cury) -> Color//
if width <= 0 or height <= 0: curx, cury = real offset on the mask
else: curx, cury = relative offset to width, height (could be done using a simple modulo operation)
In the above case procedure callbacks could be any type implementing the call() method.