1/*
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 Igor V. Stolyarov
19 * @version $Revision$
20 */
21
22package java.awt.image.renderable;
23
24import java.awt.RenderingHints;
25import java.awt.image.RenderedImage;
26import java.util.Vector;
27
28/**
29 * The Interface RenderableImage is implemented by an object that collects all
30 * of the image-specific data that defines a single image that could be rendered
31 * to different rendering targets.
32 *
33 * @since Android 1.0
34 */
35public interface RenderableImage {
36
37    /**
38     * The Constant HINTS_OBSERVED indicates that the rendering hints are
39     * applied rather than ignored.
40     */
41    public static final String HINTS_OBSERVED = "HINTS_OBSERVED"; //$NON-NLS-1$
42
43    /**
44     * Gets the property from the RenderableImage's parameter block.
45     *
46     * @param name
47     *            the name of the property to get.
48     * @return the value of the property.
49     */
50    public Object getProperty(String name);
51
52    /**
53     * Creates the rendered image based on the information contained in the
54     * parameters and the render context.
55     *
56     * @param renderContext
57     *            the render context giving rendering specifications such as
58     *            transformations.
59     * @return the rendered image.
60     */
61    public RenderedImage createRendering(RenderContext renderContext);
62
63    /**
64     * Creates the scaled rendered image based on the information contained in
65     * the parameters and the render context.
66     *
67     * @param w
68     *            the desired width after scaling or zero if the scaling should
69     *            be proportional, based on the height.
70     * @param h
71     *            the desired height after scaling or zero if the scaling should
72     *            be proportional, based on the width.
73     * @param hints
74     *            the rendering hints to use.
75     * @return the rendered image.
76     * @throws IllegalArgumentException
77     *             if both the height and width are zero.
78     */
79    public RenderedImage createScaledRendering(int w, int h, RenderingHints hints);
80
81    /**
82     * Gets the vector of sources from the parameter block.
83     *
84     * @return the sources.
85     */
86    public Vector<RenderableImage> getSources();
87
88    /**
89     * Gets the names of all of the supported properties in the current context.
90     *
91     * @return the property names.
92     */
93    public String[] getPropertyNames();
94
95    /**
96     * Creates the default rendering (using the identity transform and default
97     * render context).
98     *
99     * @return the rendered image.
100     */
101    public RenderedImage createDefaultRendering();
102
103    /**
104     * Checks if this context supports dynamic rendering.
105     *
106     * @return true, if this context supports dynamic rendering.
107     */
108    public boolean isDynamic();
109
110    /**
111     * Gets the width of the image.
112     *
113     * @return the width of the image.
114     */
115    public float getWidth();
116
117    /**
118     * Gets the y coordinate of the upper left corner.
119     *
120     * @return the y coordinate of the upper left corner.
121     */
122    public float getMinY();
123
124    /**
125     * Gets the x coordinate of the upper left corner.
126     *
127     * @return the x coordinate of the upper left corner.
128     */
129    public float getMinX();
130
131    /**
132     * Gets the height of the image.
133     *
134     * @return the height of the image.
135     */
136    public float getHeight();
137
138}
139