1 7 8 package java.awt; 9 10 import java.awt.RenderingHints.Key; 11 import java.awt.geom.AffineTransform ; 12 import java.awt.image.ImageObserver ; 13 import java.awt.image.BufferedImageOp ; 14 import java.awt.image.BufferedImage ; 15 import java.awt.image.RenderedImage ; 16 import java.awt.image.renderable.RenderableImage ; 17 import java.awt.font.GlyphVector ; 18 import java.awt.font.FontRenderContext ; 19 import java.awt.font.TextAttribute ; 20 import java.text.AttributedCharacterIterator ; 21 import java.util.Map ; 22 23 390 public abstract class Graphics2D extends Graphics { 391 392 404 protected Graphics2D() { 405 } 406 407 428 public void draw3DRect(int x, int y, int width, int height, 429 boolean raised) { 430 Paint p = getPaint(); 431 Color c = getColor(); 432 Color brighter = c.brighter(); 433 Color darker = c.darker(); 434 435 setColor(raised ? brighter : darker); 436 fillRect(x, y, 1, height + 1); 438 fillRect(x + 1, y, width - 1, 1); 440 setColor(raised ? darker : brighter); 441 fillRect(x + 1, y + height, width, 1); 443 fillRect(x + width, y, 1, height); 445 setPaint(p); 446 } 447 448 465 public void fill3DRect(int x, int y, int width, int height, 466 boolean raised) { 467 Paint p = getPaint(); 468 Color c = getColor(); 469 Color brighter = c.brighter(); 470 Color darker = c.darker(); 471 472 if (!raised) { 473 setColor(darker); 474 } else if (p != c) { 475 setColor(c); 476 } 477 fillRect(x+1, y+1, width-2, height-2); 478 setColor(raised ? brighter : darker); 479 fillRect(x, y, 1, height); 481 fillRect(x + 1, y, width - 2, 1); 483 setColor(raised ? darker : brighter); 484 fillRect(x + 1, y + height - 1, width - 1, 1); 486 fillRect(x + width - 1, y, 1, height - 1); 488 setPaint(p); 489 } 490 491 507 public abstract void draw(Shape s); 508 509 535 public abstract boolean drawImage(Image img, 536 AffineTransform xform, 537 ImageObserver obs); 538 539 564 public abstract void drawImage(BufferedImage img, 565 BufferedImageOp op, 566 int x, 567 int y); 568 569 590 public abstract void drawRenderedImage(RenderedImage img, 591 AffineTransform xform); 592 593 624 public abstract void drawRenderableImage(RenderableImage img, 625 AffineTransform xform); 626 627 650 public abstract void drawString(String str, int x, int y); 651 652 677 public abstract void drawString(String s, float x, float y); 678 679 704 public abstract void drawString(AttributedCharacterIterator iterator, 705 int x, int y); 706 707 732 public abstract void drawString(AttributedCharacterIterator iterator, 733 float x, float y); 734 735 760 public abstract void drawGlyphVector(GlyphVector g, float x, float y); 761 762 776 public abstract void fill(Shape s); 777 778 807 public abstract boolean hit(Rectangle rect, 808 Shape s, 809 boolean onStroke); 810 811 816 public abstract GraphicsConfiguration getDeviceConfiguration(); 817 818 845 public abstract void setComposite(Composite comp); 846 847 860 public abstract void setPaint( Paint paint ); 861 862 869 public abstract void setStroke(Stroke s); 870 871 883 public abstract void setRenderingHint(Key hintKey, Object hintValue); 884 885 898 public abstract Object getRenderingHint(Key hintKey); 899 900 914 public abstract void setRenderingHints(Map <?,?> hints); 915 916 930 public abstract void addRenderingHints(Map <?,?> hints); 931 932 945 public abstract RenderingHints getRenderingHints(); 946 947 959 public abstract void translate(int x, int y); 960 961 977 public abstract void translate(double tx, double ty); 978 979 995 public abstract void rotate(double theta); 996 997 1016 public abstract void rotate(double theta, double x, double y); 1017 1018 1037 public abstract void scale(double sx, double sy); 1038 1039 1057 public abstract void shear(double shx, double shy); 1058 1059 1076 public abstract void transform(AffineTransform Tx); 1077 1078 1109 public abstract void setTransform(AffineTransform Tx); 1110 1111 1119 public abstract AffineTransform getTransform(); 1120 1121 1129 public abstract Paint getPaint(); 1130 1131 1138 public abstract Composite getComposite(); 1139 1140 1156 public abstract void setBackground(Color color); 1157 1158 1164 public abstract Color getBackground(); 1165 1166 1173 public abstract Stroke getStroke(); 1174 1175 1194 public abstract void clip(Shape s); 1195 1196 1217 1218 public abstract FontRenderContext getFontRenderContext(); 1219 1220} 1221 | Popular Tags |