Java 类java.awt.image.ByteLookupTable 实例源码

项目:openjdk-jdk10    文件:RasterOpNullDestinationRasterTest.java   
public static void main(String[] args) {

        byte[][] data = new byte[1][10];
        ByteLookupTable lut = new ByteLookupTable(0, data);
        RasterOp op = new LookupOp(lut, null);

        int[] bandOffsets = {0};
        Point location = new Point(0, 0);
        DataBuffer db = new DataBufferByte(10 * 10);
        SampleModel sm = new PixelInterleavedSampleModel(DataBuffer.TYPE_BYTE,
                                                         10, 10, 1, 10,
                                                         bandOffsets);

        Raster src = Raster.createRaster(sm, db, location);

        op.filter(src, null); // this used to result in NullPointerException
    }
项目:geomapapp    文件:ImageComponent.java   
public void apply() {
    if( balance==null ) return;
    ByteLookupTable lookup = balance.getLookup();
    if(lookup==null) return;

    int ok = (getTopLevelAncestor() instanceof JFrame )
        ? JOptionPane.showConfirmDialog(
            (JFrame)getTopLevelAncestor(),
            "Apply Color Mods?",
            "Modify Image Color",
            JOptionPane.YES_NO_OPTION)
        : JOptionPane.showConfirmDialog(
            (JOptionPane)getTopLevelAncestor(),
            "Apply Color Mods?",
            "Modify Image Color",
            JOptionPane.YES_NO_OPTION);
    if( ok== JOptionPane.NO_OPTION) return;
    BufferedImage im = new BufferedImage( width, height, 
        image.TYPE_INT_RGB);
    Graphics2D g = im.createGraphics();
    g.drawImage( image, new LookupOp( lookup, null ), 0, 0);
    image = im;
    balance.reset();
}
项目:Push2Display    文件:ComponentTransferRed.java   
/**
 * The constructor will instantiate a LookupOp instance using
 * a LookupOp, which is built using the four LUT
 * data obtained by the TransferFunction objects
 * funcs[0] : Alpha component transfer function
 * funcs[1] : Red component transfer function
 * funcs[2] : Green component transfer function
 * funcs[3] : Blue component transfer function
 */
public ComponentTransferRed(CachableRed src,
                            TransferFunction [] funcs,
                            RenderingHints hints) {
    super(src, src.getBounds(),
          GraphicsUtil.coerceColorModel(src.getColorModel(), false),
          src.getSampleModel(),
          null);

    byte [][] tableData = {funcs[1].getLookupTable(),
                           funcs[2].getLookupTable(),
                           funcs[3].getLookupTable(),
                           funcs[0].getLookupTable()};

    // Note that we create an anonymous subclass here.
    // For what ever reason this makes the Op work correctly.
    // If you remove this, it seems to get the color channels messed
    // up.  The downside is that I suspect that this means we are
    // falling into a more general, and hence slower case, but
    // at least it works....
    operation  =  new LookupOp(new ByteLookupTable(0, tableData), hints)
        { };
}
项目:Push2Display    文件:ComponentTransferRed.java   
/**
 * The constructor will instantiate a LookupOp instance using
 * a LookupOp, which is built using the four LUT
 * data obtained by the TransferFunction objects
 * funcs[0] : Alpha component transfer function
 * funcs[1] : Red component transfer function
 * funcs[2] : Green component transfer function
 * funcs[3] : Blue component transfer function
 */
public ComponentTransferRed(CachableRed src,
                            TransferFunction [] funcs,
                            RenderingHints hints) {
    super(src, src.getBounds(),
          GraphicsUtil.coerceColorModel(src.getColorModel(), false),
          src.getSampleModel(),
          null);

    byte [][] tableData = {funcs[1].getLookupTable(),
                           funcs[2].getLookupTable(),
                           funcs[3].getLookupTable(),
                           funcs[0].getLookupTable()};

    // Note that we create an anonymous subclass here.
    // For what ever reason this makes the Op work correctly.
    // If you remove this, it seems to get the color channels messed
    // up.  The downside is that I suspect that this means we are
    // falling into a more general, and hence slower case, but
    // at least it works....
    operation  =  new LookupOp(new ByteLookupTable(0, tableData), hints)
        { };
}
项目:feathers-sdk    文件:ComponentTransferRed.java   
/**
 * The constructor will instantiate a LookupOp instance using
 * a LookupOp, which is built using the four LUT
 * data obtained by the TransferFunction objects
 * funcs[0] : Alpha component transfer function
 * funcs[1] : Red component transfer function
 * funcs[2] : Green component transfer function
 * funcs[3] : Blue component transfer function
 */
