Package java.awt.image

Examples of java.awt.image.LookupOp


     */
    public final void test_LookupOp_filter_DifferentDimentionsTest() {
        // regression test for Harmony-1632
        byte[] array0 = new byte[96];
        ByteLookupTable localByteLookupTable = new ByteLookupTable(1, array0);
        LookupOp localLookupOp = new LookupOp(localByteLookupTable, null);

        BufferedImage localBufferedImage = getImage(5069, 19);

        // filter(BI,BI) non-equal widths
        BufferedImage localBufferedImage1 = getImage(6, 19);
        try {
            localLookupOp.filter(localBufferedImage, localBufferedImage1);
            fail("IllegalArgumentException expected!");
        } catch (IllegalArgumentException e) {
            // expected
        }

        // filter(R,WR) non-equal widths

        try {
            localLookupOp.filter(localBufferedImage.getRaster(),
                    localBufferedImage1.getRaster());
            fail("IllegalArgumentException expected!");
        } catch (IllegalArgumentException e) {
            // expected
        }

        // filter(BI,BI) non-equal heights

        localBufferedImage1 = getImage(5069, 5);
        try {
            localLookupOp.filter(localBufferedImage, localBufferedImage1);
            fail("IllegalArgumentException expected!");
        } catch (IllegalArgumentException e) {
            // expected
        }

        // filter(R, WR) non-equal heights
        try {
            localLookupOp.filter(localBufferedImage.getRaster(),
                    localBufferedImage1.getRaster());
            fail("IllegalArgumentException expected!");
        } catch (IllegalArgumentException e) {
            // expected
        }
View Full Code Here


     */
    public final void test_LookupOp_LookupTableRenderingHints_NullLookupTable() {
        // regression test for Harmony-1629
        RenderingHints hints = new RenderingHints(null);
        try {
            LookupOp returnValue = new LookupOp((LookupTable)null, hints);
            fail("NullPointerException expected");
        } catch (NullPointerException npe) {
            // expected
        }
    }
View Full Code Here

    harness.checkPoint("createCompatibleDestImage");

    // Simple test
    byte[] bytes = new byte[] {(byte) 0xAA, (byte) 0xBB};
    ByteLookupTable t = new ByteLookupTable(0, bytes);
    LookupOp op = new LookupOp(t, null);
   
    BufferedImage img = new BufferedImage(25, 40, BufferedImage.TYPE_INT_RGB);
   
    BufferedImage dest = op.createCompatibleDestImage(img, img.getColorModel());
   
    harness.check(dest.getHeight(), 40);
    harness.check(dest.getWidth(), 25);
    harness.check(dest.getColorModel(), img.getColorModel());
   
    // Try a different colour model
    img = new BufferedImage(25, 40, BufferedImage.TYPE_INT_RGB);
    DirectColorModel cm = new DirectColorModel(16, 0x0f00, 0x00f0, 0x000f);
    dest = op.createCompatibleDestImage(img, cm);
   
    harness.check(dest.getHeight(), 40);
    harness.check(dest.getWidth(), 25);
    harness.check(dest.getColorModel(), cm);
  }
