1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
|
/*
* JPEGData
*
* Copyright (c) 2005, 2006 Marco Schmidt.
* All rights reserved.
*/
package net.sourceforge.jiu.codecs.jpeg;
import java.util.Vector;
/**
* Data for decoding or encoding images from or to
* JPEG File Interchange Format (JFIF) files.
* @author Marco Schmidt
* @since 0.13.0
*/
public class JPEGData
{
private JPEGFrame frame;
private Vector huffmanTables = new Vector();
private Vector quantTables = new Vector();
private Vector scans = new Vector();
public void addQuantizationTable(JPEGQuantizationTable table)
{
quantTables.add(table);
}
public void addHuffmanTable(JPEGHuffmanTable table)
{
huffmanTables.add(table);
}
public void addScan(JPEGScan scan)
{
scans.add(scan);
}
public JPEGFrame getFrame()
{
return frame;
}
/**
* Return a quantization table with a given id or
* null on failure to find it.
* @param id integer id value of table
* @return actual table or null on failure
*/
public JPEGQuantizationTable getQuantizationTable(int id)
{
JPEGQuantizationTable table = null;
int index = 0;
while (index < quantTables.size())
{
table = (JPEGQuantizationTable)quantTables.elementAt(index++);
if (table.getId() == id)
{
return table;
}
}
return null;
}
public void setFrame(JPEGFrame newFrame)
{
frame = newFrame;
}
}
|