### Question:
ImageBufferHeadless implements ImageBuffer { @Override public void setRgb(int x, int y, int rgb) { buffer[y * width + x] = rgb; } ImageBufferHeadless(int width, int height, Transparency transparency);   ImageBufferHeadless(int width, int height, int[] pixels);   ImageBufferHeadless(ImageBufferHeadless image); @Override void prepare(); @Override Graphic createGraphic(); @Override void dispose(); @Override void setRgb(int x, int y, int rgb); @Override void setRgb(int startX, int startY, int w, int h, int[] rgbArray, int offset, int scansize); @Override int getRgb(int x, int y); @Override int[] getRgb(int startX, int startY, int w, int h, int[] rgbArray, int offset, int scansize); @Override int getWidth(); @Override int getHeight(); @SuppressWarnings("unchecked") @Override ImageBufferHeadless getSurface(); @Override Transparency getTransparency(); @Override ColorRgba getTransparentColor();  }### Answer:
@Test void testSetRgb() { final ImageBufferHeadless image = new ImageBufferHeadless(100, 200, Transparency.BITMASK); final int[] array = new int[3 * 3]; Arrays.fill(array, ColorRgba.BLUE.getRgba()); assertEquals(ColorRgba.TRANSPARENT.getRgba(), image.getRgb(0, 0)); assertEquals(ColorRgba.TRANSPARENT.getRgba(), image.getRgb(1, 1)); assertEquals(ColorRgba.TRANSPARENT.getRgba(), image.getRgb(2, 2)); image.setRgb(1, 1, 1, 1, array, 0, 1); assertEquals(ColorRgba.TRANSPARENT.getRgba(), image.getRgb(0, 0)); assertEquals(ColorRgba.BLUE.getRgba(), image.getRgb(1, 1)); assertEquals(ColorRgba.TRANSPARENT.getRgba(), image.getRgb(2, 2)); Arrays.fill(array, ColorRgba.TRANSPARENT.getRgba()); final int[] expected = new int[3 * 3]; expected[0] = ColorRgba.BLUE.getRgba(); image.getRgb(1, 1, 1, 1, array, 0, 9); assertArrayEquals(expected, array); assertArrayEquals(expected, image.getRgb(1, 1, 1, 1, null, 0, 9)); }