Package javax.imageio.plugins.jpeg

Examples of javax.imageio.plugins.jpeg.JPEGImageReadParam


    {
      decoder.dispose();
    }
   
    decoder = ImageIO.getImageReadersByFormatName("JPEG").next();
    param = new JPEGImageReadParam();
    huffmanACTables = createACHuffmanTables();
    huffmanDCTables = createDCHuffmanTables();
    qtable = createQTable(q);
    param.setDecodeTables(qtable, huffmanDCTables, huffmanACTables);
  }
View Full Code Here


*/
public class TestJPEGImageReadParam implements Testlet
{
  public void test(TestHarness harness)
  {
    JPEGImageReadParam param = new JPEGImageReadParam();

    // valid data for testing.

    JPEGQTable[] qTables = new JPEGQTable[]
      {
        JPEGQTable.K1Luminance,
        JPEGQTable.K1Div2Luminance,
        JPEGQTable.K2Chrominance,
        JPEGQTable.K2Div2Chrominance
      };

    JPEGHuffmanTable[] DCHuffmanTables = new JPEGHuffmanTable[]
      {
        JPEGHuffmanTable.StdDCLuminance,
        JPEGHuffmanTable.StdDCChrominance
      };

    JPEGHuffmanTable[] ACHuffmanTables = new JPEGHuffmanTable[]
      {
        JPEGHuffmanTable.StdACLuminance,
        JPEGHuffmanTable.StdACChrominance
      };

    // check that tables are not set after construction.
    harness.check(!param.areTablesSet());

    // check that returned tables are null.
    harness.check(param.getQTables() == null);
    harness.check(param.getDCHuffmanTables() == null);
    harness.check(param.getACHuffmanTables() == null);

    // check failure modes for table setting
    // null argument
    boolean settingFailed = false;
    try
      {
        param.setDecodeTables(qTables, null, ACHuffmanTables);
      }
    catch (IllegalArgumentException e)
      {
        settingFailed = true;
      }
    harness.check(settingFailed);

    // invalid length for an array argument
    settingFailed = false;
    try
      {
        param.setDecodeTables(new JPEGQTable[]
            {
              JPEGQTable.K1Luminance,
              JPEGQTable.K1Div2Luminance,
              JPEGQTable.K2Chrominance,
              JPEGQTable.K2Div2Chrominance,
              JPEGQTable.K1Luminance
            }, DCHuffmanTables, ACHuffmanTables);
      }
    catch (IllegalArgumentException e)
      {
        settingFailed = true;
      }
    harness.check(settingFailed);

    // differing lengths for Huffman table array arguments
    settingFailed = false;
    try
      {
        param.setDecodeTables(qTables, new JPEGHuffmanTable[]
            {
              JPEGHuffmanTable.StdDCLuminance
            }, ACHuffmanTables);
      }
    catch (IllegalArgumentException e)
      {
        settingFailed = true;
      }
    harness.check(settingFailed);

    // check valid setting
    settingFailed = false;
    try
      {
        param.setDecodeTables(qTables, DCHuffmanTables, ACHuffmanTables);
      }
    catch (IllegalArgumentException e)
      {
        settingFailed = true;
      }
    harness.check(!settingFailed);

    // check tables set
    harness.check(param.areTablesSet());

    // check getting tables
    JPEGQTable[] gotQTables = param.getQTables();
    harness.check(gotQTables != null);
    harness.check(Arrays.equals(qTables, gotQTables));

    JPEGHuffmanTable[] gotDCHuffmanTables = param.getDCHuffmanTables();
    harness.check(gotDCHuffmanTables != null);
    harness.check(Arrays.equals(DCHuffmanTables, gotDCHuffmanTables));

    JPEGHuffmanTable[] gotACHuffmanTables = param.getACHuffmanTables();
    harness.check(gotACHuffmanTables != null);
    harness.check(Arrays.equals(ACHuffmanTables, gotACHuffmanTables));

    // check clearing tables
    param.unsetDecodeTables();

    // check getting null tables
    gotQTables = param.getQTables();
    harness.check(gotQTables == null);

    gotDCHuffmanTables = param.getDCHuffmanTables();
    harness.check(gotDCHuffmanTables == null);

    gotACHuffmanTables = param.getACHuffmanTables();
    harness.check(gotACHuffmanTables == null);

    // check that areTablesSet returns false
    harness.check(!param.areTablesSet());
  }
View Full Code Here

