byte value; float alpha =  color.getAlpha().floatValue()/255; byte[] red = dataBuf.getRedBand(), green = dataBuf.getGreenBand(), blue = dataBuf.getBlueBand(); for (x2 = 0; x2 < sizeX2; ++x2) { for (x1 = 0; x1 < sizeX1; ++x1) { pixelIndex = sizeX1*x2+x1; discreteValue = qs.quantize(plane.getPixelValue(x1, x2)); discreteValue = cc.transform(discreteValue); value = (byte) (discreteValue*alpha); red[pixelIndex] = value; green[pixelIndex] = value; blue[pixelIndex] = value; }
if (dataBuf instanceof RGBIntBuffer) { int alpha = color.getAlpha(); int[] buf = ((RGBIntBuffer) dataBuf).getDataBuffer(); for (x2 = 0; x2 < sizeX2; ++x2) { int index = sizeX1 * x2; for (x1 = 0; x1 < sizeX1; ++x1) { discreteValue = qs.quantize(plane.getPixelValue(x1, x2)); discreteValue = cc.transform(discreteValue); buf[index + x1] = alpha << 24 | discreteValue << 16 | discreteValue << 8 | discreteValue; } } } else { byte value; float alpha = color.getAlpha().floatValue() / 255; byte[] r = dataBuf.getRedBand(); byte[] g = dataBuf.getBlueBand(); byte[] b = dataBuf.getGreenBand(); for (x2 = 0; x2 < sizeX2; ++x2) { for (x1 = 0; x1 < sizeX1; ++x1) { pixelIndex = sizeX1*x2+x1; discreteValue = qs.quantize(plane.getPixelValue(x1, x2)); discreteValue = cc.transform(discreteValue); value = (byte) (discreteValue*alpha); r[pixelIndex] = value; g[pixelIndex] = value; b[pixelIndex] = value; } }
    private void renderWave(RGBBuffer dataBuf, Plane2D plane, Color color,                            QuantumStrategy qs)        throws QuantizationException    {    	System.err.println("Render wave.");        CodomainChain cc = renderer.getCodomainChain();        int x1, x2, discreteValue, pixelIndex;        byte value;        float alpha =  color.getAlpha().floatValue()/255;        byte[] red = dataBuf.getRedBand(), green = dataBuf.getGreenBand(),               blue = dataBuf.getBlueBand();        for (x2 = 0; x2 < sizeX2; ++x2) {            for (x1 = 0; x1 < sizeX1; ++x1) {                pixelIndex = sizeX1*x2+x1;                discreteValue = qs.quantize(plane.getPixelValue(x1, x2));                discreteValue = cc.transform(discreteValue);                value = (byte) (discreteValue*alpha);                red[pixelIndex] = value;                green[pixelIndex] = value;                blue[pixelIndex] = value;            }         }    }