lua.wetgenes.grd.paint
g:paint(gb,x,y,cx,cy,cw,ch,mode,trans,color)
Blit a 2D area from one grd into another using dpaint style paint modes.
Both grids must be indexed - FMT_U8_INDEXED
gb is the grd to blit from.
x,y is the location to blit too.
cx,cy,cw,ch is a clip area that should be applied to gb before it is blitted. EG to specify an area within gb. If not provided it will default to the entirety of gb,
mode is one of the following
PAINT_MODE_TRANS
Skip the transparent color.
GRD_PAINT_MODE_COLOR
Skip the transparent color and make every solid pixel the same color.
GRD_PAINT_MODE_COPY
Copy the entire area.
GRD_PAINT_MODE_XOR
XOR the values. (Can be used to find differences in an image)
GRD_PAINT_MODE_ALPHA
Skip the transparent colors as defined in the palette.
trans is the index of the transparent color, bground color, for use in the appropriate modes.
color is the index of the drawing color, foreground color, for use in
the appropriate modes.
This is not overly optimised but should be reasonably fast.