Write color and opacity values directly to the final RGBA array when possible, so as to avoid allocating unnecessary memory.