Damn I really wish I had this 6 months ago when I was re-implementing a way to convert ImageData into a 1-bit BMP image directly in the browser to easily interface with a legacy system.<p>Have you tested the performance of this? Some drop is expected over the larger size arrays, but are we talking magnitudes slower or just 2-3x slower?<p>I see most of the "public" methods are just using the `.toArray()` method of the private class, doesn't that just murder the performance and negate the whole reason for using this?<p>We eventually basically implemented a version of this ourselves, but we ended up doing it a little differently. We would pull a full uint8 from the array and break it out into the 8 bits then just let the iterator return/set those one at a time until it's done, then it would write the whole 8 bits to the "main" array at once which massively sped things up for us.<p>Also, your getter to access the private section is adding a lot of overhead to accessing it. It's probably better to just forego the "absolute safety" of being unable to overwrite your private inner class and just rely on the symbol to prevent access to the private bits.