0N/A/*
2362N/A * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/A
0N/Apackage javax.imageio;
0N/A
0N/Aimport javax.imageio.metadata.IIOMetadata;
0N/A
0N/A/**
0N/A * An interface providing metadata transcoding capability.
0N/A *
0N/A * <p> Any image may be transcoded (written to a different format
0N/A * than the one it was originally stored in) simply by performing
0N/A * a read operation followed by a write operation. However, loss
0N/A * of data may occur in this process due to format differences.
0N/A *
0N/A * <p> In general, the best results will be achieved when
0N/A * format-specific metadata objects can be created to encapsulate as
0N/A * much information about the image and its associated metadata as
0N/A * possible, in terms that are understood by the specific
0N/A * <code>ImageWriter</code> used to perform the encoding.
0N/A *
0N/A * <p> An <code>ImageTranscoder</code> may be used to convert the
0N/A * <code>IIOMetadata</code> objects supplied by the
0N/A * <code>ImageReader</code> (representing per-stream and per-image
0N/A * metadata) into corresponding objects suitable for encoding by a
0N/A * particular <code>ImageWriter</code>. In the case where the methods
0N/A * of this interface are being called directly on an
0N/A * <code>ImageWriter</code>, the output will be suitable for that
0N/A * writer.
0N/A *
0N/A * <p> The internal details of converting an <code>IIOMetadata</code>
0N/A * object into a writer-specific format will vary according to the
0N/A * context of the operation. Typically, an <code>ImageWriter</code>
0N/A * will inspect the incoming object to see if it implements additional
0N/A * interfaces with which the writer is familiar. This might be the
0N/A * case, for example, if the object was obtained by means of a read
0N/A * operation on a reader plug-in written by the same vendor as the
0N/A * writer. In this case, the writer may access the incoming object by
0N/A * means of its plug-in specific interfaces. In this case, the
0N/A * re-encoding may be close to lossless if the image file format is
0N/A * kept constant. If the format is changing, the writer may still
0N/A * attempt to preserve as much information as possible.
0N/A *
0N/A * <p> If the incoming object does not implement any additional
0N/A * interfaces known to the writer, the writer has no choice but to
0N/A * access it via the standard <code>IIOMetadata</code> interfaces such
0N/A * as the tree view provided by <code>IIOMetadata.getAsTree</code>.
0N/A * In this case, there is likely to be significant loss of
0N/A * information.
0N/A *
0N/A * <p> An independent <code>ImageTranscoder</code> essentially takes
0N/A * on the same role as the writer plug-in in the above examples. It
0N/A * must be familiar with the private interfaces used by both the
0N/A * reader and writer plug-ins, and manually instantiate an object that
0N/A * will be usable by the writer. The resulting metadata objects may
0N/A * be used by the writer directly.
0N/A *
0N/A * <p> No independent implementations of <code>ImageTranscoder</code>
0N/A * are provided as part of the standard API. Instead, the intention
0N/A * of this interface is to provide a way for implementations to be
0N/A * created and discovered by applications as the need arises.
0N/A *
0N/A */
0N/Apublic interface ImageTranscoder {
0N/A
0N/A /**
0N/A * Returns an <code>IIOMetadata</code> object that may be used for
0N/A * encoding and optionally modified using its document interfaces
0N/A * or other interfaces specific to the writer plug-in that will be
0N/A * used for encoding.
0N/A *
0N/A * <p> An optional <code>ImageWriteParam</code> may be supplied
0N/A * for cases where it may affect the structure of the stream
0N/A * metadata.
0N/A *
0N/A * <p> If the supplied <code>ImageWriteParam</code> contains
0N/A * optional setting values not understood by this writer or
0N/A * transcoder, they will be ignored.
0N/A *
0N/A * @param inData an <code>IIOMetadata</code> object representing
0N/A * stream metadata, used to initialize the state of the returned
0N/A * object.
0N/A * @param param an <code>ImageWriteParam</code> that will be used to
0N/A * encode the image, or <code>null</code>.
0N/A *
0N/A * @return an <code>IIOMetadata</code> object, or
0N/A * <code>null</code> if the plug-in does not provide metadata
0N/A * encoding capabilities.
0N/A *
0N/A * @exception IllegalArgumentException if <code>inData</code> is
0N/A * <code>null</code>.
0N/A */
0N/A IIOMetadata convertStreamMetadata(IIOMetadata inData,
0N/A ImageWriteParam param);
0N/A
0N/A /**
0N/A * Returns an <code>IIOMetadata</code> object that may be used for
0N/A * encoding and optionally modified using its document interfaces
0N/A * or other interfaces specific to the writer plug-in that will be
0N/A * used for encoding.
0N/A *
0N/A * <p> An optional <code>ImageWriteParam</code> may be supplied
0N/A * for cases where it may affect the structure of the image
0N/A * metadata.
0N/A *
0N/A * <p> If the supplied <code>ImageWriteParam</code> contains
0N/A * optional setting values not understood by this writer or
0N/A * transcoder, they will be ignored.
0N/A *
0N/A * @param inData an <code>IIOMetadata</code> object representing
0N/A * image metadata, used to initialize the state of the returned
0N/A * object.
0N/A * @param imageType an <code>ImageTypeSpecifier</code> indicating
0N/A * the layout and color information of the image with which the
0N/A * metadata will be associated.
0N/A * @param param an <code>ImageWriteParam</code> that will be used to
0N/A * encode the image, or <code>null</code>.
0N/A *
0N/A * @return an <code>IIOMetadata</code> object,
0N/A * or <code>null</code> if the plug-in does not provide
0N/A * metadata encoding capabilities.
0N/A *
0N/A * @exception IllegalArgumentException if either of
0N/A * <code>inData</code> or <code>imageType</code> is
0N/A * <code>null</code>.
0N/A */
0N/A IIOMetadata convertImageMetadata(IIOMetadata inData,
0N/A ImageTypeSpecifier imageType,
0N/A ImageWriteParam param);
0N/A}