1 /*
2 * Copyright (c) 1995, 2013, 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
27 import java.awt.image.ImageProducer;
28 import java.awt.image.ImageObserver;
29 import java.awt.image.ImageFilter;
30 import java.awt.image.FilteredImageSource;
31 import java.awt.image.AreaAveragingScaleFilter;
32 import java.awt.image.ReplicateScaleFilter;
33
34 import sun.awt.image.SurfaceManager;
35
36
37 /**
38 * The abstract class {@code Image} is the superclass of all
39 * classes that represent graphical images. The image must be
40 * obtained in a platform-specific manner.
41 *
42 * @author Sami Shaio
43 * @author Arthur van Hoff
44 * @since 1.0
45 */
46 public abstract class Image {
47
48 /**
49 * convenience object; we can use this single static object for
50 * all images that do not create their own image caps; it holds the
51 * default (unaccelerated) properties.
52 */
53 private static ImageCapabilities defaultImageCaps =
54 new ImageCapabilities(false);
55
56 /**
57 * Priority for accelerating this image. Subclasses are free to
58 * set different default priorities and applications are free to
59 * set the priority for specific images via the
60 * {@code setAccelerationPriority(float)} method.
61 * @since 1.5
62 */
63 protected float accelerationPriority = .5f;
64
65 /**
66 * Determines the width of the image. If the width is not yet known,
|
1 /*
2 * Copyright (c) 1995, 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
27 import java.awt.image.ImageProducer;
28 import java.awt.image.ImageObserver;
29 import java.awt.image.ImageFilter;
30 import java.awt.image.FilteredImageSource;
31 import java.awt.image.AreaAveragingScaleFilter;
32 import java.awt.image.ReplicateScaleFilter;
33
34 import sun.awt.image.SurfaceManager;
35
36
37 /**
38 * The abstract class {@code Image} is the superclass of all
39 * classes that represent graphical images. The image must be
40 * obtained in a platform-specific manner.
41 *
42 * @author Sami Shaio
43 * @author Arthur van Hoff
44 * @since 1.0
45 */
46 public abstract class Image {
47
48 /**
49 * Creates an {@code Image}.
50 */
51 protected Image() {}
52
53 /**
54 * convenience object; we can use this single static object for
55 * all images that do not create their own image caps; it holds the
56 * default (unaccelerated) properties.
57 */
58 private static ImageCapabilities defaultImageCaps =
59 new ImageCapabilities(false);
60
61 /**
62 * Priority for accelerating this image. Subclasses are free to
63 * set different default priorities and applications are free to
64 * set the priority for specific images via the
65 * {@code setAccelerationPriority(float)} method.
66 * @since 1.5
67 */
68 protected float accelerationPriority = .5f;
69
70 /**
71 * Determines the width of the image. If the width is not yet known,
|