1 /* 2 * Copyright (c) 1998, 2005, 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 23 * questions. 24 */ 25 26 package sun.awt; 27 28 import java.awt.RenderingHints; 29 import javax.tools.annotation.GenerateNativeHeader; 30 31 /** 32 * This class contains rendering hints that can be used by the 33 * {@link java.awt.Graphics2D} class, and classes that implement 34 * {@link java.awt.image.BufferedImageOp} and 35 * {@link java.awt.image.Raster}. 36 */ 37 /* No native methods here, but the constants are needed in the supporting JNI code */ 38 @GenerateNativeHeader 39 public class SunHints { 40 /** 41 * Defines the type of all keys used to control various 42 * aspects of the rendering and imaging pipelines. Instances 43 * of this class are immutable and unique which means that 44 * tests for matches can be made using the == operator instead 45 * of the more expensive equals() method. 46 */ 47 public static class Key extends RenderingHints.Key { 48 String description; 49 50 /** 51 * Construct a key using the indicated private key. Each 52 * subclass of Key maintains its own unique domain of integer 53 * keys. No two objects with the same integer key and of the 54 * same specific subclass can be constructed. An exception 55 * will be thrown if an attempt is made to construct another 56 * object of a given class with the same integer key as a 57 * pre-existing instance of that subclass of Key. 58 */ 163 */ 164 public final int hashCode() { 165 return System.identityHashCode(this); 166 } 167 168 /** 169 * The equals method for all SunHints.Value objects will return 170 * the same result as the equality operator '=='. 171 */ 172 public final boolean equals(Object o) { 173 return this == o; 174 } 175 } 176 177 private static final int NUM_KEYS = 9; 178 private static final int VALS_PER_KEY = 8; 179 180 /** 181 * Rendering hint key and values 182 */ 183 public static final int INTKEY_RENDERING = 0; 184 public static final int INTVAL_RENDER_DEFAULT = 0; 185 public static final int INTVAL_RENDER_SPEED = 1; 186 public static final int INTVAL_RENDER_QUALITY = 2; 187 188 /** 189 * Antialiasing hint key and values 190 */ 191 public static final int INTKEY_ANTIALIASING = 1; 192 public static final int INTVAL_ANTIALIAS_DEFAULT = 0; 193 public static final int INTVAL_ANTIALIAS_OFF = 1; 194 public static final int INTVAL_ANTIALIAS_ON = 2; 195 196 /** 197 * Text antialiasing hint key and values 198 */ 199 public static final int INTKEY_TEXT_ANTIALIASING = 2; 200 public static final int INTVAL_TEXT_ANTIALIAS_DEFAULT = 0; 201 public static final int INTVAL_TEXT_ANTIALIAS_OFF = 1; 202 public static final int INTVAL_TEXT_ANTIALIAS_ON = 2; 203 public static final int INTVAL_TEXT_ANTIALIAS_GASP = 3; 204 public static final int INTVAL_TEXT_ANTIALIAS_LCD_HRGB = 4; 205 public static final int INTVAL_TEXT_ANTIALIAS_LCD_HBGR = 5; 206 public static final int INTVAL_TEXT_ANTIALIAS_LCD_VRGB = 6; 207 public static final int INTVAL_TEXT_ANTIALIAS_LCD_VBGR = 7; 208 209 /** 210 * Font fractional metrics hint key and values 211 */ 212 public static final int INTKEY_FRACTIONALMETRICS = 3; 213 public static final int INTVAL_FRACTIONALMETRICS_DEFAULT = 0; 214 public static final int INTVAL_FRACTIONALMETRICS_OFF = 1; 215 public static final int INTVAL_FRACTIONALMETRICS_ON = 2; 216 217 /** 218 * Dithering hint key and values 219 */ 220 public static final int INTKEY_DITHERING = 4; 221 public static final int INTVAL_DITHER_DEFAULT = 0; 222 public static final int INTVAL_DITHER_DISABLE = 1; 223 public static final int INTVAL_DITHER_ENABLE = 2; 224 225 /** 226 * Interpolation hint key and values 227 */ 228 public static final int INTKEY_INTERPOLATION = 5; 229 public static final int INTVAL_INTERPOLATION_NEAREST_NEIGHBOR = 0; 230 public static final int INTVAL_INTERPOLATION_BILINEAR = 1; 231 public static final int INTVAL_INTERPOLATION_BICUBIC = 2; 232 233 /** 234 * Alpha interpolation hint key and values 235 */ 236 public static final int INTKEY_ALPHA_INTERPOLATION = 6; 237 public static final int INTVAL_ALPHA_INTERPOLATION_DEFAULT = 0; 238 public static final int INTVAL_ALPHA_INTERPOLATION_SPEED = 1; 239 public static final int INTVAL_ALPHA_INTERPOLATION_QUALITY = 2; 240 241 /** 242 * Color rendering hint key and values 243 */ 244 public static final int INTKEY_COLOR_RENDERING = 7; 245 public static final int INTVAL_COLOR_RENDER_DEFAULT = 0; 246 public static final int INTVAL_COLOR_RENDER_SPEED = 1; 247 public static final int INTVAL_COLOR_RENDER_QUALITY = 2; 248 249 /** 250 * Stroke normalization control hint key and values 251 */ 252 public static final int INTKEY_STROKE_CONTROL = 8; 253 public static final int INTVAL_STROKE_DEFAULT = 0; 254 public static final int INTVAL_STROKE_NORMALIZE = 1; 255 public static final int INTVAL_STROKE_PURE = 2; 256 257 /** 258 * LCD text contrast control hint key. 259 * Value is "100" to make discontiguous with the others which 260 * are all enumerative and are of a different class. 261 */ 262 public static final int INTKEY_AATEXT_LCD_CONTRAST = 100; 263 264 /** 265 * Rendering hint key and value objects 266 */ 267 public static final Key KEY_RENDERING = 268 new SunHints.Key(SunHints.INTKEY_RENDERING, 269 "Global rendering quality key"); 270 public static final Object VALUE_RENDER_SPEED = 271 new SunHints.Value(KEY_RENDERING, 272 SunHints.INTVAL_RENDER_SPEED, 273 "Fastest rendering methods"); 274 public static final Object VALUE_RENDER_QUALITY = 275 new SunHints.Value(KEY_RENDERING, 276 SunHints.INTVAL_RENDER_QUALITY, 277 "Highest quality rendering methods"); 278 public static final Object VALUE_RENDER_DEFAULT = 279 new SunHints.Value(KEY_RENDERING, 280 SunHints.INTVAL_RENDER_DEFAULT, 281 "Default rendering methods"); 282 | 1 /* 2 * Copyright (c) 1998, 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 23 * questions. 24 */ 25 26 package sun.awt; 27 28 import java.awt.RenderingHints; 29 import java.lang.annotation.Native; 30 31 /** 32 * This class contains rendering hints that can be used by the 33 * {@link java.awt.Graphics2D} class, and classes that implement 34 * {@link java.awt.image.BufferedImageOp} and 35 * {@link java.awt.image.Raster}. 36 */ 37 public class SunHints { 38 /** 39 * Defines the type of all keys used to control various 40 * aspects of the rendering and imaging pipelines. Instances 41 * of this class are immutable and unique which means that 42 * tests for matches can be made using the == operator instead 43 * of the more expensive equals() method. 44 */ 45 public static class Key extends RenderingHints.Key { 46 String description; 47 48 /** 49 * Construct a key using the indicated private key. Each 50 * subclass of Key maintains its own unique domain of integer 51 * keys. No two objects with the same integer key and of the 52 * same specific subclass can be constructed. An exception 53 * will be thrown if an attempt is made to construct another 54 * object of a given class with the same integer key as a 55 * pre-existing instance of that subclass of Key. 56 */ 161 */ 162 public final int hashCode() { 163 return System.identityHashCode(this); 164 } 165 166 /** 167 * The equals method for all SunHints.Value objects will return 168 * the same result as the equality operator '=='. 169 */ 170 public final boolean equals(Object o) { 171 return this == o; 172 } 173 } 174 175 private static final int NUM_KEYS = 9; 176 private static final int VALS_PER_KEY = 8; 177 178 /** 179 * Rendering hint key and values 180 */ 181 @Native public static final int INTKEY_RENDERING = 0; 182 @Native public static final int INTVAL_RENDER_DEFAULT = 0; 183 @Native public static final int INTVAL_RENDER_SPEED = 1; 184 @Native public static final int INTVAL_RENDER_QUALITY = 2; 185 186 /** 187 * Antialiasing hint key and values 188 */ 189 @Native public static final int INTKEY_ANTIALIASING = 1; 190 @Native public static final int INTVAL_ANTIALIAS_DEFAULT = 0; 191 @Native public static final int INTVAL_ANTIALIAS_OFF = 1; 192 @Native public static final int INTVAL_ANTIALIAS_ON = 2; 193 194 /** 195 * Text antialiasing hint key and values 196 */ 197 @Native public static final int INTKEY_TEXT_ANTIALIASING = 2; 198 @Native public static final int INTVAL_TEXT_ANTIALIAS_DEFAULT = 0; 199 @Native public static final int INTVAL_TEXT_ANTIALIAS_OFF = 1; 200 @Native public static final int INTVAL_TEXT_ANTIALIAS_ON = 2; 201 @Native public static final int INTVAL_TEXT_ANTIALIAS_GASP = 3; 202 @Native public static final int INTVAL_TEXT_ANTIALIAS_LCD_HRGB = 4; 203 @Native public static final int INTVAL_TEXT_ANTIALIAS_LCD_HBGR = 5; 204 @Native public static final int INTVAL_TEXT_ANTIALIAS_LCD_VRGB = 6; 205 @Native public static final int INTVAL_TEXT_ANTIALIAS_LCD_VBGR = 7; 206 207 /** 208 * Font fractional metrics hint key and values 209 */ 210 @Native public static final int INTKEY_FRACTIONALMETRICS = 3; 211 @Native public static final int INTVAL_FRACTIONALMETRICS_DEFAULT = 0; 212 @Native public static final int INTVAL_FRACTIONALMETRICS_OFF = 1; 213 @Native public static final int INTVAL_FRACTIONALMETRICS_ON = 2; 214 215 /** 216 * Dithering hint key and values 217 */ 218 @Native public static final int INTKEY_DITHERING = 4; 219 @Native public static final int INTVAL_DITHER_DEFAULT = 0; 220 @Native public static final int INTVAL_DITHER_DISABLE = 1; 221 @Native public static final int INTVAL_DITHER_ENABLE = 2; 222 223 /** 224 * Interpolation hint key and values 225 */ 226 @Native public static final int INTKEY_INTERPOLATION = 5; 227 @Native public static final int INTVAL_INTERPOLATION_NEAREST_NEIGHBOR = 0; 228 @Native public static final int INTVAL_INTERPOLATION_BILINEAR = 1; 229 @Native public static final int INTVAL_INTERPOLATION_BICUBIC = 2; 230 231 /** 232 * Alpha interpolation hint key and values 233 */ 234 @Native public static final int INTKEY_ALPHA_INTERPOLATION = 6; 235 @Native public static final int INTVAL_ALPHA_INTERPOLATION_DEFAULT = 0; 236 @Native public static final int INTVAL_ALPHA_INTERPOLATION_SPEED = 1; 237 @Native public static final int INTVAL_ALPHA_INTERPOLATION_QUALITY = 2; 238 239 /** 240 * Color rendering hint key and values 241 */ 242 @Native public static final int INTKEY_COLOR_RENDERING = 7; 243 @Native public static final int INTVAL_COLOR_RENDER_DEFAULT = 0; 244 @Native public static final int INTVAL_COLOR_RENDER_SPEED = 1; 245 @Native public static final int INTVAL_COLOR_RENDER_QUALITY = 2; 246 247 /** 248 * Stroke normalization control hint key and values 249 */ 250 @Native public static final int INTKEY_STROKE_CONTROL = 8; 251 @Native public static final int INTVAL_STROKE_DEFAULT = 0; 252 @Native public static final int INTVAL_STROKE_NORMALIZE = 1; 253 @Native public static final int INTVAL_STROKE_PURE = 2; 254 255 /** 256 * LCD text contrast control hint key. 257 * Value is "100" to make discontiguous with the others which 258 * are all enumerative and are of a different class. 259 */ 260 @Native public static final int INTKEY_AATEXT_LCD_CONTRAST = 100; 261 262 /** 263 * Rendering hint key and value objects 264 */ 265 public static final Key KEY_RENDERING = 266 new SunHints.Key(SunHints.INTKEY_RENDERING, 267 "Global rendering quality key"); 268 public static final Object VALUE_RENDER_SPEED = 269 new SunHints.Value(KEY_RENDERING, 270 SunHints.INTVAL_RENDER_SPEED, 271 "Fastest rendering methods"); 272 public static final Object VALUE_RENDER_QUALITY = 273 new SunHints.Value(KEY_RENDERING, 274 SunHints.INTVAL_RENDER_QUALITY, 275 "Highest quality rendering methods"); 276 public static final Object VALUE_RENDER_DEFAULT = 277 new SunHints.Value(KEY_RENDERING, 278 SunHints.INTVAL_RENDER_DEFAULT, 279 "Default rendering methods"); 280 |