Overview Package Class Use Source Tree Index Deprecated About
GNU Classpath (0.95)
Frames | No Frames

Source for java.awt.Graphics2D

 1:  /* Copyright (C) 2000, 2002, 2004, 2006, 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., 51 Franklin Street, Fifth Floor, Boston, MA
 18: 02110-1301 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: 
 38:  package java.awt;
 39: 
 40:  import java.awt.font.FontRenderContext;
 41:  import java.awt.font.GlyphVector;
 42:  import java.awt.geom.AffineTransform;
 43:  import java.awt.image.BufferedImage;
 44:  import java.awt.image.BufferedImageOp;
 45:  import java.awt.image.ImageObserver;
 46:  import java.awt.image.RenderedImage;
 47:  import java.awt.image.renderable.RenderableImage;
 48:  import java.awt.print.PageFormat;
 49:  import java.awt.print.Printable;
 50:  import java.text.AttributedCharacterIterator;
 51:  import java.util.Map;
 52: 
 53:  /**
 54:  * An abstract class defining a device independent two-dimensional vector 
 55:  * graphics API. Concrete subclasses implement this API for output of 
 56:  * vector graphics to:
 57:  * <p>
 58:  * <ul>
 59:  * <li>a {@link javax.swing.JComponent} - in the 
 60:  * {@link javax.swing.JComponent#paint(Graphics)} method, the incoming 
 61:  * {@link Graphics} should always be an instance of 
 62:  * <code>Graphics2D</code>;</li> 
 63:  * <li>a {@link BufferedImage} - see 
 64:  * {@link BufferedImage#createGraphics()};</li>
 65:  * <li>a {@link java.awt.print.PrinterJob} - in the 
 66:  * {@link Printable#print(Graphics, PageFormat, int)} method, the incoming
 67:  * {@link Graphics} should always be an instance of 
 68:  * <code>Graphics2D</code>.</li>
 69:  * </ul>
 70:  * <p>
 71:  * Third party libraries provide support for output to other formats via this 
 72:  * API, including encapsulated postscript (EPS), portable document format (PDF),
 73:  * and scalable vector graphics (SVG).
 74:  * 
 75:  * @author Rolf W. Rasmussen (rolfwr@ii.uib.no)
 76:  */
 77:  public abstract class Graphics2D extends Graphics
 78: {
 79: 
 80:  protected Graphics2D()
 81:  {
 82:  }
 83:  
 84:  public void draw3DRect(int x, int y, int width, int height,
 85:  boolean raised)
 86:  {
 87:  super.draw3DRect(x, y, width, height, raised);
 88:  }
 89:  
 90:  public void fill3DRect(int x, int y, int width, int height,
 91:  boolean raised)
 92:  {
 93:  super.fill3DRect(x, y, width, height, raised);
 94:  }
 95: 
 96:  /**
 97:  * Draws an outline around a shape using the current stroke and paint.
 98:  * 
 99:  * @param shape the shape (<code>null</code> not permitted).
 100:  * 
 101:  * @see #getStroke()
 102:  * @see #getPaint()
 103:  */
 104:  public abstract void draw(Shape shape);
 105: 
 106:  public abstract boolean drawImage(Image image, AffineTransform xform,
 107:  ImageObserver obs);
 108: 
 109:  public abstract void drawImage(BufferedImage image,
 110:  BufferedImageOp op,
 111:  int x,
 112:  int y);
 113: 
 114:  public abstract void drawRenderedImage(RenderedImage image,
 115:  AffineTransform xform);
 116: 
 117:  public abstract void drawRenderableImage(RenderableImage image,
 118:  AffineTransform xform);
 119: 
 120:  /**
 121:  * Draws a string at the specified location, using the current font.
 122:  * 
 123:  * @param text the string to draw.
 124:  * @param x the x-coordinate.
 125:  * @param y the y-coordinate.
 126:  * 
 127:  * @see Graphics#setFont(Font)
 128:  */
 129:  public abstract void drawString(String text, int x, int y);
 130: 
 131:  /**
 132:  * Draws a string at the specified location, using the current font.
 133:  * 
 134:  * @param text the string to draw.
 135:  * @param x the x-coordinate.
 136:  * @param y the y-coordinate.
 137:  * 
 138:  * @see Graphics#setFont(Font)
 139:  */
 140:  public abstract void drawString(String text, float x, float y);
 141:  
 142:  /**
 143:  * Draws an attributed string at the specified location.
 144:  * 
 145:  * @param iterator the source of the attributed text.
 146:  * @param x the x-coordinate.
 147:  * @param y the y-coordinate.
 148:  */
 149:  public abstract void drawString(AttributedCharacterIterator iterator,
 150:  int x, int y);
 151: 
 152:  /**
 153:  * Draws an attributed string at the specified location.
 154:  * 
 155:  * @param iterator the source of the attributed text.
 156:  * @param x the x-coordinate.
 157:  * @param y the y-coordinate.
 158:  */
 159:  public abstract void drawString(AttributedCharacterIterator iterator,
 160:  float x, float y);
 161: 
 162:  /**
 163:  * Fills the interior of the specified <code>shape</code> using the current
 164:  * paint.
 165:  * 
 166:  * @param shape the shape to fill (<code>null</code> not permitted).
 167:  * 
 168:  * @see #draw(Shape)
 169:  * @see #getPaint()
 170:  */
 171:  public abstract void fill(Shape shape);
 172:  
 173:  public abstract boolean hit(Rectangle rect, Shape text,
 174:  boolean onStroke);
 175: 
 176:  public abstract GraphicsConfiguration getDeviceConfiguration();
 177: 
 178:  /**
 179:  * Sets the current compositing rule.
 180:  * 
 181:  * @param comp the composite.
 182:  * 
 183:  * @see #getComposite()
 184:  */
 185:  public abstract void setComposite(Composite comp);
 186:  
 187:  /**
 188:  * Sets the paint to be used for subsequent drawing operations.
 189:  * 
 190:  * @param paint the paint (<code>null</code> not permitted).
 191:  * 
 192:  * @see #getPaint()
 193:  */
 194:  public abstract void setPaint(Paint paint);
 195: 
 196:  /**
 197:  * Sets the stroke to be used for subsequent drawing operations.
 198:  * 
 199:  * @param stroke the stroke (<code>null</code> not permitted).
 200:  * 
 201:  * @see #getStroke()
 202:  */
 203:  public abstract void setStroke(Stroke stroke);
 204: 
 205:  /**
 206:  * Adds or updates a hint in the current rendering hints table.
 207:  * 
 208:  * @param hintKey the hint key.
 209:  * @param hintValue the hint value.
 210:  */
 211:  public abstract void setRenderingHint(RenderingHints.Key hintKey,
 212:  Object hintValue);
 213: 
 214:  /**
 215:  * Returns the current value of a rendering hint.
 216:  * 
 217:  * @param hintKey the key for the hint.
 218:  * 
 219:  * @return The value for the specified hint.
 220:  */
 221:  public abstract Object getRenderingHint(RenderingHints.Key hintKey);
 222:  
 223:  /**
 224:  * Replaces the current rendering hints with the supplied hints.
 225:  * 
 226:  * @param hints the hints.
 227:  * 
 228:  * @see #addRenderingHints(Map)
 229:  */
 230:  public abstract void setRenderingHints(Map<?,?> hints);
 231: 
 232:  /**
 233:  * Adds/updates the rendering hint.
 234:  * 
 235:  * @param hints the hints to add or update.
 236:  */
 237:  public abstract void addRenderingHints(Map<?,?> hints);
 238: 
 239:  /**
 240:  * Returns the current rendering hints.
 241:  * 
 242:  * @return The current rendering hints.
 243:  */
 244:  public abstract RenderingHints getRenderingHints();
 245: 
 246:  public abstract void translate(int x, int y);
 247: 
 248:  public abstract void translate(double tx, double ty);
 249:  
 250:  public abstract void rotate(double theta);
 251: 
 252:  public abstract void rotate(double theta, double x, double y);
 253: 
 254:  public abstract void scale(double scaleX, double scaleY);
 255: 
 256:  public abstract void shear(double shearX, double shearY);
 257: 
 258:  /**
 259:  * Sets the current transform to a concatenation of <code>transform</code>
 260:  * and the existing transform.
 261:  * 
 262:  * @param transform the transform.
 263:  */
 264:  public abstract void transform(AffineTransform transform);
 265:  
 266:  /**
 267:  * Sets the current transform. If the caller specifies a <code>null</code>
 268:  * transform, this method should set the current transform to the 
 269:  * identity transform.
 270:  * 
 271:  * @param transform the transform (<code>null</code> permitted).
 272:  * 
 273:  * @see #getTransform()
 274:  */
 275:  public abstract void setTransform(AffineTransform transform);
 276: 
 277:  /**
 278:  * Returns the current transform.
 279:  * 
 280:  * @return The current transform.
 281:  * 
 282:  * @see #setTransform(AffineTransform)
 283:  */
 284:  public abstract AffineTransform getTransform();
 285: 
 286:  /**
 287:  * Returns the current paint.
 288:  * 
 289:  * @return The current paint.
 290:  * 
 291:  * @see #setPaint(Paint)
 292:  */
 293:  public abstract Paint getPaint();
 294: 
 295:  /**
 296:  * Returns the current compositing rule.
 297:  * 
 298:  * @return The current compositing rule.
 299:  * 
 300:  * @see #setComposite(Composite)
 301:  */
 302:  public abstract Composite getComposite();
 303: 
 304:  /**
 305:  * Sets the background color (used by the 
 306:  * {@link Graphics#clearRect(int, int, int, int)} method).
 307:  * 
 308:  * @param color the color.
 309:  * 
 310:  * @see #getBackground()
 311:  */
 312:  public abstract void setBackground(Color color);
 313: 
 314:  /**
 315:  * Returns the color used by the 
 316:  * {@link Graphics#clearRect(int, int, int, int)} method.
 317:  * 
 318:  * @return The background color.
 319:  * 
 320:  * @see #setBackground(Color)
 321:  */
 322:  public abstract Color getBackground();
 323: 
 324:  /**
 325:  * Returns the current stroke.
 326:  * 
 327:  * @return The current stroke.
 328:  * 
 329:  * @see #setStroke(Stroke)
 330:  */
 331:  public abstract Stroke getStroke(); 
 332: 
 333:  /**
 334:  * Sets the clip region to the intersection of the current clipping region 
 335:  * and <code>s</code>.
 336:  * 
 337:  * @param s the shape to intersect with the current clipping region.
 338:  * 
 339:  * @see Graphics#setClip(Shape)
 340:  */
 341:  public abstract void clip(Shape s);
 342: 
 343:  /**
 344:  * Returns the font render context.
 345:  * 
 346:  * @return The font render context.
 347:  */
 348:  public abstract FontRenderContext getFontRenderContext();
 349: 
 350:  /**
 351:  * Draws a glyph vector at the specified location.
 352:  * 
 353:  * @param g the glyph vector.
 354:  * @param x the x-coordinate.
 355:  * @param y the y-coordinate.
 356:  */
 357:  public abstract void drawGlyphVector(GlyphVector g, float x, float y);
 358: }
Overview Package Class Use Source Tree Index Deprecated About
GNU Classpath (0.95)

AltStyle によって変換されたページ (->オリジナル) /