* @return the image
*/
public java.awt.Image createAwtImage(java.awt.Color foreground, java.awt.Color background) {
int f = foreground.getRGB();
int g = background.getRGB();
Canvas canvas = new Canvas();
String bCode = keepNumbers(code);
if (generateChecksum)
bCode += getChecksum(bCode);
int len = bCode.length();
int nn = (int)n;
int fullWidth = len * (3 + 2 * nn) + (6 + nn );
byte bars[] = getBarsInter25(bCode);
boolean print = true;
int ptr = 0;
int height = (int)barHeight;
int pix[] = new int[fullWidth * height];
for (int k = 0; k < bars.length; ++k) {
int w = (bars[k] == 0 ? 1 : nn);
int c = g;
if (print)
c = f;
print = !print;
for (int j = 0; j < w; ++j)
pix[ptr++] = c;
}
for (int k = fullWidth; k < pix.length; k += fullWidth) {
System.arraycopy(pix, 0, pix, k, fullWidth);
}
Image img = canvas.createImage(new MemoryImageSource(fullWidth, height, pix, 0, fullWidth));
return img;
}