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