shrinkRgba

fun shrinkRgba(rgba: ByteArray, width: Int, height: Int, shrinkX: Int, shrinkY: Int): ByteArray

rgba, straight RGBA of width by height pixels, averaged down by shrinkX columns and shrinkY rows into each output pixel. A block at the right or bottom edge averages the pixels it has. Colours are weighted by their alpha, so a transparent pixel does not darken its neighbours. The result is ceil(width / shrinkX) by ceil(height / shrinkY) pixels.