public ComponentTransferRed(CachableRed src,
                            TransferFunction [] funcs,
                            RenderingHints hints) {
    super(src, src.getBounds(),
          GraphicsUtil.coerceColorModel(src.getColorModel(), false),
          src.getSampleModel(),
          null);

    byte [][] tableData = {funcs[1].getLookupTable(),
                           funcs[2].getLookupTable(),
                           funcs[3].getLookupTable(),
                           funcs[0].getLookupTable()};

    // Note that we create an anonymous subclass here.
    // For what ever reason this makes the Op work correctly.
    // If you remove this, it seems to get the color channels messed
    // up.  The downside is that I suspect that this means we are
    // falling into a more general, and hence slower case, but
    // at least it works....
    operation  =  new LookupOp(new ByteLookupTable(0, tableData), hints)
        { };
}
项目:jdk8u-jdk    文件:MlibOpsTest.java   
private static BufferedImageOp getLookupOp() {
    byte[] inv = new byte[256];
    for (int i = 0; i < 256; i++) {
        inv[i] = (byte)(255 - i);
    }
    ByteLookupTable table = new ByteLookupTable(0, inv);
    return new LookupOp(table, null);
}
项目:jdk8u-jdk    文件:IntImageReverseTest.java   
/**
 * Reverse image color components, leave alpha unchanged.
 */
private static LookupTable createReverseTable() {
    byte[] data = new byte[256];

    for (int i = 0; i < 256; i++) {
        data[i] = (byte) (255 - i);
    }


    return new ByteLookupTable(0, data);
}
项目:jdk8u-jdk    文件:SingleArrayTest.java   
public SingleArrayTest() {

        byte[] array = new byte[256];
        for (int i = 0; i < 256; i++) {
            array[i] = (byte)i;
        }
        ByteLookupTable table = new ByteLookupTable(0, array);

        op = new LookupOp(table, null);
    }
项目:openjdk-jdk10    文件:MlibOpsTest.java   
private static BufferedImageOp getLookupOp() {
    byte[] inv = new byte[256];
    for (int i = 0; i < 256; i++) {
        inv[i] = (byte)(255 - i);
    }
    ByteLookupTable table = new ByteLookupTable(0, inv);
    return new LookupOp(table, null);
}
项目:openjdk-jdk10    文件:IntImageReverseTest.java   
/**
 * Reverse image color components, leave alpha unchanged.
 */
private static LookupTable createReverseTable() {
    byte[] data = new byte[256];

    for (int i = 0; i < 256; i++) {
        data[i] = (byte) (255 - i);
    }


    return new ByteLookupTable(0, data);
}
项目:openjdk-jdk10    文件:SingleArrayTest.java   
public SingleArrayTest() {

        byte[] array = new byte[256];
        for (int i = 0; i < 256; i++) {
            array[i] = (byte)i;
        }
        ByteLookupTable table = new ByteLookupTable(0, array);

        op = new LookupOp(table, null);
    }
项目:geomapapp    文件:BalancePanel.java   
public ByteLookupTable getLookup() {
    if( contrast.getValue()==50 && brightness.getValue()==50 ) return null;
    doLookup();
    byte[] table = new byte[256];
    for(int k=0 ; k<256 ; k++) {
        table[k] = (byte)(int)Math.rint(lookup[k]);
    }
    return new ByteLookupTable( 0, table );
}
项目:openjdk9    文件:MlibOpsTest.java   
private static BufferedImageOp getLookupOp() {
    byte[] inv = new byte[256];
    for (int i = 0; i < 256; i++) {
        inv[i] = (byte)(255 - i);
    }
    ByteLookupTable table = new ByteLookupTable(0, inv);
    return new LookupOp(table, null);
}
项目:openjdk9    文件:IntImageReverseTest.java   
/**
 * Reverse image color components, leave alpha unchanged.
 */
private static LookupTable createReverseTable() {
    byte[] data = new byte[256];

    for (int i = 0; i < 256; i++) {
        data[i] = (byte) (255 - i);
    }


    return new ByteLookupTable(0, data);
}
项目:openjdk9    文件:SingleArrayTest.java   
public SingleArrayTest() {

        byte[] array = new byte[256];
        for (int i = 0; i < 256; i++) {
            array[i] = (byte)i;
        }
        ByteLookupTable table = new ByteLookupTable(0, array);

        op = new LookupOp(table, null);
    }