View Full Code Here

  // Test all the default color models
  private void colorModelTest(TestHarness harness)
  {
    byte[] bytes = new byte[] {(byte) 0xAA, (byte) 0xBB};
    ByteLookupTable t = new ByteLookupTable(0, bytes);
    LookupOp op = new LookupOp(t, null);

    int[] types = {BufferedImage.TYPE_INT_RGB,
                   BufferedImage.TYPE_INT_ARGB,
                   BufferedImage.TYPE_INT_ARGB_PRE,
                   BufferedImage.TYPE_3BYTE_BGR,
                   BufferedImage.TYPE_4BYTE_ABGR,
                   BufferedImage.TYPE_4BYTE_ABGR_PRE,
                   BufferedImage.TYPE_USHORT_565_RGB,
                   BufferedImage.TYPE_USHORT_555_RGB,
                   BufferedImage.TYPE_BYTE_GRAY,
                   BufferedImage.TYPE_USHORT_GRAY};
    // Skipped types that are not implemented yet:
    // TYPE_CUSTOM, TYPE_INT_BGR, TYPE_BYTE_BINARY, TYPE_BYTE_INDEXED

    for (int i = 0; i < types.length; i++)
      {
        int type = types[i];
        harness.checkPoint("type: " + type);
       
        BufferedImage img = new BufferedImage(25, 40, type);
        BufferedImage dest = op.createCompatibleDestImage(img, null);
       
        // Unlike most Ops, this one creates a clone of the original image
       
        // Except there's a strange exception for TYPE_USHORT_GRAY ???
        if (type == BufferedImage.TYPE_USHORT_GRAY)
View Full Code Here

{
  public void test(TestHarness harness)
  {
    byte[] bytes = new byte[] {(byte) 0xAA, (byte) 0xBB};
    ByteLookupTable t = new ByteLookupTable(0, bytes);
    LookupOp op = new LookupOp(t, null);
    harness.check(op.getTable() == t);
  }
View Full Code Here

  {
    byte[] bytes = new byte[] {(byte) 0xAA, (byte) 0xBB};
    ByteLookupTable t = new ByteLookupTable(0, bytes);
    RenderingHints r = new RenderingHints(RenderingHints.KEY_COLOR_RENDERING,
            RenderingHints.VALUE_COLOR_RENDER_QUALITY);
    LookupOp op = new LookupOp(t, r);
    harness.check(op.getRenderingHints() == r);
    op = new LookupOp(t, null);
    harness.check(op.getRenderingHints() == null);
  }
View Full Code Here

  {
    byte[] bytes = new byte[] {(byte) 0xAA, (byte) 0xBB};
    ByteLookupTable t = new ByteLookupTable(0, bytes);
    RenderingHints r = new RenderingHints(RenderingHints.KEY_COLOR_RENDERING,
            RenderingHints.VALUE_COLOR_RENDER_QUALITY);
    LookupOp op = new LookupOp(t, r);
    harness.check(op.getTable() == t);
    harness.check(op.getRenderingHints() == r);

    // try null RenderingHints
    op = new LookupOp(t, null);
    harness.check(op.getRenderingHints(), null);
  }
View Full Code Here

    Raster src = createRasterA();
    WritableRaster dest = src.createCompatibleWritableRaster();
   
    byte[] bytes = new byte[] {(byte) 0xAA, (byte) 0xBB};
    ByteLookupTable t = new ByteLookupTable(0, bytes);
    LookupOp op = new LookupOp(t, null);
   
    dest = op.filter(src, dest);
    harness.check(dest.getSample(0, 0, 0), 1);
    harness.check(dest.getSample(1, 0, 0), 2);
    harness.check(dest.getSample(2, 0, 0), 3);
    harness.check(dest.getSample(3, 0, 0), 4);
    harness.check(dest.getSample(4, 0, 0), 5);
View Full Code Here

    Raster src = createRasterA();
    WritableRaster dest = src.createCompatibleWritableRaster();
   
    byte[] bytes = new byte[] {(byte) 0xAA, (byte) 0xBB};
    ByteLookupTable t = new ByteLookupTable(0, bytes);
    LookupOp op = new LookupOp(t, null);
    dest = op.filter(src, dest);
   
    harness.check(dest.getSample(0, 0, 0), 0);
    harness.check(dest.getSample(1, 0, 0), 0);
    harness.check(dest.getSample(2, 0, 0), 0);
    harness.check(dest.getSample(3, 0, 0), 0);
View Full Code Here

    Raster src = createRasterA();
    WritableRaster dest = src.createCompatibleWritableRaster();
   
    byte[] bytes = new byte[] {(byte) 0xAA, (byte) 0xBB};
    ByteLookupTable t = new ByteLookupTable(0, bytes);
    LookupOp op = new LookupOp(t, null);
   
    dest = op.filter(src, dest);
    harness.check(dest.getSample(0, 0, 0), 1);
    harness.check(dest.getSample(1, 0, 0), 2);
    harness.check(dest.getSample(2, 0, 0), 3);
    harness.check(dest.getSample(3, 0, 0), 4);
    harness.check(dest.getSample(4, 0, 0), 5);
View Full Code Here

TOP

Related Classes of java.awt.image.LookupOp

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.