@Test
public void testColorWheelBitmask() {

    final int SIZE = 100;
    BufferedImage bi = new BufferedImage(SIZE, SIZE, BufferedImage.TYPE_4BYTE_ABGR);
    Graphics2D gr = bi.createGraphics();
    for (int s = 0; s < SIZE; s++) {
        int arcw = SIZE * s / SIZE;
        int arch = SIZE * s / SIZE;
        for (int h = 0; h < 360; h++) {
            float hue = h / 360f;
            float sat = s / (float) SIZE;
            Color c = Color.getHSBColor(hue, sat, 1F);
            gr.setColor(c);
            gr.fillArc(SIZE / 2 - arcw / 2, SIZE / 2 - arch / 2, arcw, arch, h, 1);
        }
    }
    gr.dispose();
    // simple palette checks
    ColorIndexer indexer = new Quantizer(256).buildColorIndexer(bi);
    IndexColorModel icm = indexer.toIndexColorModel();
    assertEquals(Transparency.BITMASK, icm.getTransparency());
    assertEquals(4, icm.getNumComponents());
    // quantize and check
    RenderedImage indexed = ColorIndexerDescriptor.create(bi, indexer, null);
    IndexColorModel icm2 = (IndexColorModel) indexed.getColorModel();
    assertEquals(icm, icm2);
    // the source image has up to 36000 colors (the distance has been checked visually, and
    // yes, in this particular case pngquant and pngnq do much better, the Quantizer algorithm
    // has been setup to preserve translucent borders better than the inside)
    assertImagesSimilar(bi, indexed, 250);
}