OSDN Git Service

2002-04-07 Adam King <aking@dreammechanics.com>
[pf3gnuchains/gcc-fork.git] / libjava / java / awt / RenderingHints.java
1 /* Copyright (C) 2000, 2001, 2002  Free Software Foundation
2
3 This file is part of GNU Classpath.
4
5 GNU Classpath is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2, or (at your option)
8 any later version.
9
10 GNU Classpath is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13 General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with GNU Classpath; see the file COPYING.  If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18 02111-1307 USA.
19
20 Linking this library statically or dynamically with other modules is
21 making a combined work based on this library.  Thus, the terms and
22 conditions of the GNU General Public License cover the whole
23 combination.
24
25 As a special exception, the copyright holders of this library give you
26 permission to link this library with independent modules to produce an
27 executable, regardless of the license terms of these independent
28 modules, and to copy and distribute the resulting executable under
29 terms of your choice, provided that you also meet, for each linked
30 independent module, the terms and conditions of the license of that
31 module.  An independent module is a module which is not derived from
32 or based on this library.  If you modify this library, you may extend
33 this exception to your version of the library, but you are not
34 obligated to do so.  If you do not wish to do so, delete this
35 exception statement from your version. */
36
37 package java.awt;
38
39 /**
40  * @author Rolf W. Rasmussen <rolfwr@ii.uib.no>
41  */
42 public class RenderingHints implements
43     //java.util.Map,
44     Cloneable
45 {
46
47   public abstract static class Key
48   {
49     private int intKey;
50
51     protected Key(int privateKey)
52     {
53       intKey = privateKey;
54     }
55
56     public abstract boolean isCompatibleValue(Object value);
57     
58     protected final int intKey() 
59     {
60       return intKey;
61     }    
62
63     public final int hashCode() 
64     {
65       return System.identityHashCode(this);
66     }
67     
68     public final boolean equals(Object other) 
69     {
70       return (this == other);
71     }
72   }
73
74   private static class KeyImpl extends Key
75   {
76     String description;
77     Object v1, v2, v3;
78
79     KeyImpl(int privateKey, String description,
80             Object v1, Object v2, Object v3)
81     {
82       super(privateKey);
83       this.description = description;
84       this.v1 = v1;
85       this.v2 = v2;
86       this.v3 = v3;
87     }
88     
89     public boolean isCompatibleValue(Object value) 
90     {
91       return (value == v1) || (value == v2) || (value == v3);
92     }
93
94     public String toString() 
95     {
96       return description;
97     }
98   }
99
100
101   //java.util.HashMap hintMap;
102
103   public static final Key KEY_ANTIALIASING;
104   public static final Object
105     VALUE_ANTIALIAS_ON = "Antialiased rendering mode",
106     VALUE_ANTIALIAS_DEFAULT = "Default antialiasing rendering mode";
107
108   static 
109   {
110     KEY_ANTIALIASING = new KeyImpl(1, "Global antialiasing enable key",
111                                    VALUE_ANTIALIAS_ON,
112                                    VALUE_ANTIALIAS_DEFAULT,
113                                    VALUE_ANTIALIAS_DEFAULT);
114   }
115
116   public static final Key KEY_RENDERING;
117   public static final Object 
118     VALUE_RENDER_SPEED = "Fastest rendering methods",
119     VALUE_RENDER_QUALITY = "Highest quality rendering methods",
120     VALUE_RENDER_DEFAULT = "Default rendering methods";
121
122   static
123   {
124     KEY_RENDERING = new KeyImpl(2, "Global rendering quality key",
125                                 VALUE_RENDER_SPEED,
126                                 VALUE_RENDER_QUALITY,
127                                 VALUE_RENDER_DEFAULT);
128   }
129   
130   public static final Key KEY_DITHERING;
131   public static final Object
132     VALUE_DITHER_DISABLE = "Nondithered rendering mode",
133     VALUE_DITHER_ENABLE = "Dithered rendering mode",
134     VALUE_DITHER_DEFAULT = "Default dithering mode";
135
136   static
137   {
138     KEY_DITHERING = new KeyImpl(3, "Dithering quality key",
139                                 VALUE_DITHER_DISABLE,
140                                 VALUE_DITHER_ENABLE,
141                                 VALUE_DITHER_DEFAULT);
142   }
143   
144   public static final Key KEY_TEXT_ANTIALIASING;
145   public static final Object
146     VALUE_TEXT_ANTIALIAS_ON = "Antialiased text mode",
147     VALUE_TEXT_ANTIALIAS_OFF = "Nonantialiased text mode",
148     VALUE_TEXT_ANTIALIAS_DEFAULT = "Default antialiasing text mode";
149
150   static 
151   {
152     KEY_TEXT_ANTIALIASING = new KeyImpl(4, "Text-specific antialiasing enable key",
153                                         VALUE_TEXT_ANTIALIAS_ON,
154                                         VALUE_TEXT_ANTIALIAS_OFF,
155                                         VALUE_TEXT_ANTIALIAS_DEFAULT);
156   }
157   
158   public static final Key KEY_FRACTIONALMETRICS;
159   public static final Object
160     VALUE_FRACTIONALMETRICS_OFF = "Integer text metrics mode",
161     VALUE_FRACTIONALMETRICS_ON = "Fractional text metrics mode",
162     VALUE_FRACTIONALMETRICS_DEFAULT = "Default fractional text metrics mode";
163
164   static 
165   {
166     KEY_FRACTIONALMETRICS = new KeyImpl(5, "Fractional metrics enable key",
167                                         VALUE_FRACTIONALMETRICS_OFF,
168                                         VALUE_FRACTIONALMETRICS_ON,
169                                         VALUE_FRACTIONALMETRICS_DEFAULT);
170   }
171   
172   public static final Key KEY_INTERPOLATION;
173   public static final Object
174     VALUE_INTERPOLATION_NEAREST_NEIGHBOR = "Nearest Neighbor image interpolation mode",
175     VALUE_INTERPOLATION_BILINEAR = "Bilinear image interpolation mode",
176     VALUE_INTERPOLATION_BICUBIC = "Bicubic image interpolation mode";
177
178   static 
179   {
180     KEY_INTERPOLATION = new KeyImpl(6, "Image interpolation method key",
181                                     VALUE_INTERPOLATION_NEAREST_NEIGHBOR,
182                                     VALUE_INTERPOLATION_BILINEAR,
183                                     VALUE_INTERPOLATION_BICUBIC);
184   }
185   
186   public static final Key KEY_ALPHA_INTERPOLATION;
187   public static final Object
188     VALUE_ALPHA_INTERPOLATION_SPEED = "Fastest alpha blending methods",
189     VALUE_ALPHA_INTERPOLATION_QUALITY = "Highest quality alpha blending methods",
190     VALUE_ALPHA_INTERPOLATION_DEFAULT = "Default alpha blending methods";
191
192   static
193   {
194     KEY_ALPHA_INTERPOLATION = new KeyImpl(7, "Alpha blending interpolation method key",
195                                           VALUE_ALPHA_INTERPOLATION_SPEED,
196                                           VALUE_ALPHA_INTERPOLATION_QUALITY,
197                                           VALUE_ALPHA_INTERPOLATION_DEFAULT);
198   }
199   
200   public static final Key KEY_COLOR_RENDERING;
201   public static final Object
202     VALUE_COLOR_RENDER_SPEED = "Fastest color rendering mode",
203     VALUE_COLOR_RENDER_QUALITY = "Highest quality color rendering mode",
204     VALUE_COLOR_RENDER_DEFAULT = "Default color rendering mode";
205
206   static 
207   {
208     KEY_COLOR_RENDERING = new KeyImpl(8, "Color rendering quality key",
209                                       VALUE_COLOR_RENDER_SPEED,
210                                       VALUE_COLOR_RENDER_QUALITY,
211                                       VALUE_COLOR_RENDER_DEFAULT);
212   }
213
214   public static final Key KEY_STROKE_CONTROL;
215   public static final Object
216     VALUE_STROKE_DEFAULT = "Default stroke control mode",
217     VALUE_STROKE_NORMALIZE = "Normalize stroke control mode",
218     VALUE_STROKE_PURE = "Pure stroke control mode";
219
220   static 
221   {
222     KEY_STROKE_CONTROL = new KeyImpl(9, "Stroke normalization control key",
223                                      VALUE_STROKE_DEFAULT,
224                                      VALUE_STROKE_NORMALIZE,
225                                      VALUE_STROKE_PURE);
226   }
227   
228   //public RenderingHints(Map init);
229
230   public RenderingHints(Key key, Object value)
231   {
232     throw new UnsupportedOperationException("FIXME, not implemented yet");
233   }
234
235   public int size() 
236   {
237     throw new UnsupportedOperationException("FIXME, not implemented yet");
238   }
239   
240   public boolean isEmpty() 
241   {
242     throw new UnsupportedOperationException("FIXME, not implemented yet");
243   }
244
245   public boolean containsKey(Object key) 
246   {      
247     throw new UnsupportedOperationException("FIXME, not implemented yet");
248   }
249   
250   public boolean containsValue(Object value) 
251   {
252     throw new UnsupportedOperationException("FIXME, not implemented yet");
253   }
254   
255   public Object get(Object key)
256   {
257     throw new UnsupportedOperationException("FIXME, not implemented yet");
258   }
259   
260   public Object put(Object key, Object value) 
261   {
262     throw new UnsupportedOperationException("FIXME, not implemented yet");
263   }
264   
265   public void add(RenderingHints hints) 
266   {
267     throw new UnsupportedOperationException("FIXME, not implemented yet");
268   }
269
270   public void clear() 
271   {
272     throw new UnsupportedOperationException("FIXME, not implemented yet");
273   }
274   
275   public Object remove(Object key) 
276   {
277     throw new UnsupportedOperationException("FIXME, not implemented yet");
278   }
279   
280   /*
281   public void putAll(Map m) 
282   {
283     throw new UnsupportedOperationException("FIXME, not implemented yet");
284   }
285   */
286   
287   /*
288   public Set keySet() 
289   {
290     throw new UnsupportedOperationException("FIXME, not implemented yet");
291   }
292   */
293   
294   /*
295   public Collection values() 
296   {
297     throw new UnsupportedOperationException("FIXME, not implemented yet");
298   }
299   */
300   
301   /*
302   public Set entrySet() 
303   {
304     throw new UnsupportedOperationException("FIXME, not implemented yet");
305   }
306   */
307   
308   public boolean equals(Object o) 
309   {
310     throw new UnsupportedOperationException("FIXME, not implemented yet");
311   }
312   
313   public int hashCode() 
314   {
315     throw new UnsupportedOperationException("FIXME, not implemented yet");
316   }
317   
318   public Object clone() 
319   {
320     throw new UnsupportedOperationException("FIXME, not implemented yet");
321   }
322   
323   public String toString() 
324   {
325     throw new UnsupportedOperationException("FIXME, not implemented yet");
326   }
327 }