- java.lang.Object
-
- javax.imageio.IIOParam
-
- javax.imageio.ImageReadParam
-
- javax.imageio.plugins.jpeg.JPEGImageReadParam
-
public class JPEGImageReadParam extends ImageReadParam
This class adds the ability to set JPEG quantization and Huffman tables when using the built-in JPEG reader plug-in. An instance of this class will be returned from thegetDefaultImageReadParam
methods of the built-in JPEGImageReader
.The sole purpose of these additions is to allow the specification of tables for use in decoding abbreviated streams. The built-in JPEG reader will also accept an ordinary
ImageReadParam
, which is sufficient for decoding non-abbreviated streams.While tables for abbreviated streams are often obtained by first reading another abbreviated stream containing only the tables, in some applications the tables are fixed ahead of time. This class allows the tables to be specified directly from client code. If no tables are specified either in the stream or in a
JPEGImageReadParam
, then the stream is presumed to use the "standard" visually lossless tables. See
andJPEGQTable
for more information on the default tables.JPEGHuffmanTable
The default
JPEGImageReadParam
returned by thegetDefaultReadParam
method of the builtin JPEG reader contains no tables. Default tables may be obtained from the table classes
andJPEGQTable
.JPEGHuffmanTable
If a stream does contain tables, the tables given in a
JPEGImageReadParam
are ignored. Furthermore, if the first image in a stream does contain tables and subsequent ones do not, then the tables given in the first image are used for all the abbreviated images. Once tables have been read from a stream, they can be overridden only by tables subsequently read from the same stream. In order to specify new tables, the
method of the reader must be called to change the stream.setInput
Note that this class does not provide a means for obtaining the tables found in a stream. These may be extracted from a stream by consulting the
IIOMetadata
object returned by the reader.For more information about the operation of the built-in JPEG plug-ins, see the JPEG metadata format specification and usage notes.
-
-
Field Summary
-
Fields inherited from class javax.imageio.ImageReadParam
canSetSourceRenderSize, destination, destinationBands, minProgressivePass, numProgressivePasses, sourceRenderSize
-
Fields inherited from class javax.imageio.IIOParam
controller, defaultController, destinationOffset, destinationType, sourceBands, sourceRegion, sourceXSubsampling, sourceYSubsampling, subsamplingXOffset, subsamplingYOffset
-
-
Constructor Summary
Constructors Constructor and Description JPEGImageReadParam()
Constructs aJPEGImageReadParam
.
-
Method Summary
Methods Modifier and Type Method and Description boolean
areTablesSet()
Returnstrue
if tables are currently set.JPEGHuffmanTable[]
getACHuffmanTables()
Returns a copy of the array of AC Huffman tables set on the most recent call tosetDecodeTables
, ornull
if tables are not currently set.JPEGHuffmanTable[]
getDCHuffmanTables()
Returns a copy of the array of DC Huffman tables set on the most recent call tosetDecodeTables
, ornull
if tables are not currently set.JPEGQTable[]
getQTables()
Returns a copy of the array of quantization tables set on the most recent call tosetDecodeTables
, ornull
if tables are not currently set.void
setDecodeTables(JPEGQTable[] qTables, JPEGHuffmanTable[] DCHuffmanTables, JPEGHuffmanTable[] ACHuffmanTables)
Sets the quantization and Huffman tables to use in decoding abbreviated streams.void
unsetDecodeTables()
Removes any quantization and Huffman tables that are currently set.-
Methods inherited from class javax.imageio.ImageReadParam
canSetSourceRenderSize, getDestination, getDestinationBands, getSourceMaxProgressivePass, getSourceMinProgressivePass, getSourceNumProgressivePasses, getSourceRenderSize, setDestination, setDestinationBands, setDestinationType, setSourceProgressivePasses, setSourceRenderSize
-
Methods inherited from class javax.imageio.IIOParam
activateController, getController, getDefaultController, getDestinationOffset, getDestinationType, getSourceBands, getSourceRegion, getSourceXSubsampling, getSourceYSubsampling, getSubsamplingXOffset, getSubsamplingYOffset, hasController, setController, setDestinationOffset, setSourceBands, setSourceRegion, setSourceSubsampling
-
-
-
-
Method Detail
-
areTablesSet
public boolean areTablesSet()
Returnstrue
if tables are currently set.- Returns:
true
if tables are present.
-
setDecodeTables
public void setDecodeTables(JPEGQTable[] qTables, JPEGHuffmanTable[] DCHuffmanTables, JPEGHuffmanTable[] ACHuffmanTables)
Sets the quantization and Huffman tables to use in decoding abbreviated streams. There may be a maximum of 4 tables of each type. These tables are ignored once tables are encountered in the stream. All arguments must be non-null
. The two arrays of Huffman tables must have the same number of elements. The table specifiers in the frame and scan headers in the stream are assumed to be equivalent to indices into these arrays. The argument arrays are copied by this method.- Parameters:
qTables
- an array of quantization table objects.DCHuffmanTables
- an array of Huffman table objects.ACHuffmanTables
- an array of Huffman table objects.- Throws:
IllegalArgumentException
- if any of the arguments isnull
, has more than 4 elements, or if the numbers of DC and AC tables differ.- See Also:
unsetDecodeTables()
-
unsetDecodeTables
public void unsetDecodeTables()
Removes any quantization and Huffman tables that are currently set.
-
getQTables
public JPEGQTable[] getQTables()
Returns a copy of the array of quantization tables set on the most recent call tosetDecodeTables
, ornull
if tables are not currently set.- Returns:
- an array of
JPEGQTable
objects, ornull
. - See Also:
setDecodeTables(javax.imageio.plugins.jpeg.JPEGQTable[], javax.imageio.plugins.jpeg.JPEGHuffmanTable[], javax.imageio.plugins.jpeg.JPEGHuffmanTable[])
-
getDCHuffmanTables
public JPEGHuffmanTable[] getDCHuffmanTables()
Returns a copy of the array of DC Huffman tables set on the most recent call tosetDecodeTables
, ornull
if tables are not currently set.- Returns:
- an array of
JPEGHuffmanTable
objects, ornull
. - See Also:
setDecodeTables(javax.imageio.plugins.jpeg.JPEGQTable[], javax.imageio.plugins.jpeg.JPEGHuffmanTable[], javax.imageio.plugins.jpeg.JPEGHuffmanTable[])
-
getACHuffmanTables
public JPEGHuffmanTable[] getACHuffmanTables()
Returns a copy of the array of AC Huffman tables set on the most recent call tosetDecodeTables
, ornull
if tables are not currently set.- Returns:
- an array of
JPEGHuffmanTable
objects, ornull
. - See Also:
setDecodeTables(javax.imageio.plugins.jpeg.JPEGQTable[], javax.imageio.plugins.jpeg.JPEGHuffmanTable[], javax.imageio.plugins.jpeg.JPEGHuffmanTable[])
-
-
Nederlandse vertaling
U hebt gevraagd om deze site in het Nederlands te bezoeken. Voor nu wordt alleen de interface vertaald, maar nog niet alle inhoud.Als je me wilt helpen met vertalingen, is je bijdrage welkom. Het enige dat u hoeft te doen, is u op de site registreren en mij een bericht sturen waarin u wordt gevraagd om u toe te voegen aan de groep vertalers, zodat u de gewenste pagina's kunt vertalen. Een link onderaan elke vertaalde pagina geeft aan dat u de vertaler bent en heeft een link naar uw profiel.
Bij voorbaat dank.
Document heeft de 11/06/2005 gemaakt, de laatste keer de 04/03/2020 gewijzigd
Bron van het afgedrukte document:https://www.gaudry.be/nl/java-api-rf-javax/imageio/plugins/jpeg/jpegimagereadparam.html/.html
De infobrol is een persoonlijke site waarvan de inhoud uitsluitend mijn verantwoordelijkheid is. De tekst is beschikbaar onder CreativeCommons-licentie (BY-NC-SA). Meer info op de gebruiksvoorwaarden en de auteur.
Referenties
Deze verwijzingen en links verwijzen naar documenten die geraadpleegd zijn tijdens het schrijven van deze pagina, of die aanvullende informatie kunnen geven, maar de auteurs van deze bronnen kunnen niet verantwoordelijk worden gehouden voor de inhoud van deze pagina.
De auteur Deze site is als enige verantwoordelijk voor de manier waarop de verschillende concepten, en de vrijheden die met de referentiewerken worden genomen, hier worden gepresenteerd. Vergeet niet dat u meerdere broninformatie moet doorgeven om het risico op fouten te verkleinen.