java.awt.image.LookupTable Java Examples

The following examples show how to use java.awt.image.LookupTable. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: IntImageReverseTest.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) {
    LookupTable tbl = createReverseTable();
    LookupOp op = new LookupOp(tbl, null);

    for (ImageType t : ImageType.values()) {
        System.out.print(t);

        BufferedImage src = createSourceImage(t);

        BufferedImage dst = op.filter(src, null);

        int rgb = dst.getRGB(0, 0);

        System.out.printf(" Result: 0x%X ", rgb);

        if (rgb != argbReverse) {
            throw new RuntimeException("Test failed.");
        }
        System.out.println("Passed.");
    }
}
 
Example #2
Source File: IntImageReverseTest.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) {
    LookupTable tbl = createReverseTable();
    LookupOp op = new LookupOp(tbl, null);

    for (ImageType t : ImageType.values()) {
        System.out.print(t);

        BufferedImage src = createSourceImage(t);

        BufferedImage dst = op.filter(src, null);

        int rgb = dst.getRGB(0, 0);

        System.out.printf(" Result: 0x%X ", rgb);

        if (rgb != argbReverse) {
            throw new RuntimeException("Test failed.");
        }
        System.out.println("Passed.");
    }
}
 
Example #3
Source File: IntImageReverseTest.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) {
    LookupTable tbl = createReverseTable();
    LookupOp op = new LookupOp(tbl, null);

    for (ImageType t : ImageType.values()) {
        System.out.print(t);

        BufferedImage src = createSourceImage(t);

        BufferedImage dst = op.filter(src, null);

        int rgb = dst.getRGB(0, 0);

        System.out.printf(" Result: 0x%X ", rgb);

        if (rgb != argbReverse) {
            throw new RuntimeException("Test failed.");
        }
        System.out.println("Passed.");
    }
}
 
Example #4
Source File: IntImageReverseTest.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) {
    LookupTable tbl = createReverseTable();
    LookupOp op = new LookupOp(tbl, null);

    for (ImageType t : ImageType.values()) {
        System.out.print(t);

        BufferedImage src = createSourceImage(t);

        BufferedImage dst = op.filter(src, null);

        int rgb = dst.getRGB(0, 0);

        System.out.printf(" Result: 0x%X ", rgb);

        if (rgb != argbReverse) {
            throw new RuntimeException("Test failed.");
        }
        System.out.println("Passed.");
    }
}
 
Example #5
Source File: IntImageReverseTest.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) {
    LookupTable tbl = createReverseTable();
    LookupOp op = new LookupOp(tbl, null);

    for (ImageType t : ImageType.values()) {
        System.out.print(t);

        BufferedImage src = createSourceImage(t);

        BufferedImage dst = op.filter(src, null);

        int rgb = dst.getRGB(0, 0);

        System.out.printf(" Result: 0x%X ", rgb);

        if (rgb != argbReverse) {
            throw new RuntimeException("Test failed.");
        }
        System.out.println("Passed.");
    }
}
 
Example #6
Source File: IntImageReverseTest.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) {
    LookupTable tbl = createReverseTable();
    LookupOp op = new LookupOp(tbl, null);

    for (ImageType t : ImageType.values()) {
        System.out.print(t);

        BufferedImage src = createSourceImage(t);

        BufferedImage dst = op.filter(src, null);

        int rgb = dst.getRGB(0, 0);

        System.out.printf(" Result: 0x%X ", rgb);

        if (rgb != argbReverse) {
            throw new RuntimeException("Test failed.");
        }
        System.out.println("Passed.");
    }
}
 
Example #7
Source File: IntImageReverseTest.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) {
    LookupTable tbl = createReverseTable();
    LookupOp op = new LookupOp(tbl, null);

    for (ImageType t : ImageType.values()) {
        System.out.print(t);

        BufferedImage src = createSourceImage(t);

        BufferedImage dst = op.filter(src, null);

        int rgb = dst.getRGB(0, 0);

        System.out.printf(" Result: 0x%X ", rgb);

        if (rgb != argbReverse) {
            throw new RuntimeException("Test failed.");
        }
        System.out.println("Passed.");
    }
}
 
