javax.imageio.plugins.jpeg

Class JPEGQTable


public class JPEGQTable
extends Object

The JPEGQTable class represents a quantization table that can be used to encode or decode a JPEG stream. The standard JPEG luminance and chrominance quantization tables are provided as static fields. Table entries are stored in natural order, not zig-zag order.

Field Summary

static JPEGQTable
K1Div2Luminance
The standard JPEG luminance quantization table, scaled by one-half.
static JPEGQTable
K1Luminance
The standard JPEG luminance quantization table.
static JPEGQTable
K2Chrominance
The standard JPEG chrominance quantization table.
static JPEGQTable
K2Div2Chrominance
The standard JPEG chrominance quantization table, scaled by one-half.

Constructor Summary

JPEGQTable(int[] table)
Construct a new JPEG quantization table.

Method Summary

JPEGQTable
getScaledInstance(float scaleFactor, boolean forceBaseline)
Retrieve a copy of this JPEG quantization table with every value scaled by the given scale factor, and clamped from 1 to 255 baseline or from 1 to 32767 otherwise.
int[]
getTable()
Retrieve a copy of the quantization values for this table.
String
toString()
Create a string representing this JPEG quantization table.

Methods inherited from class java.lang.Object

clone, equals, extends Object> getClass, finalize, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Details

K1Div2Luminance

public static final JPEGQTable K1Div2Luminance
The standard JPEG luminance quantization table, scaled by one-half. Values are stored in natural order.

K1Luminance

public static final JPEGQTable K1Luminance
The standard JPEG luminance quantization table. Values are stored in natural order.

K2Chrominance

public static final JPEGQTable K2Chrominance
The standard JPEG chrominance quantization table. Values are stored in natural order.

K2Div2Chrominance

public static final JPEGQTable K2Div2Chrominance
The standard JPEG chrominance quantization table, scaled by one-half. Values are stored in natural order.

Constructor Details

JPEGQTable

public JPEGQTable(int[] table)
Construct a new JPEG quantization table. A copy is created of the table argument.
Parameters:
table - the 64-element value table, stored in natural order
Throws:
IllegalArgumentException - if the table is null or if table's length is not equal to 64.

Method Details

getScaledInstance

public JPEGQTable getScaledInstance(float scaleFactor,
                                    boolean forceBaseline)
Retrieve a copy of this JPEG quantization table with every value scaled by the given scale factor, and clamped from 1 to 255 baseline or from 1 to 32767 otherwise.
Parameters:
scaleFactor - the factor by which to scale this table
forceBaseline - clamp scaled values to a maximum of 255 if true, 32767 if false
Returns:
a new scaled JPEG quantization table

getTable

public int[] getTable()
Retrieve a copy of the quantization values for this table.
Returns:
a copy of the quantization value array

toString

public String toString()
Create a string representing this JPEG quantization table.
Overrides:
toString in interface Object

JPEGQTable.java -- Copyright (C) 2006 Free Software Foundation, Inc. This file is part of GNU Classpath. GNU Classpath is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. GNU Classpath is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and conditions of the GNU General Public License cover the whole combination. As a special exception, the copyright holders of this library give you permission to link this library with independent modules to produce an executable, regardless of the license terms of these independent modules, and to copy and distribute the resulting executable under terms of your choice, provided that you also meet, for each linked independent module, the terms and conditions of the license of that module. An independent module is a module which is not derived from or based on this library. If you modify this library, you may extend this exception to your version of the library, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version.