        iis = (ImageInputStream) input;
    }

    @Override
    public ImageReadParam getDefaultReadParam() {
        return new JPEGImageReadParam();
    }
View Full Code Here

            minProgressivePass = param.getSourceMinProgressivePass();
            maxProgressivePass = param.getSourceMaxProgressivePass();

            if (param instanceof JPEGImageReadParam) {
                JPEGImageReadParam jparam = (JPEGImageReadParam) param;
                if (jparam.areTablesSet()) {
                    abbrevQTables = jparam.getQTables();
                    abbrevDCHuffmanTables = jparam.getDCHuffmanTables();
                    abbrevACHuffmanTables = jparam.getACHuffmanTables();
                }
            }
        }

        int lineSize = destROI.width*numRasterBands;
 
View Full Code Here

    private native void setOutColorSpace(long structPointer, int id);

    /////// End of Color Conversion & Image Types
   
    public ImageReadParam getDefaultReadParam() {
        return new JPEGImageReadParam();
    }
View Full Code Here

            minProgressivePass = param.getSourceMinProgressivePass();
            maxProgressivePass = param.getSourceMaxProgressivePass();

            if (param instanceof JPEGImageReadParam) {
                JPEGImageReadParam jparam = (JPEGImageReadParam) param;
                if (jparam.areTablesSet()) {
                    abbrevQTables = jparam.getQTables();
                    abbrevDCHuffmanTables = jparam.getDCHuffmanTables();
                    abbrevACHuffmanTables = jparam.getACHuffmanTables();
                }
            }
        }

        int lineSize = destROI.width*numRasterBands;
 
View Full Code Here

    private native void setOutColorSpace(long structPointer, int id);

    /////// End of Color Conversion & Image Types

    public ImageReadParam getDefaultReadParam() {
        return new JPEGImageReadParam();
    }
View Full Code Here

            minProgressivePass = param.getSourceMinProgressivePass();
            maxProgressivePass = param.getSourceMaxProgressivePass();

            if (param instanceof JPEGImageReadParam) {
                JPEGImageReadParam jparam = (JPEGImageReadParam) param;
                if (jparam.areTablesSet()) {
                    abbrevQTables = jparam.getQTables();
                    abbrevDCHuffmanTables = jparam.getDCHuffmanTables();
                    abbrevACHuffmanTables = jparam.getACHuffmanTables();
                }
            }
        }

        int lineSize = destROI.width*numRasterBands;
 
View Full Code Here

    private native void setOutColorSpace(long structPointer, int id);

    /////// End of Color Conversion & Image Types

    public ImageReadParam getDefaultReadParam() {
        return new JPEGImageReadParam();
    }
View Full Code Here

            minProgressivePass = param.getSourceMinProgressivePass();
            maxProgressivePass = param.getSourceMaxProgressivePass();

            if (param instanceof JPEGImageReadParam) {
                JPEGImageReadParam jparam = (JPEGImageReadParam) param;
                if (jparam.areTablesSet()) {
                    abbrevQTables = jparam.getQTables();
                    abbrevDCHuffmanTables = jparam.getDCHuffmanTables();
                    abbrevACHuffmanTables = jparam.getACHuffmanTables();
                }
            }
        }

        int lineSize = destROI.width*numRasterBands;
 
View Full Code Here

TOP

Related Classes of javax.imageio.plugins.jpeg.JPEGImageReadParam

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.