Example #8
Source File: IntImageReverseTest.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) {
    LookupTable tbl = createReverseTable();
    LookupOp op = new LookupOp(tbl, null);

    for (ImageType t : ImageType.values()) {
        System.out.print(t);

        BufferedImage src = createSourceImage(t);

        BufferedImage dst = op.filter(src, null);

        int rgb = dst.getRGB(0, 0);

        System.out.printf(" Result: 0x%X ", rgb);

        if (rgb != argbReverse) {
            throw new RuntimeException("Test failed.");
        }
        System.out.println("Passed.");
    }
}
 
Example #9
Source File: IntImageReverseTest.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) {
    LookupTable tbl = createReverseTable();
    LookupOp op = new LookupOp(tbl, null);

    for (ImageType t : ImageType.values()) {
        System.out.print(t);

        BufferedImage src = createSourceImage(t);

        BufferedImage dst = op.filter(src, null);

        int rgb = dst.getRGB(0, 0);

        System.out.printf(" Result: 0x%X ", rgb);

        if (rgb != argbReverse) {
            throw new RuntimeException("Test failed.");
        }
        System.out.println("Passed.");
    }
}
 
Example #10
Source File: IntImageReverseTest.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) {
    LookupTable tbl = createReverseTable();
    LookupOp op = new LookupOp(tbl, null);

    for (ImageType t : ImageType.values()) {
        System.out.print(t);

        BufferedImage src = createSourceImage(t);

        BufferedImage dst = op.filter(src, null);

        int rgb = dst.getRGB(0, 0);

        System.out.printf(" Result: 0x%X ", rgb);

        if (rgb != argbReverse) {
            throw new RuntimeException("Test failed.");
        }
        System.out.println("Passed.");
    }
}
 
Example #11
Source File: IntImageReverseTest.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) {
    LookupTable tbl = createReverseTable();
    LookupOp op = new LookupOp(tbl, null);

    for (ImageType t : ImageType.values()) {
        System.out.print(t);

        BufferedImage src = createSourceImage(t);

        BufferedImage dst = op.filter(src, null);

        int rgb = dst.getRGB(0, 0);

        System.out.printf(" Result: 0x%X ", rgb);

        if (rgb != argbReverse) {
            throw new RuntimeException("Test failed.");
        }
        System.out.println("Passed.");
    }
}
 
Example #12
Source File: IntImageReverseTest.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) {
    LookupTable tbl = createReverseTable();
    LookupOp op = new LookupOp(tbl, null);

    for (ImageType t : ImageType.values()) {
        System.out.print(t);

        BufferedImage src = createSourceImage(t);

        BufferedImage dst = op.filter(src, null);

        int rgb = dst.getRGB(0, 0);

        System.out.printf(" Result: 0x%X ", rgb);

        if (rgb != argbReverse) {
            throw new RuntimeException("Test failed.");
        }
        System.out.println("Passed.");
    }
}
 
Example #13
Source File: IntImageReverseTest.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) {
    LookupTable tbl = createReverseTable();
    LookupOp op = new LookupOp(tbl, null);

    for (ImageType t : ImageType.values()) {
        System.out.print(t);

        BufferedImage src = createSourceImage(t);

        BufferedImage dst = op.filter(src, null);

        int rgb = dst.getRGB(0, 0);

        System.out.printf(" Result: 0x%X ", rgb);

        if (rgb != argbReverse) {
            throw new RuntimeException("Test failed.");
        }
        System.out.println("Passed.");
    }
}
 
Example #14
Source File: IntImageReverseTest.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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);
}
 
Example #15
Source File: IntImageReverseTest.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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);
}
 
Example #16
Source File: IntImageReverseTest.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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);
}
 
Example #17
Source File: IntImageReverseTest.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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);
}
 
Example #18
Source File: IntImageReverseTest.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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);
}
 
Example #19
Source File: LookupFactory.java    From Pixelitor with GNU General Public License v3.0 5 votes vote down vote up
public static LookupTable createLookupFrom3Arrays(
        short[] redMappings, short[] greenMappings, short[] blueMappings) {

    short[][] lookupData = new short[3][256];
    lookupData[0] = redMappings;
    lookupData[1] = greenMappings;
    lookupData[2] = blueMappings;
    return new ShortLookupTable(0, lookupData);
}
 
Example #20
Source File: IntImageReverseTest.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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);
}
 
