lua.wetgenes.grd.attr_redux
g:attr_redux(cw,ch,num,sub,bak)
Perform attribute clash simulation on an indexed image.
cw,ch are the width and height of each character we are simulating, 8x8 is the right size for spectrum attrs but could be 4x8 for c64 multicolor mode.
num is the number of colors allowed within this area, so 2 for spectrum mode.
sub is the size of sub pallete groups, eg 16 in nes mode or 8 in spectrum mode, EG bright simulation in spectrum mode requires all colors in a attr block to be from the bright palette or the dark palette no mixing so this forces that grouping. Set to 0 or 256 and this restriction will be disabled.
bak is the index of the background color that is shared across all characters, set to -1 if there is no shared background color.
Returns nil,error if something goes wrong so can be used with assert otherwise returns g so that we can chain the result.