< prev index next >
src/java.desktop/share/classes/java/awt/image/ImageProducer.java
Print this page
*** 23,32 ****
--- 23,35 ----
* questions.
*/
package java.awt.image;
+ import java.util.Arrays;
+ import java.util.List;
+
/**
* The interface for objects which can produce the image data for Images.
* Each image contains an ImageProducer which is used to reconstruct
* the image whenever it is needed, for example, when a new size of the
* Image is scaled, or when the width or height of the Image is being
*** 107,112 ****
--- 110,151 ----
* }</pre>
* @param ic the specified {@code ImageConsumer}
* @see ImageConsumer#setHints
*/
public void requestTopDownLeftRightResend(ImageConsumer ic);
+
+ /**
+ * Returns {@code true} if {@code ImageProducer} consist of a set of
+ * image producers which can be used for {@code MultiResolutionImage}
+ * construction.
+ *
+ * @return {@code true} if {@code ImageProducer} consist of a set of
+ * image producers
+ *
+ * @see #getResolutionVariantItems
+ * @see MultiResolutionImage
+ *
+ * @since 9
+ */
+ default boolean isMultiResolutionImageProducer() {
+ return false;
+ }
+
+ /**
+ * Gets a readable list of all resolution variant items consisting of
+ * {@code ImageProducer} and associated scale factors. The provided
+ * resolution variant items can be used for {@code MultiResolutionImage}
+ * construction.
+ * The list must be nonempty and contain at least one resolution variant item.
+ * <p>
+ * Note that many implementations might return an unmodifiable list.
+ *
+ * @return list of resolution variant items.
+ * @see #isMultiResolutionImageProducer
+ * @see MultiResolutionImage
+ *
+ * @since 9
+ */
+ default List<ResolutionVariantItem<ImageProducer>> getResolutionVariantItems() {
+ return Arrays.asList(new ResolutionVariantItem<>(this, 1, 1));
+ }
}
< prev index next >