< prev index next >

src/java.desktop/share/classes/java/awt/image/VolatileImage.java

Print this page


   1 /*
   2  * Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


 115  *      }
 116  *      gScreen.drawImage(vImg, 0, 0, this);
 117  * } while (vImg.contentsLost());
 118  * </pre>
 119  * <P>
 120  * Note that this class subclasses from the {@link Image} class, which
 121  * includes methods that take an {@link ImageObserver} parameter for
 122  * asynchronous notifications as information is received from
 123  * a potential {@link ImageProducer}.  Since this {@code VolatileImage}
 124  * is not loaded from an asynchronous source, the various methods that take
 125  * an {@code ImageObserver} parameter will behave as if the data has
 126  * already been obtained from the {@code ImageProducer}.
 127  * Specifically, this means that the return values from such methods
 128  * will never indicate that the information is not yet available and
 129  * the {@code ImageObserver} used in such methods will never
 130  * need to be recorded for an asynchronous callback notification.
 131  * @since 1.4
 132  */
 133 public abstract class VolatileImage extends Image implements Transparency
 134 {





 135 
 136     // Return codes for validate() method
 137 
 138     /**
 139      * Validated image is ready to use as-is.
 140      */
 141     public static final int IMAGE_OK = 0;
 142 
 143     /**
 144      * Validated image has been restored and is now ready to use.
 145      * Note that restoration causes contents of the image to be lost.
 146      */
 147     public static final int IMAGE_RESTORED = 1;
 148 
 149     /**
 150      * Validated image is incompatible with supplied
 151      * {@code GraphicsConfiguration} object and should be
 152      * re-created as appropriate.  Usage of the image as-is
 153      * after receiving this return code from {@code validate}
 154      * is undefined.


   1 /*
   2  * Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


 115  *      }
 116  *      gScreen.drawImage(vImg, 0, 0, this);
 117  * } while (vImg.contentsLost());
 118  * </pre>
 119  * <P>
 120  * Note that this class subclasses from the {@link Image} class, which
 121  * includes methods that take an {@link ImageObserver} parameter for
 122  * asynchronous notifications as information is received from
 123  * a potential {@link ImageProducer}.  Since this {@code VolatileImage}
 124  * is not loaded from an asynchronous source, the various methods that take
 125  * an {@code ImageObserver} parameter will behave as if the data has
 126  * already been obtained from the {@code ImageProducer}.
 127  * Specifically, this means that the return values from such methods
 128  * will never indicate that the information is not yet available and
 129  * the {@code ImageObserver} used in such methods will never
 130  * need to be recorded for an asynchronous callback notification.
 131  * @since 1.4
 132  */
 133 public abstract class VolatileImage extends Image implements Transparency
 134 {
 135 
 136     /**
 137      * Constructor for subclasses to call.
 138      */
 139     public VolatileImage() {}
 140 
 141     // Return codes for validate() method
 142 
 143     /**
 144      * Validated image is ready to use as-is.
 145      */
 146     public static final int IMAGE_OK = 0;
 147 
 148     /**
 149      * Validated image has been restored and is now ready to use.
 150      * Note that restoration causes contents of the image to be lost.
 151      */
 152     public static final int IMAGE_RESTORED = 1;
 153 
 154     /**
 155      * Validated image is incompatible with supplied
 156      * {@code GraphicsConfiguration} object and should be
 157      * re-created as appropriate.  Usage of the image as-is
 158      * after receiving this return code from {@code validate}
 159      * is undefined.


< prev index next >