001 /*
002 * Copyright 2000-2001 Sun Microsystems, Inc. All Rights Reserved.
003 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004 *
005 * This code is free software; you can redistribute it and/or modify it
006 * under the terms of the GNU General Public License version 2 only, as
007 * published by the Free Software Foundation. Sun designates this
008 * particular file as subject to the "Classpath" exception as provided
009 * by Sun in the LICENSE file that accompanied this code.
010 *
011 * This code is distributed in the hope that it will be useful, but WITHOUT
012 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
014 * version 2 for more details (a copy is included in the LICENSE file that
015 * accompanied this code).
016 *
017 * You should have received a copy of the GNU General Public License version
018 * 2 along with this work; if not, write to the Free Software Foundation,
019 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020 *
021 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022 * CA 95054 USA or visit www.sun.com if you need additional information or
023 * have any questions.
024 */
025
026 package javax.imageio.event;
027
028 import java.util.EventListener;
029 import javax.imageio.ImageWriter;
030
031 /**
032 * An interface used by <code>ImageWriter</code> implementations to notify
033 * callers of their image writing methods of progress.
034 *
035 * @see javax.imageio.ImageWriter#write
036 *
037 * @version 0.5
038 */
039 public interface IIOWriteProgressListener extends EventListener {
040
041 /**
042 * Reports that an image write operation is beginning. All
043 * <code>ImageWriter</code> implementations are required to call
044 * this method exactly once when beginning an image write
045 * operation.
046 *
047 * @param source the <code>ImageWriter</code> object calling this
048 * method.
049 * @param imageIndex the index of the image being written within
050 * its containing input file or stream.
051 */
052 void imageStarted(ImageWriter source, int imageIndex);
053
054 /**
055 * Reports the approximate degree of completion of the current
056 * <code>write</code> call within the associated
057 * <code>ImageWriter</code>.
058 *
059 * <p> The degree of completion is expressed as an index
060 * indicating which image is being written, and a percentage
061 * varying from <code>0.0F</code> to <code>100.0F</code>
062 * indicating how much of the current image has been output. The
063 * percentage should ideally be calculated in terms of the
064 * remaining time to completion, but it is usually more practical
065 * to use a more well-defined metric such as pixels decoded or
066 * portion of input stream consumed. In any case, a sequence of
067 * calls to this method during a given read operation should
068 * supply a monotonically increasing sequence of percentage
069 * values. It is not necessary to supply the exact values
070 * <code>0</code> and <code>100</code>, as these may be inferred
071 * by the callee from other methods.
072 *
073 * <p> Each particular <code>ImageWriter</code> implementation may
074 * call this method at whatever frequency it desires. A rule of
075 * thumb is to call it around each 5 percent mark.
076 *
077 * @param source the <code>ImageWriter</code> object calling this method.
078 * @param percentageDone the approximate percentage of decoding that
079 * has been completed.
080 */
081 void imageProgress(ImageWriter source, float percentageDone);
082
083 /**
084 * Reports that the image write operation has completed. All
085 * <code>ImageWriter</code> implementations are required to call
086 * this method exactly once upon completion of each image write
087 * operation.
088 *
089 * @param source the <code>ImageWriter</code> object calling this method.
090 */
091 void imageComplete(ImageWriter source);
092
093 /**
094 * Reports that a thumbnail write operation is beginning. All
095 * <code>ImageWriter</code> implementations are required to call
096 * this method exactly once when beginning a thumbnail write
097 * operation.
098 *
099 * @param source the <code>ImageWrite</code> object calling this method.
100 * @param imageIndex the index of the image being written within its
101 * containing input file or stream.
102 * @param thumbnailIndex the index of the thumbnail being written.
103 */
104 void thumbnailStarted(ImageWriter source, int imageIndex,
105 int thumbnailIndex);
106
107 /**
108 * Reports the approximate degree of completion of the current
109 * thumbnail write within the associated <code>ImageWriter</code>.
110 * The semantics are identical to those of
111 * <code>imageProgress</code>.
112 *
113 * @param source the <code>ImageWriter</code> object calling this
114 * method.
115 * @param percentageDone the approximate percentage of decoding that
116 * has been completed.
117 */
118 void thumbnailProgress(ImageWriter source, float percentageDone);
119
120 /**
121 * Reports that a thumbnail write operation has completed. All
122 * <code>ImageWriter</code> implementations are required to call
123 * this method exactly once upon completion of each thumbnail
124 * write operation.
125 *
126 * @param source the <code>ImageWriter</code> object calling this
127 * method.
128 */
129 void thumbnailComplete(ImageWriter source);
130
131 /**
132 * Reports that a write has been aborted via the writer's
133 * <code>abort</code> method. No further notifications will be
134 * given.
135 *
136 * @param source the <code>ImageWriter</code> object calling this
137 * method.
138 */
139 void writeAborted(ImageWriter source);
140 }
|