- Use
polygon()
in fill mode to fill a white (value 1) polygonal shape on an otherwise black (value 0) image. Call this image “Mask”.
- In a fill iterator, use “Mask” to select between one or another of two source images, perhaps “Solid Dark Color Background” and “Festive Bright Pattern.”
I think you can work out the details; perhaps later I can EDIT in one of any number of possible implementations.
Have fun!
EDIT:
Here’s the example of what I had in mind. Does it bear any relation to what you want?
polyfunfill.gmic:
polyfunfill :
# Data points for vertices of some star-like
# polygon.
star=442.52139,415.31727,\
295.70526,374.95231,\
179.22126,473.01240,\
172.24195,320.90850,\
42.985724,240.42786,\
185.4884,186.787460,\
222.08766,38.987605,\
317.13847,157.93990,\
469.01428,147.07520,\
385.25623,274.23217,\
442.52139,415.31727
# Fancy polka dot to fill
# the interior of the polygon
-input 512,512,1,3,lerp([32,74,135],[0,180,130],y/(h-1))
-polka_dots. 3,4,0,0,37,10,1,1,255,230,80
-name. fancy
# Background gradient image
{w},{h},{d},{s},lerp([0,95,25],[75,140,0],y/(h-1))
-name background
# Mask
{w},{h},{d},1
-name mask
-eval begin(S=[$star]);polygon(#$mask,size(S)/2,S,1,1)
# Polka dot star on a greenish background
-fill[background] i(#$mask,x,y)?I(#$fancy,x,y):I
-keep[background]
Use:
gmic -m polyfunfill.gmic polyfunfill o. polkadotstar.png