@Override public byte[][] get8BitLookupTable() throws FormatException, IOException { int pixelType = getPixelType(); if ((pixelType != FormatTools.INT8 && pixelType != FormatTools.UINT8) || !isIndexed()) { return null; } byte[][] lut = new byte[3][256]; int channel = getZCTCoords(lastPlane)[1]; if (channel >= channelColors.length) return null; int color = channelColors[channel]; float red = (color & 0xff) / 255f; float green = ((color & 0xff00) >> 8) / 255f; float blue = ((color & 0xff0000) >> 16) / 255f; for (int i=0; i<lut[0].length; i++) { lut[0][i] = (byte) (red * i); lut[1][i] = (byte) (green * i); lut[2][i] = (byte) (blue * i); } return lut; }
@Override public short[][] get16BitLookupTable() throws FormatException, IOException { int pixelType = getPixelType(); if ((pixelType != FormatTools.INT16 && pixelType != FormatTools.UINT16) || !isIndexed()) { return null; } short[][] lut = new short[3][65536]; int channel = getZCTCoords(lastPlane)[1]; if (channel >= channelColors.length) return null; int color = channelColors[channel]; float red = (color & 0xff) / 255f; float green = ((color & 0xff00) >> 8) / 255f; float blue = ((color & 0xff0000) >> 16) / 255f; for (int i=0; i<lut[0].length; i++) { lut[0][i] = (short) (red * i); lut[1][i] = (short) (green * i); lut[2][i] = (short) (blue * i); } return lut; }
@Override public byte[][] get8BitLookupTable() throws FormatException, IOException { int pixelType = getPixelType(); if ((pixelType != FormatTools.INT8 && pixelType != FormatTools.UINT8) || !isIndexed()) { return null; } byte[][] lut = new byte[3][256]; int channel = getZCTCoords(lastPlane)[1]; if (channel >= channelColors.length) return null; int color = channelColors[channel]; float red = (color & 0xff) / 255f; float green = ((color & 0xff00) >> 8) / 255f; float blue = ((color & 0xff0000) >> 16) / 255f; for (int i=0; i<lut[0].length; i++) { lut[0][i] = (byte) (red * i); lut[1][i] = (byte) (green * i); lut[2][i] = (byte) (blue * i); } return lut; }
@Override public short[][] get16BitLookupTable() throws FormatException, IOException { int pixelType = getPixelType(); if ((pixelType != FormatTools.INT16 && pixelType != FormatTools.UINT16) || !isIndexed()) { return null; } short[][] lut = new short[3][65536]; int channel = getZCTCoords(lastPlane)[1]; if (channel >= channelColors.length) return null; int color = channelColors[channel]; float red = (color & 0xff) / 255f; float green = ((color & 0xff00) >> 8) / 255f; float blue = ((color & 0xff0000) >> 16) / 255f; for (int i=0; i<lut[0].length; i++) { lut[0][i] = (short) (red * i); lut[1][i] = (short) (green * i); lut[2][i] = (short) (blue * i); } return lut; }