/** Generate the image used for texturing the gradient across shapes */ public void genImage() { if (image == null) { ImageBuffer buffer = new ImageBuffer(128, 16); for (int i = 0; i < 128; i++) { Color col = getColorAt(i / 128.0f); for (int j = 0; j < 16; j++) buffer.setRGBA( i, j, col.getRedByte(), col.getGreenByte(), col.getBlueByte(), col.getAlphaByte()); } image = buffer.getImage(); } }