blob: 780de266a3718afa563140c166522e2b2fcad146 [file] [log] [blame]
The Android Open Source Project7c1b96a2008-10-21 07:00:00 -07001/*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17/**
18 * @author Rustem V. Rafikov
19 * @version $Revision: 1.3 $
20 */
21package javax.imageio;
22
23import javax.imageio.spi.ImageReaderSpi;
24import javax.imageio.stream.ImageInputStream;
25import javax.imageio.metadata.IIOMetadata;
26import javax.imageio.event.IIOReadWarningListener;
27import javax.imageio.event.IIOReadProgressListener;
28import javax.imageio.event.IIOReadUpdateListener;
29import java.util.Locale;
30import java.util.List;
31import java.util.Iterator;
32import java.util.Set;
33import java.io.IOException;
34import java.awt.image.BufferedImage;
35import java.awt.image.Raster;
36import java.awt.image.RenderedImage;
37import java.awt.*;
38
39/**
40 * The ImageReader class is an abstract class for decoding images.
41 * ImageReader objects are instantiated by the service provider
42 * interface, ImageReaderSpi class, for the specific format.
43 * ImageReaderSpi class should be registered with the IIORegistry,
44 * which uses them for format recognition and presentation of available
45 * format readers and writers.
46 */
47public abstract class ImageReader {
48
49 /** The originating provider. */
50 protected ImageReaderSpi originatingProvider;
51
52 /** The input object such as ImageInputStream. */
53 protected Object input;
54
55 /** The seek forward only. */
56 protected boolean seekForwardOnly;
57
58 /**
59 * The ignore metadata flag indicates whether current input source
60 * has been marked as metadata is allowed to be ignored by setInput.
61 */
62 protected boolean ignoreMetadata;
63
64 /** The minimum index. */
65 protected int minIndex;
66
67 /** The available locales. */
68 protected Locale[] availableLocales;
69
70 /** The locale. */
71 protected Locale locale;
72
73 /** The list of warning listeners. */
74 protected List<IIOReadWarningListener> warningListeners;
75
76 /** The list of warning locales. */
77 protected List<Locale> warningLocales;
78
79 /** The list of progress listeners. */
80 protected List<IIOReadProgressListener> progressListeners;
81
82 /** The list of update listeners. */
83 protected List<IIOReadUpdateListener> updateListeners;
84
85 /**
86 * Instantiates a new ImageReader.
87 *
88 * @param originatingProvider the ImageReaderSpi which
89 * instanties this ImageReader.
90 */
91 protected ImageReader(ImageReaderSpi originatingProvider) {
92 this.originatingProvider = originatingProvider;
93 }
94
95 /**
96 * Gets the format name of this input source.
97 *
98 * @return the format name of this input source.
99 *
100 * @throws IOException Signals that an I/O exception has occurred.
101 */
102 public String getFormatName() throws IOException {
103 return originatingProvider.getFormatNames()[0];
104 }
105
106 /**
107 * Gets the ImageReaderSpi which instantiated this ImageReader.
108 *
109 * @return the ImageReaderSpi.
110 */
111 public ImageReaderSpi getOriginatingProvider() {
112 return originatingProvider;
113 }
114
115 /**
116 * Sets the specified Object as the input source of this ImageReader.
117 *
118 * @param input the input source, it can
119 * be an ImageInputStream or other supported objects.
120 * @param seekForwardOnly indicates whether the stream must
121 * be read sequentially from its current starting point.
122 * @param ignoreMetadata parameter which indicates
123 * if metadata may be ignored during reads or not.
124 */
125 public void setInput(Object input, boolean seekForwardOnly, boolean ignoreMetadata) {
126 if (input != null) {
127 if (!isSupported(input) && !(input instanceof ImageInputStream)) {
128 throw new IllegalArgumentException("input " + input + " is not supported");
129 }
130 }
131 this.minIndex = 0;
132 this.seekForwardOnly = seekForwardOnly;
133 this.ignoreMetadata = ignoreMetadata;
134 this.input = input;
135 }
136
137 /**
138 * Checks if is supported.
139 *
140 * @param input the input
141 *
142 * @return true, if is supported
143 */
144 private boolean isSupported(Object input) {
145 ImageReaderSpi spi = getOriginatingProvider();
146 if (null != spi) {
147 Class[] outTypes = spi.getInputTypes();
148 for (Class<?> element : outTypes) {
149 if (element.isInstance(input)) {
150 return true;
151 }
152 }
153 }
154 return false;
155 }
156
157 /**
158 * Sets the specified Object as the input source of this ImageReader.
159 * Metadata is not ignored.
160 *
161 * @param input the input source, it can
162 * be an ImageInputStream or other supported objects.
163 * @param seekForwardOnly indicates whether the stream must
164 * be read sequentially from its current starting point.
165 */
166 public void setInput(Object input, boolean seekForwardOnly) {
167 setInput(input, seekForwardOnly, false);
168 }
169
170 /**
171 * Sets the specified Object as the input source of this ImageReader.
172 * Metadata is not ignored and forward seeking is not required.
173 *
174 * @param input the input source, it can
175 * be ImageInputStream or other objects.
176 */
177 public void setInput(Object input) {
178 setInput(input, false, false);
179 }
180
181 /**
182 * Gets the input source object of this ImageReader, or returns null.
183 *
184 * @return the the input source object such as ImageInputStream,
185 * or null.
186 */
187 public Object getInput() {
188 return input;
189 }
190
191 /**
192 * Checks if the input source supports only forward reading, or not.
193 *
194 * @return true, if the input source supports only forward reading,
195 * false otherwise.
196 */
197 public boolean isSeekForwardOnly() {
198 return seekForwardOnly;
199 }
200
201 /**
202 * Returns true if the current input source allows
203 * to metadata to be ignored by passing true as
204 * the ignoreMetadata argument to the setInput method.
205 *
206 * @return true, if true if the current input source allows
207 * to metadata to be ignored by passing true as
208 * the ignoreMetadata argument to the setInput method.
209 */
210 public boolean isIgnoringMetadata() {
211 return ignoreMetadata;
212 }
213
214 /**
215 * Gets the minimum valid index for reading an image, thumbnail,
216 * or image metadata.
217 *
218 * @return the minimum valid index for reading an image, thumbnail,
219 * or image metadata.
220 */
221 public int getMinIndex() {
222 return minIndex;
223 }
224
225 /**
226 * Gets the available locales.
227 *
228 * @return an array of the available locales.
229 */
230 public Locale[] getAvailableLocales() {
231 return availableLocales;
232 }
233
234 /**
235 * Sets the locale to this ImageReader.
236 *
237 * @param locale the Locale.
238 */
239 public void setLocale(Locale locale) {
240 throw new UnsupportedOperationException("Not implemented yet");
241 }
242
243 /**
244 * Gets the locale of this ImageReader.
245 *
246 * @return the locale of this ImageReader.
247 */
248 public Locale getLocale() {
249 return locale;
250 }
251
252 /**
253 * Gets the number of images available in the current input source.
254 *
255 * @param allowSearch the parameter which indicates what
256 * a search is required; if false, the reader may return -1
257 * without searching.
258 *
259 * @return the number of images.
260 *
261 * @throws IOException Signals that an I/O exception has occurred.
262 */
263 public abstract int getNumImages(boolean allowSearch) throws IOException;
264
265 /**
266 * Gets the width of the specified image in input source.
267 *
268 * @param imageIndex the image index.
269 *
270 * @return the width in pixels.
271 *
272 * @throws IOException Signals that an I/O exception has occurred.
273 */
274 public abstract int getWidth(int imageIndex) throws IOException;
275
276 /**
277 * Gets the height of the specified image in input source.
278 *
279 * @param imageIndex the image index.
280 *
281 * @return the height in pixels.
282 *
283 * @throws IOException Signals that an I/O exception has occurred.
284 */
285 public abstract int getHeight(int imageIndex) throws IOException;
286
287 /**
288 * Checks if the storage format of the specified image places
289 * an impediment on random pixels access or not.
290 *
291 * @param imageIndex the image's index.
292 *
293 * @return true, if the storage format of the specified image places
294 * an impediment on random pixels access, false otherwise.
295 *
296 * @throws IOException Signals that an I/O exception has occurred.
297 */
298 public boolean isRandomAccessEasy(int imageIndex) throws IOException {
299 return false; //def
300 }
301
302 /**
303 * Gets the aspect ratio (width devided by height) of the image.
304 *
305 * @param imageIndex the image index.
306 *
307 * @return the aspect ratio of the image.
308 *
309 * @throws IOException Signals that an I/O exception has occurred.
310 */
311 public float getAspectRatio(int imageIndex) throws IOException {
312 return (float) getWidth(imageIndex) / getHeight(imageIndex);
313 }
314
315 /**
316 * Gets an ImageTypeSpecifier which indicates the type of the
317 * specified image.
318 *
319 * @param imageIndex the image's index.
320 *
321 * @return the ImageTypeSpecifier.
322 *
323 * @throws IOException Signals that an I/O exception has occurred.
324 */
325 public ImageTypeSpecifier getRawImageType(int imageIndex) throws IOException {
326 throw new UnsupportedOperationException("Not implemented yet");
327 }
328
329 /**
330 * Gets an Iterator of ImageTypeSpecifier objects which are associated
331 * with image types that may be used when decoding specified image.
332 *
333 * @param imageIndex the image index.
334 *
335 * @return an Iterator of ImageTypeSpecifier objects.
336 *
337 * @throws IOException Signals that an I/O exception has occurred.
338 */
339 public abstract Iterator<ImageTypeSpecifier> getImageTypes(int imageIndex) throws IOException;
340
341 /**
342 * Gets the default ImageReadParam object.
343 *
344 * @return the ImageReadParam object.
345 */
346 public ImageReadParam getDefaultReadParam() {
347 throw new UnsupportedOperationException("Not implemented yet");
348 }
349
350 /**
351 * Gets an IIOMetadata object for this input source.
352 *
353 * @return the IIOMetadata.
354 *
355 * @throws IOException Signals that an I/O exception has occurred.
356 */
357 public abstract IIOMetadata getStreamMetadata() throws IOException;
358
359 /**
360 * Gets an IIOMetadata object for this input source.
361 *
362 * @param formatName the desired metadata format to be used in the
363 * returned IIOMetadata object.
364 * @param nodeNames the node names of the document.
365 *
366 * @return the IIOMetadata.
367 *
368 * @throws IOException Signals that an I/O exception has occurred.
369 */
370 public IIOMetadata getStreamMetadata(String formatName, Set<String> nodeNames)
371 throws IOException {
372 throw new UnsupportedOperationException("Not implemented yet");
373 }
374
375 /**
376 * Gets the image metadata of the specified image in input source.
377 *
378 * @param imageIndex the image index.
379 *
380 * @return the IIOMetadata.
381 *
382 * @throws IOException Signals that an I/O exception has occurred.
383 */
384 public abstract IIOMetadata getImageMetadata(int imageIndex) throws IOException;
385
386 /**
387 * Gets the image metadata of the specified image input source.
388 *
389 * @param imageIndex the image index.
390 * @param formatName the desired metadata format to be used in the
391 * returned IIOMetadata object.
392 * @param nodeNames the node names which can be contained in
393 * the document.
394 *
395 * @return the IIOMetadata.
396 *
397 * @throws IOException Signals that an I/O exception has occurred.
398 */
399 public IIOMetadata getImageMetadata(int imageIndex, String formatName,
400 Set<String> nodeNames) throws IOException {
401 throw new UnsupportedOperationException("Not implemented yet");
402 }
403
404 /**
405 * Reads the specified image and returns it as a BufferedImage
406 * using the default ImageReadParam.
407 *
408 * @param imageIndex the image index.
409 *
410 * @return the BufferedImage.
411 *
412 * @throws IOException Signals that an I/O exception has occurred.
413 */
414 public BufferedImage read(int imageIndex) throws IOException {
415 return read(imageIndex, null);
416 }
417
418 /**
419 * Reads the specified image and returns it as a BufferedImage
420 * using the specified ImageReadParam.
421 *
422 * @param imageIndex the image index.
423 * @param param the ImageReadParam.
424 *
425 * @return the BufferedImage.
426 *
427 * @throws IOException Signals that an I/O exception has occurred.
428 */
429 public abstract BufferedImage read(int imageIndex, ImageReadParam param) throws IOException;
430
431 /**
432 * Reads the specified image and returns an IIOImage with this image,
433 * thumbnails, and metadata for this image, using
434 * the specified ImageReadParam.
435 *
436 * @param imageIndex the image index.
437 * @param param the ImageReadParam.
438 *
439 * @return the IIOImage.
440 *
441 * @throws IOException Signals that an I/O exception has occurred.
442 */
443 public IIOImage readAll(int imageIndex, ImageReadParam param) throws IOException {
444 throw new UnsupportedOperationException("Not implemented yet");
445 }
446
447 /**
448 * Returns an Iterator of IIOImages from the input source.
449 *
450 * @param params the Iterator of ImageReadParam objects.
451 *
452 * @return the iterator of IIOImages.
453 *
454 * @throws IOException Signals that an I/O exception has occurred.
455 */
456 public Iterator<IIOImage> readAll(Iterator<? extends ImageReadParam> params) throws IOException {
457 throw new UnsupportedOperationException("Not implemented yet");
458 }
459
460 /**
461 * Checks whether or not this plug-in supports reading a Raster.
462 *
463 * @return true, if this plug-in supports reading a Raster,
464 * false otherwise.
465 */
466 public boolean canReadRaster() {
467 return false; //def
468 }
469
470 /**
471 * Reads a new Raster object which contains the raw pixel data from
472 * the image.
473 *
474 * @param imageIndex the image index.
475 * @param param the ImageReadParam.
476 *
477 * @return the Raster.
478 *
479 * @throws IOException Signals that an I/O exception has occurred.
480 */
481 public Raster readRaster(int imageIndex, ImageReadParam param) throws IOException {
482 throw new UnsupportedOperationException("Unsupported");
483 }
484
485 /**
486 * Checks if the specified image has tiles or not.
487 *
488 * @param imageIndex the image's index.
489 *
490 * @return true, if the specified image has tiles,
491 * false otherwise.
492 *
493 * @throws IOException Signals that an I/O exception has occurred.
494 */
495 public boolean isImageTiled(int imageIndex) throws IOException {
496 return false; //def
497 }
498
499 /**
500 * Gets the tile width in the specified image.
501 *
502 * @param imageIndex the image's index.
503 *
504 * @return the tile width.
505 *
506 * @throws IOException Signals that an I/O exception has occurred.
507 */
508 public int getTileWidth(int imageIndex) throws IOException {
509 return getWidth(imageIndex); //def
510 }
511
512 /**
513 * Gets the tile height in the specified image.
514 *
515 * @param imageIndex the image's index.
516 *
517 * @return the tile height.
518 *
519 * @throws IOException Signals that an I/O exception has occurred.
520 */
521 public int getTileHeight(int imageIndex) throws IOException {
522 return getHeight(imageIndex); //def
523 }
524
525 /**
526 * Gets the X coordinate of the upper left corner of the tile grid in the
527 * specified image.
528 *
529 * @param imageIndex the image's index.
530 *
531 * @return the X coordinate of the upper left corner of the tile grid.
532 *
533 * @throws IOException Signals that an I/O exception has occurred.
534 */
535 public int getTileGridXOffset(int imageIndex) throws IOException {
536 return 0; //def
537 }
538
539 /**
540 * Gets the Y coordinate of the upper left corner of the tile grid in the
541 * specified image.
542 *
543 * @param imageIndex the image's index.
544 *
545 * @return the Y coordinate of the upper left corner of the tile grid.
546 *
547 * @throws IOException Signals that an I/O exception has occurred.
548 */
549 public int getTileGridYOffset(int imageIndex) throws IOException {
550 return 0; //def
551 }
552
553 /**
554 * Reads the tile specified by the tileX and tileY parameters
555 * of the specified image and returns it as a BufferedImage.
556 *
557 * @param imageIndex the image index.
558 * @param tileX the X index of tile.
559 * @param tileY the Y index of tile.
560 *
561 * @return the BufferedImage.
562 *
563 * @throws IOException Signals that an I/O exception has occurred.
564 */
565 public BufferedImage readTile(int imageIndex, int tileX, int tileY) throws IOException {
566 throw new UnsupportedOperationException("Not implemented yet");
567 }
568
569 /**
570 * Reads the tile specified by the tileX and tileY parameters
571 * of the specified image and returns it as a Raster.
572 *
573 * @param imageIndex the image index.
574 * @param tileX the X index of tile.
575 * @param tileY the Y index of tile.
576 *
577 * @return the Raster.
578 *
579 * @throws IOException Signals that an I/O exception has occurred.
580 */
581 public Raster readTileRaster(int imageIndex, int tileX, int tileY) throws IOException {
582 throw new UnsupportedOperationException("Not implemented yet");
583 }
584
585 /**
586 * Reads the specified image using the specified
587 * ImageReadParam and returns it as a RenderedImage.
588 *
589 * @param imageIndex the image index.
590 * @param param the ImageReadParam.
591 *
592 * @return the RenderedImage.
593 *
594 * @throws IOException Signals that an I/O exception has occurred.
595 */
596 public RenderedImage readAsRenderedImage(int imageIndex, ImageReadParam param) throws IOException {
597 return read(imageIndex, param);
598 }
599
600 /**
601 * Returns true if the image format supported by this reader
602 * supports thumbnail preview images.
603 *
604 * @return true if the image format supported by this reader
605 * supports thumbnail preview images, false otherwise.
606 */
607 public boolean readerSupportsThumbnails() {
608 return false; //def
609 }
610
611 /**
612 * Checks if the specified image has thumbnails or not.
613 *
614 * @param imageIndex the image's index.
615 *
616 * @return true, if the specified image has thumbnails,
617 * false otherwise.
618 *
619 * @throws IOException Signals that an I/O exception has occurred.
620 */
621 public boolean hasThumbnails(int imageIndex) throws IOException {
622 return getNumThumbnails(imageIndex) > 0; //def
623 }
624
625 /**
626 * Gets the number of thumbnails for the specified image.
627 *
628 * @param imageIndex the image's index.
629 *
630 * @return the number of thumbnails.
631 *
632 * @throws IOException Signals that an I/O exception has occurred.
633 */
634 public int getNumThumbnails(int imageIndex) throws IOException {
635 return 0; //def
636 }
637
638 /**
639 * Gets the width of the specified thumbnail for the specified image.
640 *
641 * @param imageIndex the image's index.
642 * @param thumbnailIndex the thumbnail's index.
643 *
644 * @return the thumbnail width.
645 *
646 * @throws IOException Signals that an I/O exception has occurred.
647 */
648 public int getThumbnailWidth(int imageIndex, int thumbnailIndex) throws IOException {
649 return readThumbnail(imageIndex, thumbnailIndex).getWidth(); //def
650 }
651
652 /**
653 * Gets the height of the specified thumbnail for the specified image.
654 *
655 * @param imageIndex the image's index.
656 * @param thumbnailIndex the thumbnail's index.
657 *
658 * @return the thumbnail height.
659 *
660 * @throws IOException Signals that an I/O exception has occurred.
661 */
662 public int getThumbnailHeight(int imageIndex, int thumbnailIndex) throws IOException {
663 return readThumbnail(imageIndex, thumbnailIndex).getHeight(); //def
664 }
665
666 /**
667 * Reads the thumbnail image for the specified image
668 * as a BufferedImage.
669 *
670 * @param imageIndex the image index.
671 * @param thumbnailIndex the thumbnail index.
672 *
673 * @return the BufferedImage.
674 *
675 * @throws IOException Signals that an I/O exception has occurred.
676 */
677 public BufferedImage readThumbnail(int imageIndex, int thumbnailIndex) throws IOException {
678 throw new UnsupportedOperationException("Unsupported"); //def
679 }
680
681 /**
682 * Requests an abort operation for current reading operation.
683 */
684 public void abort() {
685 throw new UnsupportedOperationException("Not implemented yet");
686 }
687
688 /**
689 * Checks whether or not a request to abort the current read operation
690 * has been made successfully.
691 *
692 * @return true, if the request to abort the current read operation
693 * has been made successfully, false otherwise.
694 */
695 protected boolean abortRequested() {
696 throw new UnsupportedOperationException("Not implemented yet");
697 }
698
699 /**
700 * Clears all previous abort request, and abortRequested returns false
701 * after calling this method.
702 */
703 protected void clearAbortRequest() {
704 throw new UnsupportedOperationException("Not implemented yet");
705 }
706
707 /**
708 * Adds the IIOReadWarningListener.
709 *
710 * @param listener the IIOReadWarningListener.
711 */
712 public void addIIOReadWarningListener(IIOReadWarningListener listener) {
713 throw new UnsupportedOperationException("Not implemented yet");
714 }
715
716 /**
717 * Removes the specified IIOReadWarningListener.
718 *
719 * @param listener the IIOReadWarningListener to be removed.
720 */
721 public void removeIIOReadWarningListener(IIOReadWarningListener listener) {
722 throw new UnsupportedOperationException("Not implemented yet");
723 }
724
725 /**
726 * Removes all registered IIOReadWarningListeners.
727 */
728 public void removeAllIIOReadWarningListeners() {
729 throw new UnsupportedOperationException("Not implemented yet");
730 }
731
732 /**
733 * Adds the IIOReadProgressListener.
734 *
735 * @param listener the IIOReadProgressListener.
736 */
737 public void addIIOReadProgressListener(IIOReadProgressListener listener) {
738 throw new UnsupportedOperationException("Not implemented yet");
739 }
740
741 /**
742 * Removes the specified IIOReadProgressListener.
743 *
744 * @param listener the IIOReadProgressListener to be removed.
745 */
746 public void removeIIOReadProgressListener(IIOReadProgressListener listener) {
747 throw new UnsupportedOperationException("Not implemented yet");
748 }
749
750 /**
751 * Removes registered IIOReadProgressListeners.
752 */
753 public void removeAllIIOReadProgressListeners() {
754 throw new UnsupportedOperationException("Not implemented yet");
755 }
756
757 /**
758 * Adds the IIOReadUpdateListener.
759 *
760 * @param listener the IIOReadUpdateListener.
761 */
762 public void addIIOReadUpdateListener(IIOReadUpdateListener listener) {
763 throw new UnsupportedOperationException("Not implemented yet");
764 }
765
766 /**
767 * Removes the specified IIOReadUpdateListener.
768 *
769 * @param listener the IIOReadUpdateListener to be removed.
770 */
771 public void removeIIOReadUpdateListener(IIOReadUpdateListener listener) {
772 throw new UnsupportedOperationException("Not implemented yet");
773 }
774
775 /**
776 * Removes registered IIOReadUpdateListeners.
777 */
778 public void removeAllIIOReadUpdateListeners() {
779 throw new UnsupportedOperationException("Not implemented yet");
780 }
781
782 /**
783 * Processes the start of an sequence of image reads
784 * by calling the sequenceStarted method on all registered
785 * IIOReadProgressListeners.
786 *
787 * @param minIndex the minimum index.
788 */
789 protected void processSequenceStarted(int minIndex) {
790 throw new UnsupportedOperationException("Not implemented yet");
791 }
792
793 /**
794 * Processes the completion of an sequence of image reads
795 * by calling sequenceComplete method on all registered
796 * IIOReadProgressListeners.
797 */
798 protected void processSequenceComplete() {
799 throw new UnsupportedOperationException("Not implemented yet");
800 }
801
802 /**
803 * Processes the start of an image read by calling the imageStarted
804 * method on all registered IIOReadProgressListeners.
805 *
806 * @param imageIndex the image index.
807 */
808 protected void processImageStarted(int imageIndex) {
809 throw new UnsupportedOperationException("Not implemented yet");
810 }
811
812 /**
813 * Processes the current percentage of image completion by calling
814 * the imageProgress method on all registered IIOReadProgressListeners.
815 *
816 * @param percentageDone the percentage done.
817 */
818 protected void processImageProgress(float percentageDone) {
819 throw new UnsupportedOperationException("Not implemented yet");
820 }
821
822 /**
823 * Processes image completion by calling the imageComplete method
824 * on all registered IIOReadProgressListeners.
825 */
826 protected void processImageComplete() {
827 throw new UnsupportedOperationException("Not implemented yet");
828 }
829
830 /**
831 * Processes the start of a thumbnail read by calling the
832 * thumbnailStarted method on all registered IIOReadProgressListeners.
833 *
834 * @param imageIndex the image index.
835 * @param thumbnailIndex the thumbnail index.
836 */
837 protected void processThumbnailStarted(int imageIndex, int thumbnailIndex) {
838 throw new UnsupportedOperationException("Not implemented yet");
839 }
840
841 /**
842 * Processes the current percentage of thumbnail completion
843 * by calling the thumbnailProgress method on all registered
844 * IIOReadProgressListeners.
845 *
846 * @param percentageDone the percentage done.
847 */
848 protected void processThumbnailProgress(float percentageDone) {
849 throw new UnsupportedOperationException("Not implemented yet");
850 }
851
852 /**
853 * Processes the completion of a thumbnail read
854 * by calling the thumbnailComplete method
855 * on all registered IIOReadProgressListeners.
856 */
857 protected void processThumbnailComplete() {
858 throw new UnsupportedOperationException("Not implemented yet");
859 }
860
861 /**
862 * Processes a read aborted event by calling the readAborted
863 * method on all registered IIOReadProgressListeners.
864 */
865 protected void processReadAborted() {
866 throw new UnsupportedOperationException("Not implemented yet");
867 }
868
869 /**
870 * Processes the beginning of a progressive pass by calling
871 * the passStarted method on all registered IIOReadUpdateListeners.
872 *
873 * @param theImage the image to be updated.
874 * @param pass the current pass index.
875 * @param minPass the minimum pass index.
876 * @param maxPass the maximum pass index.
877 * @param minX the X coordinate of of the upper left pixel.
878 * @param minY the Y coordinate of of the upper left pixel.
879 * @param periodX the horizontal separation between pixels.
880 * @param periodY the vertical separation between pixels.
881 * @param bands the number of affected bands.
882 */
883 protected void processPassStarted(BufferedImage theImage,
884 int pass,
885 int minPass,
886 int maxPass,
887 int minX,
888 int minY,
889 int periodX,
890 int periodY,
891 int[] bands) {
892 throw new UnsupportedOperationException("Not implemented yet");
893 }
894
895 /**
896 * Processes the update of a set of samples by calling
897 * the imageUpdate method on all registered IIOReadUpdateListeners.
898 *
899 * @param theImage the image to be updated.
900 * @param minX the X coordinate of the upper left pixel.
901 * @param minY the Y coordinate of the upper left pixel.
902 * @param width the width of updated area.
903 * @param height the height of updated area.
904 * @param periodX the horizontal separation between pixels.
905 * @param periodY the vertical separation between pixels.
906 * @param bands the number of affected bands.
907 */
908 protected void processImageUpdate(BufferedImage theImage,
909 int minX,
910 int minY,
911 int width,
912 int height,
913 int periodX,
914 int periodY,
915 int[] bands) {
916 throw new UnsupportedOperationException("Not implemented yet");
917 }
918
919 /**
920 * Processes the end of a progressive pass by calling passComplete
921 * method of registered IIOReadUpdateListeners.
922 *
923 * @param theImage the image to be updated.
924 */
925 protected void processPassComplete(BufferedImage theImage) {
926 throw new UnsupportedOperationException("Not implemented yet");
927 }
928
929 /**
930 * Processes the beginning of a thumbnail progressive pass
931 * by calling the thumbnailPassStarted method on all
932 * registered IIOReadUpdateListeners.
933 *
934 * @param theThumbnail the the thumbnail to be updated.
935 * @param pass the current pass index.
936 * @param minPass the minimum pass index.
937 * @param maxPass the maximum pass index.
938 * @param minX the X coordinate of the upper left pixel.
939 * @param minY the Y coordinate of the upper left pixel.
940 * @param periodX the horizontal separation between pixels.
941 * @param periodY the vertical separation between pixels.
942 * @param bands the number of affected bands.
943 */
944 protected void processThumbnailPassStarted(BufferedImage theThumbnail,
945 int pass,
946 int minPass,
947 int maxPass,
948 int minX,
949 int minY,
950 int periodX,
951 int periodY,
952 int[] bands) {
953 throw new UnsupportedOperationException("Not implemented yet");
954 }
955
956 /**
957 * Processes the update of a set of samples in a thumbnail
958 * image by calling the thumbnailUpdate method on all
959 * registered IIOReadUpdateListeners.
960 *
961 * @param theThumbnail the the thumbnail to be updated.
962 * @param minX the X coordinate of the upper left pixel.
963 * @param minY the Y coordinate of the upper left pixel.
964 * @param periodX the horizontal separation between pixels.
965 * @param periodY the vertical separation between pixels.
966 * @param bands the number of affected bands.
967 */
968 protected void processThumbnailUpdate(BufferedImage theThumbnail,
969 int minX,
970 int minY,
971 int width,
972 int height,
973 int periodX,
974 int periodY,
975 int[] bands) {
976 throw new UnsupportedOperationException("Not implemented yet");
977 }
978
979 /**
980 * Processes the end of a thumbnail progressive pass
981 * by calling the thumbnailPassComplete method
982 * on all registered IIOReadUpdateListeners.
983 *
984 * @param theThumbnail the thumbnail to be updated.
985 */
986 protected void processThumbnailPassComplete(BufferedImage theThumbnail) {
987 throw new UnsupportedOperationException("Not implemented yet");
988 }
989
990 /**
991 * Processes a warning message by calling warningOccurred method
992 * of registered IIOReadWarningListeners.
993 *
994 * @param warning the warning.
995 */
996 protected void processWarningOccurred(String warning) {
997 throw new UnsupportedOperationException("Not implemented yet");
998 }
999
1000 /**
1001 * Processes a warning by calling the warningOccurred method
1002 * of on all registered IIOReadWarningListeners.
1003 *
1004 * @param baseName the base name of ResourceBundles.
1005 * @param keyword the keyword to index the warning among ResourceBundles.
1006 */
1007 protected void processWarningOccurred(String baseName, String keyword) {
1008 throw new UnsupportedOperationException("Not implemented yet");
1009 }
1010
1011 /**
1012 * Resets this ImageReader.
1013 */
1014 public void reset() {
1015 // def
1016 setInput(null, false);
1017 setLocale(null);
1018 removeAllIIOReadUpdateListeners();
1019 removeAllIIOReadWarningListeners();
1020 removeAllIIOReadProgressListeners();
1021 clearAbortRequest();
1022 }
1023
1024 /**
1025 * Disposes of any resources.
1026 */
1027 public void dispose() {
1028 // do nothing by def
1029 }
1030
1031 /**
1032 * Gets the region of source image that should be read with the
1033 * specified width, height and ImageReadParam.
1034 *
1035 * @param param the ImageReadParam object, or null.
1036 * @param srcWidth the source image's width.
1037 * @param srcHeight the source image's height.
1038 *
1039 * @return the Rectangle of source region.
1040 */
1041 protected static Rectangle getSourceRegion(ImageReadParam param, int srcWidth, int srcHeight) {
1042 throw new UnsupportedOperationException("Not implemented yet");
1043 }
1044
1045 /**
1046 * Computes the specified source region and the specified destination
1047 * region with the specified the width and height of the source image,
1048 * an optional destination image, and an ImageReadParam.
1049 *
1050 * @param param the an ImageReadParam object, or null.
1051 * @param srcWidth the source image's width.
1052 * @param srcHeight the source image's height.
1053 * @param image the destination image.
1054 * @param srcRegion the source region.
1055 * @param destRegion the destination region.
1056 */
1057 protected static void computeRegions(ImageReadParam param,
1058 int srcWidth,
1059 int srcHeight,
1060 BufferedImage image,
1061 Rectangle srcRegion,
1062 Rectangle destRegion) {
1063 throw new UnsupportedOperationException("Not implemented yet");
1064 }
1065
1066 /**
1067 * Checks the validity of the source and destination band and is called
1068 * when the reader knows the number of bands of the source image and
1069 * the number of bands of the destination image.
1070 *
1071 * @param param the ImageReadParam for reading the Image.
1072 * @param numSrcBands the number of bands in the source.
1073 * @param numDstBands the number of bands in the destination.
1074 */
1075 protected static void checkReadParamBandSettings(ImageReadParam param,
1076 int numSrcBands,
1077 int numDstBands) {
1078 throw new UnsupportedOperationException("Not implemented yet");
1079 }
1080
1081 /**
1082 * Gets the destination image where the decoded data is written.
1083 *
1084 * @param param the ImageReadParam.
1085 * @param imageTypes the iterator of ImageTypeSpecifier objects.
1086 * @param width the width of the image being decoded.
1087 * @param height the height of the image being decoded.
1088 *
1089 * @return the BufferedImage where decoded pixels should be written.
1090 *
1091 * @throws IIOException the IIOException is thrown if
1092 * there is no suitable ImageTypeSpecifier.
1093 */
1094 protected static BufferedImage getDestination(ImageReadParam param, Iterator<ImageTypeSpecifier> imageTypes,
1095 int width,
1096 int height)
1097 throws IIOException {
1098 throw new UnsupportedOperationException("Not implemented yet");
1099 }
1100}