项目:jdk8u_jdk    文件:MlibOpsTest.java   
private static BufferedImageOp getLookupOp() {
    byte[] inv = new byte[256];
    for (int i = 0; i < 256; i++) {
        inv[i] = (byte)(255 - i);
    }
    ByteLookupTable table = new ByteLookupTable(0, inv);
    return new LookupOp(table, null);
}
项目:jdk8u_jdk    文件:IntImageReverseTest.java   
/**
 * Reverse image color components, leave alpha unchanged.
 */
private static LookupTable createReverseTable() {
    byte[] data = new byte[256];

    for (int i = 0; i < 256; i++) {
        data[i] = (byte) (255 - i);
    }


    return new ByteLookupTable(0, data);
}
项目:jdk8u_jdk    文件:SingleArrayTest.java   
public SingleArrayTest() {

        byte[] array = new byte[256];
        for (int i = 0; i < 256; i++) {
            array[i] = (byte)i;
        }
        ByteLookupTable table = new ByteLookupTable(0, array);

        op = new LookupOp(table, null);
    }
项目:lookaside_java-1.8.0-openjdk    文件:MlibOpsTest.java   
private static BufferedImageOp getLookupOp() {
    byte[] inv = new byte[256];
    for (int i = 0; i < 256; i++) {
        inv[i] = (byte)(255 - i);
    }
    ByteLookupTable table = new ByteLookupTable(0, inv);
    return new LookupOp(table, null);
}
项目:lookaside_java-1.8.0-openjdk    文件:IntImageReverseTest.java   
/**
 * Reverse image color components, leave alpha unchanged.
 */
private static LookupTable createReverseTable() {
    byte[] data = new byte[256];

    for (int i = 0; i < 256; i++) {
        data[i] = (byte) (255 - i);
    }


    return new ByteLookupTable(0, data);
}
项目:lookaside_java-1.8.0-openjdk    文件:SingleArrayTest.java   
public SingleArrayTest() {

        byte[] array = new byte[256];
        for (int i = 0; i < 256; i++) {
            array[i] = (byte)i;
        }
        ByteLookupTable table = new ByteLookupTable(0, array);

        op = new LookupOp(table, null);
    }
项目:PasswordSafe    文件:ImageTools.java   
public static BufferedImage colorImage(BufferedImage in, Color c)
{
    BufferedImage image = new BufferedImage(in.getWidth(), in.getHeight(), BufferedImage.TYPE_INT_ARGB);

    // first convert to grayscale
    new ColorConvertOp(ColorSpace.getInstance(ColorSpace.CS_GRAY),null).filter(in,image);

    // grayscale to colored image lookup
    byte[] r = buildLookup(c.getRed());
    byte[] g = buildLookup(c.getGreen());
    byte[] b = buildLookup(c.getBlue());
    byte[] a = buildAlpha();
    return new LookupOp(new ByteLookupTable(0,new byte[][] { r,g,b,a }),null).filter(image,image);
}
项目:infobip-open-jdk-8    文件:MlibOpsTest.java   
private static BufferedImageOp getLookupOp() {
    byte[] inv = new byte[256];
    for (int i = 0; i < 256; i++) {
        inv[i] = (byte)(255 - i);
    }
    ByteLookupTable table = new ByteLookupTable(0, inv);
    return new LookupOp(table, null);
}
项目:infobip-open-jdk-8    文件:IntImageReverseTest.java   
/**
 * Reverse image color components, leave alpha unchanged.
 */
private static LookupTable createReverseTable() {
    byte[] data = new byte[256];

    for (int i = 0; i < 256; i++) {
        data[i] = (byte) (255 - i);
    }


    return new ByteLookupTable(0, data);
}
项目:infobip-open-jdk-8    文件:SingleArrayTest.java   
public SingleArrayTest() {

        byte[] array = new byte[256];
        for (int i = 0; i < 256; i++) {
            array[i] = (byte)i;
        }
        ByteLookupTable table = new ByteLookupTable(0, array);

        op = new LookupOp(table, null);
    }
项目:jdk8u-dev-jdk    文件:MlibOpsTest.java   
private static BufferedImageOp getLookupOp() {
    byte[] inv = new byte[256];
    for (int i = 0; i < 256; i++) {
        inv[i] = (byte)(255 - i);
    }
    ByteLookupTable table = new ByteLookupTable(0, inv);
    return new LookupOp(table, null);
}
项目:jdk8u-dev-jdk    文件:IntImageReverseTest.java   
/**
 * Reverse image color components, leave alpha unchanged.
 */