Example #21
Source File: ApplicationFrame.java    From filthy-rich-clients with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private void buildLookupOpTab(JTabbedPane tabbedPane) {
    BufferedImage dstImage = null;
    short[] data = new short[256];
    for (int i = 0; i < 256; i++) {
        data[i] = (short) (255 - i);
    }
    LookupTable lookupTable = new ShortLookupTable(0, data);
    LookupOp op = new LookupOp(lookupTable, null);
    dstImage = op.filter(sourceImage, null);
    
    tabbedPane.add("Lookup", new JLabel(new ImageIcon(dstImage)));
}
 
Example #22
Source File: IntImageReverseTest.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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);
}
 
Example #23
Source File: IntImageReverseTest.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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);
}
 
Example #24
Source File: ExtractChannel.java    From Pixelitor with GNU General Public License v3.0 5 votes vote down vote up
private static BufferedImage colorExtractChannel(BufferedImage src, BufferedImage dest, int channel) {
    LookupTable lookupTable;

    switch (channel) {
        case RED_CHANNEL:
            lookupTable = LookupFactory.createLookupForOnlyRed();
            break;
        case REMOVE_RED_CHANNEL:
            lookupTable = LookupFactory.createLookupForRemoveRed();
            break;
        case GREEN_CHANNEL:
            lookupTable = LookupFactory.createLookupForOnlyGreen();
            break;
        case REMOVE_GREEN_CHANNEL:
            lookupTable = LookupFactory.createLookupForRemoveGreen();
            break;
        case BLUE_CHANNEL:
            lookupTable = LookupFactory.createLookupForOnlyBlue();
            break;
        case REMOVE_BLUE_CHANNEL:
            lookupTable = LookupFactory.createLookupForRemoveBlue();
            break;
        default:
            throw new IllegalStateException("should not het here");
    }

    BufferedImageOp filterOp = new FastLookupOp((ShortLookupTable) lookupTable);
    filterOp.filter(src, dest);
    return dest;
}
 
Example #25
Source File: LookupFactory.java    From Pixelitor with GNU General Public License v3.0 5 votes vote down vote up
public static LookupTable createLookupForRemoveRed() {
    short[][] lookupData = new short[3][256];
    lookupData[0] = getNullMapping();
    lookupData[1] = getDefaultMapping();
    lookupData[2] = getDefaultMapping();
    return new ShortLookupTable(0, lookupData);
}
 
Example #26
Source File: LookupFactory.java    From Pixelitor with GNU General Public License v3.0 5 votes vote down vote up
public static LookupTable createLookupForOnlyRed() {
    short[][] lookupData = new short[3][256];
    lookupData[0] = getDefaultMapping();
    lookupData[1] = getNullMapping();
    lookupData[2] = getNullMapping();
    return new ShortLookupTable(0, lookupData);
}
 
Example #27
Source File: LookupFactory.java    From Pixelitor with GNU General Public License v3.0 5 votes vote down vote up
public static LookupTable createLookupForRemoveGreen() {
    short[][] lookupData = new short[3][256];
    lookupData[0] = getDefaultMapping();
    lookupData[1] = getNullMapping();
    lookupData[2] = getDefaultMapping();
    return new ShortLookupTable(0, lookupData);
}
 
Example #28
Source File: LookupFactory.java    From Pixelitor with GNU General Public License v3.0 5 votes vote down vote up
public static LookupTable createLookupForOnlyGreen() {
    short[][] lookupData = new short[3][256];
    lookupData[0] = getNullMapping();
    lookupData[1] = getDefaultMapping();
    lookupData[2] = getNullMapping();
    return new ShortLookupTable(0, lookupData);
}
 
Example #29
Source File: LookupFactory.java    From Pixelitor with GNU General Public License v3.0 5 votes vote down vote up
public static LookupTable createLookupForRemoveBlue() {
    short[][] lookupData = new short[3][256];
    lookupData[0] = getDefaultMapping();
    lookupData[1] = getDefaultMapping();
    lookupData[2] = getNullMapping();
    return new ShortLookupTable(0, lookupData);
}
 
Example #30
Source File: LookupFactory.java    From Pixelitor with GNU General Public License v3.0 5 votes vote down vote up
public static LookupTable createLookupForOnlyBlue() {
    short[][] lookupData = new short[3][256];
    lookupData[0] = getNullMapping();
    lookupData[1] = getNullMapping();
    lookupData[2] = getDefaultMapping();
    return new ShortLookupTable(0, lookupData);
}