/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code 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
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* A class containing JPEG-related constants, definitions, and
* static methods. This class and its constants must be public so that
* <code>JPEGImageWriteParam</code> can see it.
*/
public class JPEG {
// List of all the JPEG markers (pre-JPEG2000)
/** For temporary use in arithmetic coding */
// Codes 0x02 - 0xBF are reserved
// SOF markers for Nondifferential Huffman coding
/** Baseline DCT */
/** Extended Sequential DCT */
/** Progressive DCT */
/** Lossless Sequential */
/** Define Huffman Tables */
// SOF markers for Differential Huffman coding
/** Differential Sequential DCT */
/** Differential Progressive DCT */
/** Differential Lossless */
/** Reserved for JPEG extensions */
// SOF markers for Nondifferential arithmetic coding
/** Extended Sequential DCT, Arithmetic coding */
/** Progressive DCT, Arithmetic coding */
/** Lossless Sequential, Arithmetic coding */
/** Define Arithmetic conditioning tables */
// SOF markers for Differential arithmetic coding
/** Differential Sequential DCT, Arithmetic coding */
/** Differential Progressive DCT, Arithmetic coding */
/** Differential Lossless, Arithmetic coding */
// Restart Markers
/** Number of restart markers */
/** Start of Image */
/** End of Image */
/** Start of Scan */
/** Define Quantisation Tables */
/** Define Number of lines */
/** Define Restart Interval */
/** Define Heirarchical progression */
/** Expand reference image(s) */
// Application markers
/** APP0 used by JFIF */
/** APP14 used by Adobe */
// codes 0xF0 to 0xFD are reserved
/** Comment marker */
// JFIF Resolution units
/** The X and Y units simply indicate the aspect ratio of the pixels. */
/** Pixel density is in pixels per inch. */
/** Pixel density is in pixels per centemeter. */
/** The max known value for DENSITY_UNIT */
// Adobe transform values
// Spi initialization stuff
// Names of the formats we can read or write
"javax_imageio_jpeg_image_1.0";
"com.sun.imageio.plugins.jpeg.JPEGImageMetadataFormat";
"javax_imageio_jpeg_stream_1.0";
"com.sun.imageio.plugins.jpeg.JPEGStreamMetadataFormat";
// IJG Color codes.
// 8 and 9 were old "Legacy" codes which the old code never identified
// on reading anyway. Support for writing them is being dropped, too.
/** IJG can handle up to 4-channel JPEGs */
{0, 1},
{0, 1, 2},
{0, 1, 2, 3}};
/* These are kept in the inner class to avoid static initialization
* of the CMM class until someone actually needs it.
* (e.g. do not init CMM on the request for jpeg mime types)
*/
public static class JCS {
private static boolean yccInited = false;
if (!yccInited) {
try {
} catch (IllegalArgumentException e) {
// PYCC.pf may not always be installed
} finally {
yccInited = true;
}
}
return YCC;
}
}
// Default value for ImageWriteParam
/**
* Returns <code>true</code> if the given <code>ColorSpace</code>
* object is an instance of ICC_ColorSpace but is not one of the
* standard <code>ColorSpaces</code> returned by
* <code>ColorSpace.getInstance()</code>.
*/
boolean retval = false;
if ((cs instanceof ICC_ColorSpace)
) {
retval = true;
}
return retval;
}
/**
* Returns <code>true</code> if the given imageType can be used
* in a JFIF file. If <code>input</code> is true, then the
* image type is considered before colorspace conversion.
*/
boolean input) {
// Can't have alpha
return false;
}
// Gray is OK, always
if (numComponents == 1) {
return true;
}
// If it isn't gray, it must have 3 channels
if (numComponents != 3) {
return false;
}
if (input) {
// Must be RGB
return true;
}
} else {
// Must be YCbCr
return true;
}
}
return false;
}
/**
* Given an image type, return the Adobe transform corresponding to
* that type, or ADOBE_IMPOSSIBLE if the image type is incompatible
* with an Adobe marker segment. If <code>input</code> is true, then
* the image type is considered before colorspace conversion.
*/
int retval = ADOBE_IMPOSSIBLE;
case ColorSpace.TYPE_GRAY:
break;
case ColorSpace.TYPE_RGB:
break;
case ColorSpace.TYPE_YCbCr:
break;
case ColorSpace.TYPE_CMYK:
}
return retval;
}
/**
* Converts an ImageWriteParam (i.e. IJG) non-linear quality value
* to a float suitable for passing to JPEGQTable.getScaledInstance().
*/
// The following is converted from the IJG code.
if (quality <= 0.0F) {
quality = 0.01F;
}
if (quality > 1.00F) {
quality = 1.00F;
}
if (quality < 0.5F) {
} else {
}
return quality;
}
/**
* Return an array of default, visually lossless quantization tables.
*/
return qTables;
}
/**
* Return an array of default Huffman tables.
*/
if (wantDC) {
} else {
}
return tables;
}
}