280 mGraphics.setXORMode(c1);
281 }
282
283 /**
284 * Gets the current font.
285 * @return this graphics context's current font.
286 * @see java.awt.Font
287 * @see java.awt.Graphics#setFont
288 * @since 1.0
289 */
290 public Font getFont() {
291 return mGraphics.getFont();
292 }
293
294 /**
295 * Sets this graphics context's font to the specified font.
296 * All subsequent text operations using this graphics context
297 * use this font.
298 * @param font the font.
299 * @see java.awt.Graphics#getFont
300 * @see java.awt.Graphics#drawChars(java.lang.String, int, int)
301 * @see java.awt.Graphics#drawString(byte[], int, int, int, int)
302 * @see java.awt.Graphics#drawBytes(char[], int, int, int, int)
303 * @since 1.0
304 */
305 public void setFont(Font font) {
306 mGraphics.setFont(font);
307 }
308
309 /**
310 * Gets the font metrics for the specified font.
311 * @return the font metrics for the specified font.
312 * @param f the specified font
313 * @see java.awt.Graphics#getFont
314 * @see java.awt.FontMetrics
315 * @see java.awt.Graphics#getFontMetrics()
316 * @since 1.0
317 */
318 public FontMetrics getFontMetrics(Font f) {
319 return mGraphics.getFontMetrics(f);
320 }
321
322 /**
1328 * @param x,y The location in user space where the image should be drawn.
1329 * @see #transform
1330 * @see #setTransform
1331 * @see #setComposite
1332 * @see #clip
1333 * @see #setClip
1334 */
1335 public void drawImage(BufferedImage img,
1336 BufferedImageOp op,
1337 int x,
1338 int y) {
1339
1340 mGraphics.drawImage(img, op, x, y);
1341 }
1342
1343
1344 /**
1345 * Draws a string of text.
1346 * The rendering attributes applied include the clip, transform,
1347 * paint or color, font and composite attributes.
1348 * @param s The string to be drawn.
1349 * @param x,y The coordinates where the string should be drawn.
1350 * @see #setPaint
1351 * @see java.awt.Graphics#setColor
1352 * @see java.awt.Graphics#setFont
1353 * @see #transform
1354 * @see #setTransform
1355 * @see #setComposite
1356 * @see #clip
1357 * @see #setClip
1358 */
1359 public void drawString(String str,
1360 float x,
1361 float y) {
1362 mGraphics.drawString(str, x, y);
1363 }
1364
1365 /**
1366 * Draws a GlyphVector.
1367 * The rendering attributes applied include the clip, transform,
1368 * paint or color, and composite attributes. The GlyphVector specifies
1415 * @see #transform
1416 * @see #setTransform
1417 * @see #clip
1418 * @see #setClip
1419 */
1420 public boolean hit(Rectangle rect,
1421 Shape s,
1422 boolean onStroke) {
1423
1424 return mGraphics.hit(rect, s, onStroke);
1425 }
1426
1427 /**
1428 * Sets the Composite in the current graphics state. Composite is used
1429 * in all drawing methods such as drawImage, drawString, draw,
1430 * and fill. It specifies how new pixels are to be combined with
1431 * the existing pixels on the graphics device in the rendering process.
1432 * @param comp The Composite object to be used for drawing.
1433 * @see java.awt.Graphics#setXORMode
1434 * @see java.awt.Graphics#setPaintMode
1435 * @see AlphaComposite
1436 */
1437 public void setComposite(Composite comp) {
1438 mGraphics.setComposite(comp);
1439 }
1440
1441
1442 /**
1443 * Sets the Paint in the current graphics state.
1444 * @param paint The Paint object to be used to generate color in
1445 * the rendering process.
1446 * @see java.awt.Graphics#setColor
1447 * @see GradientPaint
1448 * @see TexturePaint
1449 */
1450 public void setPaint(Paint paint) {
1451 mGraphics.setPaint(paint);
1452 }
1453
1454 /**
1455 * Sets the Stroke in the current graphics state.
1456 * @param s The Stroke object to be used to stroke a Shape in
1457 * the rendering process.
1458 * @see BasicStroke
1459 */
1460 public void setStroke(Stroke s) {
1461 mGraphics.setStroke(s);
1462 }
1463
1464 /**
1465 * Sets the preferences for the rendering algorithms.
1466 * Hint categories include controls for rendering quality and
1467 * overall time/quality trade-off in the rendering process.
1468 * @param hintCategory The category of hint to be set.
1469 * @param hintValue The value indicating preferences for the specified
1470 * hint category.
1471 * @see RenderingHints
1472 */
1473 public void setRenderingHint(Key hintCategory, Object hintValue) {
1474 mGraphics.setRenderingHint(hintCategory, hintValue);
1475 }
1476
1477 /**
1478 * Returns the preferences for the rendering algorithms.
1479 * @param hintCategory The category of hint to be set.
1480 * @return The preferences for rendering algorithms.
1481 * @see RenderingHings
1482 */
1483 public Object getRenderingHint(Key hintCategory) {
1484 return mGraphics.getRenderingHint(hintCategory);
1485 }
1486
1487 /**
1488 * Sets the preferences for the rendering algorithms.
1489 * Hint categories include controls for rendering quality and
1490 * overall time/quality trade-off in the rendering process.
1491 * @param hints The rendering hints to be set
1492 * @see RenderingHints
1493 */
1494 public void setRenderingHints(Map<?,?> hints) {
1495 mGraphics.setRenderingHints(hints);
1496 }
1497
1498 /**
1499 * Adds a number of preferences for the rendering algorithms.
1500 * Hint categories include controls for rendering quality and
1501 * overall time/quality trade-off in the rendering process.
1514 */
1515 public RenderingHints getRenderingHints() {
1516 return mGraphics.getRenderingHints();
1517 }
1518
1519 /**
1520 * Composes a Transform object with the transform in this
1521 * Graphics2D according to the rule last-specified-first-applied.
1522 * If the currrent transform is Cx, the result of composition
1523 * with Tx is a new transform Cx'. Cx' becomes the current
1524 * transform for this Graphics2D.
1525 * Transforming a point p by the updated transform Cx' is
1526 * equivalent to first transforming p by Tx and then transforming
1527 * the result by the original transform Cx. In other words,
1528 * Cx'(p) = Cx(Tx(p)).
1529 * A copy of the Tx is made, if necessary, so further
1530 * modifications to Tx do not affect rendering.
1531 * @param Tx The Transform object to be composed with the current
1532 * transform.
1533 * @see #setTransform
1534 * @see TransformChain
1535 * @see AffineTransform
1536 */
1537 public void transform(AffineTransform Tx) {
1538 mGraphics.transform(Tx);
1539 }
1540
1541 /**
1542 * Sets the Transform in the current graphics state.
1543 * @param Tx The Transform object to be used in the rendering process.
1544 * @see #transform
1545 * @see TransformChain
1546 * @see AffineTransform
1547 */
1548 public void setTransform(AffineTransform Tx) {
1549 mGraphics.setTransform(Tx);
1550 }
1551
1552 /**
1553 * Returns the current Transform in the Graphics2D state.
1554 * @see #transform
1555 * @see #setTransform
1556 */
1557 public AffineTransform getTransform() {
1558 return mGraphics.getTransform();
1559 }
1560
1561 /**
1562 * Returns the current Paint in the Graphics2D state.
1563 * @see #setPaint
1564 * @see java.awt.Graphics#setColor
1565 */
1567 return mGraphics.getPaint();
1568 }
1569
1570 /**
1571 * Returns the current Composite in the Graphics2D state.
1572 * @see #setComposite
1573 */
1574 public Composite getComposite() {
1575 return mGraphics.getComposite();
1576 }
1577
1578 /**
1579 * Sets the background color in this context used for clearing a region.
1580 * When Graphics2D is constructed for a component, the backgroung color is
1581 * inherited from the component. Setting the background color in the
1582 * Graphics2D context only affects the subsequent clearRect() calls and
1583 * not the background color of the component. To change the background
1584 * of the component, use appropriate methods of the component.
1585 * @param color The background color that should be used in
1586 * subsequent calls to clearRect().
1587 * @see getBackground
1588 * @see Graphics.clearRect()
1589 */
1590 public void setBackground(Color color) {
1591 mGraphics.setBackground(color);
1592 }
1593
1594 /**
1595 * Returns the background color used for clearing a region.
1596 * @see setBackground
1597 */
1598 public Color getBackground() {
1599 return mGraphics.getBackground();
1600 }
1601
1602 /**
1603 * Returns the current Stroke in the Graphics2D state.
1604 * @see setStroke
1605 */
1606 public Stroke getStroke() {
1607 return mGraphics.getStroke();
1608 }
1609
1610 /**
1611 * Intersects the current clip with the interior of the specified Shape
1612 * and sets the current clip to the resulting intersection.
1613 * The indicated shape is transformed with the current transform in the
1614 * Graphics2D state before being intersected with the current clip.
1615 * This method is used to make the current clip smaller.
1616 * To make the clip larger, use any setClip method.
1617 * @param s The Shape to be intersected with the current clip.
1618 */
1619 public void clip(Shape s) {
1620 mGraphics.clip(s);
1621 }
1622 }
|
280 mGraphics.setXORMode(c1);
281 }
282
283 /**
284 * Gets the current font.
285 * @return this graphics context's current font.
286 * @see java.awt.Font
287 * @see java.awt.Graphics#setFont
288 * @since 1.0
289 */
290 public Font getFont() {
291 return mGraphics.getFont();
292 }
293
294 /**
295 * Sets this graphics context's font to the specified font.
296 * All subsequent text operations using this graphics context
297 * use this font.
298 * @param font the font.
299 * @see java.awt.Graphics#getFont
300 * @see java.awt.Graphics#drawChars(char[], int, int, int, int)
301 * @see java.awt.Graphics#drawString(String, int, int)
302 * @see java.awt.Graphics#drawBytes(byte[], int, int, int, int)
303 * @since 1.0
304 */
305 public void setFont(Font font) {
306 mGraphics.setFont(font);
307 }
308
309 /**
310 * Gets the font metrics for the specified font.
311 * @return the font metrics for the specified font.
312 * @param f the specified font
313 * @see java.awt.Graphics#getFont
314 * @see java.awt.FontMetrics
315 * @see java.awt.Graphics#getFontMetrics()
316 * @since 1.0
317 */
318 public FontMetrics getFontMetrics(Font f) {
319 return mGraphics.getFontMetrics(f);
320 }
321
322 /**
1328 * @param x,y The location in user space where the image should be drawn.
1329 * @see #transform
1330 * @see #setTransform
1331 * @see #setComposite
1332 * @see #clip
1333 * @see #setClip
1334 */
1335 public void drawImage(BufferedImage img,
1336 BufferedImageOp op,
1337 int x,
1338 int y) {
1339
1340 mGraphics.drawImage(img, op, x, y);
1341 }
1342
1343
1344 /**
1345 * Draws a string of text.
1346 * The rendering attributes applied include the clip, transform,
1347 * paint or color, font and composite attributes.
1348 * @param str The string to be drawn.
1349 * @param x,y The coordinates where the string should be drawn.
1350 * @see #setPaint
1351 * @see java.awt.Graphics#setColor
1352 * @see java.awt.Graphics#setFont
1353 * @see #transform
1354 * @see #setTransform
1355 * @see #setComposite
1356 * @see #clip
1357 * @see #setClip
1358 */
1359 public void drawString(String str,
1360 float x,
1361 float y) {
1362 mGraphics.drawString(str, x, y);
1363 }
1364
1365 /**
1366 * Draws a GlyphVector.
1367 * The rendering attributes applied include the clip, transform,
1368 * paint or color, and composite attributes. The GlyphVector specifies
1415 * @see #transform
1416 * @see #setTransform
1417 * @see #clip
1418 * @see #setClip
1419 */
1420 public boolean hit(Rectangle rect,
1421 Shape s,
1422 boolean onStroke) {
1423
1424 return mGraphics.hit(rect, s, onStroke);
1425 }
1426
1427 /**
1428 * Sets the Composite in the current graphics state. Composite is used
1429 * in all drawing methods such as drawImage, drawString, draw,
1430 * and fill. It specifies how new pixels are to be combined with
1431 * the existing pixels on the graphics device in the rendering process.
1432 * @param comp The Composite object to be used for drawing.
1433 * @see java.awt.Graphics#setXORMode
1434 * @see java.awt.Graphics#setPaintMode
1435 * @see java.awt.AlphaComposite
1436 */
1437 public void setComposite(Composite comp) {
1438 mGraphics.setComposite(comp);
1439 }
1440
1441
1442 /**
1443 * Sets the Paint in the current graphics state.
1444 * @param paint The Paint object to be used to generate color in
1445 * the rendering process.
1446 * @see java.awt.Graphics#setColor
1447 * @see java.awt.GradientPaint
1448 * @see java.awt.TexturePaint
1449 */
1450 public void setPaint(Paint paint) {
1451 mGraphics.setPaint(paint);
1452 }
1453
1454 /**
1455 * Sets the Stroke in the current graphics state.
1456 * @param s The Stroke object to be used to stroke a Shape in
1457 * the rendering process.
1458 * @see java.awt.BasicStroke
1459 */
1460 public void setStroke(Stroke s) {
1461 mGraphics.setStroke(s);
1462 }
1463
1464 /**
1465 * Sets the preferences for the rendering algorithms.
1466 * Hint categories include controls for rendering quality and
1467 * overall time/quality trade-off in the rendering process.
1468 * @param hintCategory The category of hint to be set.
1469 * @param hintValue The value indicating preferences for the specified
1470 * hint category.
1471 * @see RenderingHints
1472 */
1473 public void setRenderingHint(Key hintCategory, Object hintValue) {
1474 mGraphics.setRenderingHint(hintCategory, hintValue);
1475 }
1476
1477 /**
1478 * Returns the preferences for the rendering algorithms.
1479 * @param hintCategory The category of hint to be set.
1480 * @return The preferences for rendering algorithms.
1481 * @see RenderingHints
1482 */
1483 public Object getRenderingHint(Key hintCategory) {
1484 return mGraphics.getRenderingHint(hintCategory);
1485 }
1486
1487 /**
1488 * Sets the preferences for the rendering algorithms.
1489 * Hint categories include controls for rendering quality and
1490 * overall time/quality trade-off in the rendering process.
1491 * @param hints The rendering hints to be set
1492 * @see RenderingHints
1493 */
1494 public void setRenderingHints(Map<?,?> hints) {
1495 mGraphics.setRenderingHints(hints);
1496 }
1497
1498 /**
1499 * Adds a number of preferences for the rendering algorithms.
1500 * Hint categories include controls for rendering quality and
1501 * overall time/quality trade-off in the rendering process.
1514 */
1515 public RenderingHints getRenderingHints() {
1516 return mGraphics.getRenderingHints();
1517 }
1518
1519 /**
1520 * Composes a Transform object with the transform in this
1521 * Graphics2D according to the rule last-specified-first-applied.
1522 * If the currrent transform is Cx, the result of composition
1523 * with Tx is a new transform Cx'. Cx' becomes the current
1524 * transform for this Graphics2D.
1525 * Transforming a point p by the updated transform Cx' is
1526 * equivalent to first transforming p by Tx and then transforming
1527 * the result by the original transform Cx. In other words,
1528 * Cx'(p) = Cx(Tx(p)).
1529 * A copy of the Tx is made, if necessary, so further
1530 * modifications to Tx do not affect rendering.
1531 * @param Tx The Transform object to be composed with the current
1532 * transform.
1533 * @see #setTransform
1534 * @see AffineTransform
1535 */
1536 public void transform(AffineTransform Tx) {
1537 mGraphics.transform(Tx);
1538 }
1539
1540 /**
1541 * Sets the Transform in the current graphics state.
1542 * @param Tx The Transform object to be used in the rendering process.
1543 * @see #transform
1544 * @see AffineTransform
1545 */
1546 public void setTransform(AffineTransform Tx) {
1547 mGraphics.setTransform(Tx);
1548 }
1549
1550 /**
1551 * Returns the current Transform in the Graphics2D state.
1552 * @see #transform
1553 * @see #setTransform
1554 */
1555 public AffineTransform getTransform() {
1556 return mGraphics.getTransform();
1557 }
1558
1559 /**
1560 * Returns the current Paint in the Graphics2D state.
1561 * @see #setPaint
1562 * @see java.awt.Graphics#setColor
1563 */
1565 return mGraphics.getPaint();
1566 }
1567
1568 /**
1569 * Returns the current Composite in the Graphics2D state.
1570 * @see #setComposite
1571 */
1572 public Composite getComposite() {
1573 return mGraphics.getComposite();
1574 }
1575
1576 /**
1577 * Sets the background color in this context used for clearing a region.
1578 * When Graphics2D is constructed for a component, the backgroung color is
1579 * inherited from the component. Setting the background color in the
1580 * Graphics2D context only affects the subsequent clearRect() calls and
1581 * not the background color of the component. To change the background
1582 * of the component, use appropriate methods of the component.
1583 * @param color The background color that should be used in
1584 * subsequent calls to clearRect().
1585 * @see #getBackground
1586 * @see Graphics#clearRect
1587 */
1588 public void setBackground(Color color) {
1589 mGraphics.setBackground(color);
1590 }
1591
1592 /**
1593 * Returns the background color used for clearing a region.
1594 * @see #setBackground
1595 */
1596 public Color getBackground() {
1597 return mGraphics.getBackground();
1598 }
1599
1600 /**
1601 * Returns the current Stroke in the Graphics2D state.
1602 * @see #setStroke
1603 */
1604 public Stroke getStroke() {
1605 return mGraphics.getStroke();
1606 }
1607
1608 /**
1609 * Intersects the current clip with the interior of the specified Shape
1610 * and sets the current clip to the resulting intersection.
1611 * The indicated shape is transformed with the current transform in the
1612 * Graphics2D state before being intersected with the current clip.
1613 * This method is used to make the current clip smaller.
1614 * To make the clip larger, use any setClip method.
1615 * @param s The Shape to be intersected with the current clip.
1616 */
1617 public void clip(Shape s) {
1618 mGraphics.clip(s);
1619 }
1620 }
|