private static LookupTable createReverseTable() {
    byte[] data = new byte[256];

    for (int i = 0; i < 256; i++) {
        data[i] = (byte) (255 - i);
    }


    return new ByteLookupTable(0, data);
}
项目:jdk8u-dev-jdk    文件:SingleArrayTest.java   
public SingleArrayTest() {

        byte[] array = new byte[256];
        for (int i = 0; i < 256; i++) {
            array[i] = (byte)i;
        }
        ByteLookupTable table = new ByteLookupTable(0, array);

        op = new LookupOp(table, null);
    }
项目:jdk7-jdk    文件:MlibOpsTest.java   
private static BufferedImageOp getLookupOp() {
    byte[] inv = new byte[256];
    for (int i = 0; i < 256; i++) {
        inv[i] = (byte)(255 - i);
    }
    ByteLookupTable table = new ByteLookupTable(0, inv);
    return new LookupOp(table, null);
}
项目:jdk7-jdk    文件:SingleArrayTest.java   
public SingleArrayTest() {

        byte[] array = new byte[256];
        for (int i = 0; i < 256; i++) {
            array[i] = (byte)i;
        }
        ByteLookupTable table = new ByteLookupTable(0, array);

        op = new LookupOp(table, null);
    }
项目:jplot2d    文件:ImageFloat2dDemo.java   
public RgbColormap() {
    byte[] la = new byte[256];
    for (int i = 0; i < 256; i++) {
        la[i] = (byte) i;
    }
    lut = new ByteLookupTable(0, new byte[][]{la, la, la});
}
项目:jplot2d    文件:ImageFloat2dDemo.java   
public RgbColormap() {
    byte[] la = new byte[256];
    for (int i = 0; i < 256; i++) {
        la[i] = (byte) i;
    }
    lut = new ByteLookupTable(0, new byte[][]{la, la, la});
}
项目:openjdk-source-code-learn    文件:MlibOpsTest.java   
private static BufferedImageOp getLookupOp() {
    byte[] inv = new byte[256];
    for (int i = 0; i < 256; i++) {
        inv[i] = (byte)(255 - i);
    }
    ByteLookupTable table = new ByteLookupTable(0, inv);
    return new LookupOp(table, null);
}
项目:openjdk-source-code-learn    文件:SingleArrayTest.java   
public SingleArrayTest() {

        byte[] array = new byte[256];
        for (int i = 0; i < 256; i++) {
            array[i] = (byte)i;
        }
        ByteLookupTable table = new ByteLookupTable(0, array);

        op = new LookupOp(table, null);
    }
项目:OLD-OpenJDK8    文件:MlibOpsTest.java   
private static BufferedImageOp getLookupOp() {
    byte[] inv = new byte[256];
    for (int i = 0; i < 256; i++) {
        inv[i] = (byte)(255 - i);
    }
    ByteLookupTable table = new ByteLookupTable(0, inv);
    return new LookupOp(table, null);
}
项目:OLD-OpenJDK8    文件:IntImageReverseTest.java   
/**
 * Reverse image color components, leave alpha unchanged.
 */
private static LookupTable createReverseTable() {
    byte[] data = new byte[256];

    for (int i = 0; i < 256; i++) {
        data[i] = (byte) (255 - i);
    }


    return new ByteLookupTable(0, data);
}
项目:OLD-OpenJDK8    文件:SingleArrayTest.java   
public SingleArrayTest() {

        byte[] array = new byte[256];
        for (int i = 0; i < 256; i++) {
            array[i] = (byte)i;
        }
        ByteLookupTable table = new ByteLookupTable(0, array);

        op = new LookupOp(table, null);
    }
项目:JAVA_UNIT    文件:MlibOpsTest.java   
private static BufferedImageOp getLookupOp() {
    byte[] inv = new byte[256];
    for (int i = 0; i < 256; i++) {
        inv[i] = (byte)(255 - i);
    }
    ByteLookupTable table = new ByteLookupTable(0, inv);
    return new LookupOp(table, null);
}
项目:JAVA_UNIT    文件:SingleArrayTest.java   
public SingleArrayTest() {

        byte[] array = new byte[256];
        for (int i = 0; i < 256; i++) {
            array[i] = (byte)i;
        }
        ByteLookupTable table = new ByteLookupTable(0, array);

        op = new LookupOp(table, null);
    }
项目:openjdk-jdk7u-jdk    文件:MlibOpsTest.java   
private static BufferedImageOp getLookupOp() {
    byte[] inv = new byte[256];
    for (int i = 0; i < 256; i++) {
        inv[i] = (byte)(255 - i);
    }
    ByteLookupTable table = new ByteLookupTable(0, inv);
    return new LookupOp(table, null);
}