/**
* Converts the filter's LookupTable into an array of corresponding SVG
* table strings
*/
private String[] convertLookupTables(LookupOp lookupOp){
LookupTable lookupTable = lookupOp.getTable();
int nComponents = lookupTable.getNumComponents();
if((nComponents != 1) && (nComponents != 3) && (nComponents != 4))
throw new SVGGraphics2DRuntimeException(ERR_ILLEGAL_BUFFERED_IMAGE_LOOKUP_OP);
StringBuffer lookupTableBuf[] = new StringBuffer[nComponents];
for(int i=0; i<nComponents; i++)
lookupTableBuf[i] = new StringBuffer();
if(!(lookupTable instanceof ByteLookupTable)){
int src[] = new int[nComponents];
int dest[] = new int[nComponents];
int offset = lookupTable.getOffset();
// Offsets are used for constrained sources. Therefore,
// the lookup values should never be used under offset.
// There is no SVG equivalent for this behavior.
// These values are mapped to identity.
for(int i=0; i<offset; i++){
// Fill in string buffers
for(int j=0; j<nComponents; j++){
// lookupTableBuf[j].append(Integer.toString(i));
lookupTableBuf[j].append(doubleString(i/255.));
lookupTableBuf[j].append(SPACE);
}
}
for(int i=offset; i<=255; i++){
// Fill in source array
for(int j=0; j<nComponents; j++) src[j] = i;
// Get destination values
lookupTable.lookupPixel(src, dest);
// Fill in string buffers
for(int j=0; j<nComponents; j++){
lookupTableBuf[j].append(doubleString(dest[j]/255.));
// lookupTableBuf[j].append(Integer.toString(dest[j]));
lookupTableBuf[j].append(SPACE);
}
}
}
else{
byte src[] = new byte[nComponents];
byte dest[] = new byte[nComponents];
int offset = lookupTable.getOffset();
// Offsets are used for constrained sources. Therefore,
// the lookup values should never be used under offset.
// There is no SVG equivalent for this behavior.
// These values are mapped to identity.