315 width, height,
316 arcWidth, arcHeight));
317 }
318
319 /**
320 * Draws the outline of an oval.
321 * The result is a circle or ellipse that fits within the
322 * rectangle specified by the <code>x</code>, <code>y</code>,
323 * <code>width</code>, and <code>height</code> arguments.
324 * <p>
325 * The oval covers an area that is
326 * <code>width + 1</code> pixels wide
327 * and <code>height + 1</code> pixels tall.
328 * @param x the <i>x</i> coordinate of the upper left
329 * corner of the oval to be drawn.
330 * @param y the <i>y</i> coordinate of the upper left
331 * corner of the oval to be drawn.
332 * @param width the width of the oval to be drawn.
333 * @param height the height of the oval to be drawn.
334 * @see java.awt.Graphics#fillOval
335 * @since JDK1.0
336 */
337 public void drawOval(int x, int y, int width, int height) {
338 draw(new Ellipse2D.Float(x, y, width, height));
339 }
340
341 /**
342 * Fills an oval bounded by the specified rectangle with the
343 * current color.
344 * @param x the <i>x</i> coordinate of the upper left corner
345 * of the oval to be filled.
346 * @param y the <i>y</i> coordinate of the upper left corner
347 * of the oval to be filled.
348 * @param width the width of the oval to be filled.
349 * @param height the height of the oval to be filled.
350 * @see java.awt.Graphics#drawOval
351 */
352 public void fillOval(int x, int y, int width, int height){
353
354 fill(new Ellipse2D.Float(x, y, width, height));
355 }
436 * @see java.awt.Graphics#drawArc
437 */
438 public void fillArc(int x, int y, int width, int height,
439 int startAngle, int arcAngle) {
440
441 fill(new Arc2D.Float(x, y, width, height,
442 startAngle, arcAngle,
443 Arc2D.PIE));
444 }
445
446 /**
447 * Draws a sequence of connected lines defined by
448 * arrays of <i>x</i> and <i>y</i> coordinates.
449 * Each pair of (<i>x</i>, <i>y</i>) coordinates defines a point.
450 * The figure is not closed if the first point
451 * differs from the last point.
452 * @param xPoints an array of <i>x</i> points
453 * @param yPoints an array of <i>y</i> points
454 * @param nPoints the total number of points
455 * @see java.awt.Graphics#drawPolygon(int[], int[], int)
456 * @since JDK1.1
457 */
458 public void drawPolyline(int xPoints[], int yPoints[],
459 int nPoints) {
460 float fromX;
461 float fromY;
462 float toX;
463 float toY;
464
465 if (nPoints > 0) {
466 fromX = xPoints[0];
467 fromY = yPoints[0];
468 for(int i = 1; i < nPoints; i++) {
469 toX = xPoints[i];
470 toY = yPoints[i];
471 draw(new Line2D.Float(fromX, fromY, toX, toY));
472 fromX = toX;
473 fromY = toY;
474 }
475 }
476
547 * The area inside the polygon is defined using an
548 * even-odd fill rule, also known as the alternating rule.
549 * @param p the polygon to fill.
550 * @see java.awt.Graphics#drawPolygon(int[], int[], int)
551 */
552 public void fillPolygon(Polygon p) {
553
554 fill(p);
555 }
556
557 /**
558 * Draws the text given by the specified string, using this
559 * graphics context's current font and color. The baseline of the
560 * first character is at position (<i>x</i>, <i>y</i>) in this
561 * graphics context's coordinate system.
562 * @param str the string to be drawn.
563 * @param x the <i>x</i> coordinate.
564 * @param y the <i>y</i> coordinate.
565 * @see java.awt.Graphics#drawBytes
566 * @see java.awt.Graphics#drawChars
567 * @since JDK1.0
568 */
569 public void drawString(String str, int x, int y) {
570 drawString(str, (float) x, (float) y);
571 }
572
573 public void drawString(String str, float x, float y) {
574 if (str.length() == 0) {
575 return;
576 }
577 TextLayout layout =
578 new TextLayout(str, getFont(), getFontRenderContext());
579 layout.draw(this, x, y);
580 }
581
582 protected void drawString(String str, float x, float y,
583 Font font, FontRenderContext frc, float w) {
584 TextLayout layout =
585 new TextLayout(str, font, frc);
586 Shape textShape =
587 layout.getOutline(AffineTransform.getTranslateInstance(x, y));
1371 * (<i>x</i>, <i>y</i>) in this graphics context's coordinate
1372 * space. Transparent pixels in the image do not affect whatever
1373 * pixels are already there.
1374 * <p>
1375 * This method returns immediately in all cases, even if the
1376 * complete image has not yet been loaded, and it has not been dithered
1377 * and converted for the current output device.
1378 * <p>
1379 * If the image has not yet been completely loaded, then
1380 * <code>drawImage</code> returns <code>false</code>. As more of
1381 * the image becomes available, the process that draws the image notifies
1382 * the specified image observer.
1383 * @param img the specified image to be drawn.
1384 * @param x the <i>x</i> coordinate.
1385 * @param y the <i>y</i> coordinate.
1386 * @param observer object to be notified as more of
1387 * the image is converted.
1388 * @see java.awt.Image
1389 * @see java.awt.image.ImageObserver
1390 * @see java.awt.image.ImageObserver#imageUpdate(java.awt.Image, int, int, int, int, int)
1391 * @since JDK1.0
1392 */
1393 public boolean drawImage(Image img, int x, int y,
1394 ImageObserver observer) {
1395
1396 return drawImage(img, x, y, null, observer);
1397 }
1398
1399 /**
1400 * Draws as much of the specified image as has already been scaled
1401 * to fit inside the specified rectangle.
1402 * <p>
1403 * The image is drawn inside the specified rectangle of this
1404 * graphics context's coordinate space, and is scaled if
1405 * necessary. Transparent pixels do not affect whatever pixels
1406 * are already there.
1407 * <p>
1408 * This method returns immediately in all cases, even if the
1409 * entire image has not yet been scaled, dithered, and converted
1410 * for the current output device.
1411 * If the current output representation is not yet complete, then
1412 * <code>drawImage</code> returns <code>false</code>. As more of
1413 * the image becomes available, the process that draws the image notifies
1414 * the image observer by calling its <code>imageUpdate</code> method.
1415 * <p>
1416 * A scaled version of an image will not necessarily be
1417 * available immediately just because an unscaled version of the
1418 * image has been constructed for this output device. Each size of
1419 * the image may be cached separately and generated from the original
1420 * data in a separate image production sequence.
1421 * @param img the specified image to be drawn.
1422 * @param x the <i>x</i> coordinate.
1423 * @param y the <i>y</i> coordinate.
1424 * @param width the width of the rectangle.
1425 * @param height the height of the rectangle.
1426 * @param observer object to be notified as more of
1427 * the image is converted.
1428 * @see java.awt.Image
1429 * @see java.awt.image.ImageObserver
1430 * @see java.awt.image.ImageObserver#imageUpdate(java.awt.Image, int, int, int, int, int)
1431 * @since JDK1.0
1432 */
1433 public boolean drawImage(Image img, int x, int y,
1434 int width, int height,
1435 ImageObserver observer) {
1436
1437 return drawImage(img, x, y, width, height, null, observer);
1438
1439 }
1440
1441 /*
1442 * Draws as much of the specified image as is currently available.
1443 * The image is drawn with its top-left corner at
1444 * (<i>x</i>, <i>y</i>) in this graphics context's coordinate
1445 * space. Transparent pixels are drawn in the specified
1446 * background color.
1447 * <p>
1448 * This operation is equivalent to filling a rectangle of the
1449 * width and height of the specified image with the given color and then
1450 * drawing the image on top of it, but possibly more efficient.
1451 * <p>
1455 * <p>
1456 * If the image has not yet been completely loaded, then
1457 * <code>drawImage</code> returns <code>false</code>. As more of
1458 * the image becomes available, the process that draws the image notifies
1459 * the specified image observer.
1460 * @param img the specified image to be drawn.
1461 * This method does nothing if <code>img</code> is null.
1462 * @param x the <i>x</i> coordinate.
1463 * @param y the <i>y</i> coordinate.
1464 * @param bgcolor the background color to paint under the
1465 * non-opaque portions of the image.
1466 * In this WPathGraphics implementation,
1467 * this parameter can be null in which
1468 * case that background is made a transparent
1469 * white.
1470 * @param observer object to be notified as more of
1471 * the image is converted.
1472 * @see java.awt.Image
1473 * @see java.awt.image.ImageObserver
1474 * @see java.awt.image.ImageObserver#imageUpdate(java.awt.Image, int, int, int, int, int)
1475 * @since JDK1.0
1476 */
1477 public boolean drawImage(Image img, int x, int y,
1478 Color bgcolor,
1479 ImageObserver observer) {
1480
1481 if (img == null) {
1482 return true;
1483 }
1484
1485 boolean result;
1486 int srcWidth = img.getWidth(null);
1487 int srcHeight = img.getHeight(null);
1488
1489 if (srcWidth < 0 || srcHeight < 0) {
1490 result = false;
1491 } else {
1492 result = drawImage(img, x, y, srcWidth, srcHeight, bgcolor, observer);
1493 }
1494
1495 return result;
1516 * the specified image observer.
1517 * <p>
1518 * A scaled version of an image will not necessarily be
1519 * available immediately just because an unscaled version of the
1520 * image has been constructed for this output device. Each size of
1521 * the image may be cached separately and generated from the original
1522 * data in a separate image production sequence.
1523 * @param img the specified image to be drawn.
1524 * This method does nothing if <code>img</code> is null.
1525 * @param x the <i>x</i> coordinate.
1526 * @param y the <i>y</i> coordinate.
1527 * @param width the width of the rectangle.
1528 * @param height the height of the rectangle.
1529 * @param bgcolor the background color to paint under the
1530 * non-opaque portions of the image.
1531 * @param observer object to be notified as more of
1532 * the image is converted.
1533 * @see java.awt.Image
1534 * @see java.awt.image.ImageObserver
1535 * @see java.awt.image.ImageObserver#imageUpdate(java.awt.Image, int, int, int, int, int)
1536 * @since JDK1.0
1537 */
1538 public boolean drawImage(Image img, int x, int y,
1539 int width, int height,
1540 Color bgcolor,
1541 ImageObserver observer) {
1542
1543 if (img == null) {
1544 return true;
1545 }
1546
1547 boolean result;
1548 int srcWidth = img.getWidth(null);
1549 int srcHeight = img.getHeight(null);
1550
1551 if (srcWidth < 0 || srcHeight < 0) {
1552 result = false;
1553 } else {
1554 result = drawImage(img,
1555 x, y, x + width, y + height,
1556 0, 0, srcWidth, srcHeight,
1588 * destination rectangle.
1589 * @param dy1 the <i>y</i> coordinate of the first corner of the
1590 * destination rectangle.
1591 * @param dx2 the <i>x</i> coordinate of the second corner of the
1592 * destination rectangle.
1593 * @param dy2 the <i>y</i> coordinate of the second corner of the
1594 * destination rectangle.
1595 * @param sx1 the <i>x</i> coordinate of the first corner of the
1596 * source rectangle.
1597 * @param sy1 the <i>y</i> coordinate of the first corner of the
1598 * source rectangle.
1599 * @param sx2 the <i>x</i> coordinate of the second corner of the
1600 * source rectangle.
1601 * @param sy2 the <i>y</i> coordinate of the second corner of the
1602 * source rectangle.
1603 * @param observer object to be notified as more of the image is
1604 * scaled and converted.
1605 * @see java.awt.Image
1606 * @see java.awt.image.ImageObserver
1607 * @see java.awt.image.ImageObserver#imageUpdate(java.awt.Image, int, int, int, int, int)
1608 * @since JDK1.1
1609 */
1610 public boolean drawImage(Image img,
1611 int dx1, int dy1, int dx2, int dy2,
1612 int sx1, int sy1, int sx2, int sy2,
1613 ImageObserver observer) {
1614
1615 return drawImage(img,
1616 dx1, dy1, dx2, dy2,
1617 sx1, sy1, sx2, sy2,
1618 null, observer);
1619 }
1620
1621 /**
1622 * Draws as much of the specified area of the specified image as is
1623 * currently available, scaling it on the fly to fit inside the
1624 * specified area of the destination drawable surface.
1625 * <p>
1626 * Transparent pixels are drawn in the specified background color.
1627 * This operation is equivalent to filling a rectangle of the
1628 * width and height of the specified image with the given color and then
1653 * destination rectangle.
1654 * @param dx2 the <i>x</i> coordinate of the second corner of the
1655 * destination rectangle.
1656 * @param dy2 the <i>y</i> coordinate of the second corner of the
1657 * destination rectangle.
1658 * @param sx1 the <i>x</i> coordinate of the first corner of the
1659 * source rectangle.
1660 * @param sy1 the <i>y</i> coordinate of the first corner of the
1661 * source rectangle.
1662 * @param sx2 the <i>x</i> coordinate of the second corner of the
1663 * source rectangle.
1664 * @param sy2 the <i>y</i> coordinate of the second corner of the
1665 * source rectangle.
1666 * @param bgcolor the background color to paint under the
1667 * non-opaque portions of the image.
1668 * @param observer object to be notified as more of the image is
1669 * scaled and converted.
1670 * @see java.awt.Image
1671 * @see java.awt.image.ImageObserver
1672 * @see java.awt.image.ImageObserver#imageUpdate(java.awt.Image, int, int, int, int, int)
1673 * @since JDK1.1
1674 */
1675 public boolean drawImage(Image img,
1676 int dx1, int dy1, int dx2, int dy2,
1677 int sx1, int sy1, int sx2, int sy2,
1678 Color bgcolor,
1679 ImageObserver observer) {
1680
1681 if (img == null) {
1682 return true;
1683 }
1684 int imgWidth = img.getWidth(null);
1685 int imgHeight = img.getHeight(null);
1686
1687 if (imgWidth < 0 || imgHeight < 0) {
1688 return true;
1689 }
1690
1691 int srcWidth = sx2 - sx1;
1692 int srcHeight = sy2 - sy1;
1693
|
315 width, height,
316 arcWidth, arcHeight));
317 }
318
319 /**
320 * Draws the outline of an oval.
321 * The result is a circle or ellipse that fits within the
322 * rectangle specified by the <code>x</code>, <code>y</code>,
323 * <code>width</code>, and <code>height</code> arguments.
324 * <p>
325 * The oval covers an area that is
326 * <code>width + 1</code> pixels wide
327 * and <code>height + 1</code> pixels tall.
328 * @param x the <i>x</i> coordinate of the upper left
329 * corner of the oval to be drawn.
330 * @param y the <i>y</i> coordinate of the upper left
331 * corner of the oval to be drawn.
332 * @param width the width of the oval to be drawn.
333 * @param height the height of the oval to be drawn.
334 * @see java.awt.Graphics#fillOval
335 * @since 1.0
336 */
337 public void drawOval(int x, int y, int width, int height) {
338 draw(new Ellipse2D.Float(x, y, width, height));
339 }
340
341 /**
342 * Fills an oval bounded by the specified rectangle with the
343 * current color.
344 * @param x the <i>x</i> coordinate of the upper left corner
345 * of the oval to be filled.
346 * @param y the <i>y</i> coordinate of the upper left corner
347 * of the oval to be filled.
348 * @param width the width of the oval to be filled.
349 * @param height the height of the oval to be filled.
350 * @see java.awt.Graphics#drawOval
351 */
352 public void fillOval(int x, int y, int width, int height){
353
354 fill(new Ellipse2D.Float(x, y, width, height));
355 }
436 * @see java.awt.Graphics#drawArc
437 */
438 public void fillArc(int x, int y, int width, int height,
439 int startAngle, int arcAngle) {
440
441 fill(new Arc2D.Float(x, y, width, height,
442 startAngle, arcAngle,
443 Arc2D.PIE));
444 }
445
446 /**
447 * Draws a sequence of connected lines defined by
448 * arrays of <i>x</i> and <i>y</i> coordinates.
449 * Each pair of (<i>x</i>, <i>y</i>) coordinates defines a point.
450 * The figure is not closed if the first point
451 * differs from the last point.
452 * @param xPoints an array of <i>x</i> points
453 * @param yPoints an array of <i>y</i> points
454 * @param nPoints the total number of points
455 * @see java.awt.Graphics#drawPolygon(int[], int[], int)
456 * @since 1.1
457 */
458 public void drawPolyline(int xPoints[], int yPoints[],
459 int nPoints) {
460 float fromX;
461 float fromY;
462 float toX;
463 float toY;
464
465 if (nPoints > 0) {
466 fromX = xPoints[0];
467 fromY = yPoints[0];
468 for(int i = 1; i < nPoints; i++) {
469 toX = xPoints[i];
470 toY = yPoints[i];
471 draw(new Line2D.Float(fromX, fromY, toX, toY));
472 fromX = toX;
473 fromY = toY;
474 }
475 }
476
547 * The area inside the polygon is defined using an
548 * even-odd fill rule, also known as the alternating rule.
549 * @param p the polygon to fill.
550 * @see java.awt.Graphics#drawPolygon(int[], int[], int)
551 */
552 public void fillPolygon(Polygon p) {
553
554 fill(p);
555 }
556
557 /**
558 * Draws the text given by the specified string, using this
559 * graphics context's current font and color. The baseline of the
560 * first character is at position (<i>x</i>, <i>y</i>) in this
561 * graphics context's coordinate system.
562 * @param str the string to be drawn.
563 * @param x the <i>x</i> coordinate.
564 * @param y the <i>y</i> coordinate.
565 * @see java.awt.Graphics#drawBytes
566 * @see java.awt.Graphics#drawChars
567 * @since 1.0
568 */
569 public void drawString(String str, int x, int y) {
570 drawString(str, (float) x, (float) y);
571 }
572
573 public void drawString(String str, float x, float y) {
574 if (str.length() == 0) {
575 return;
576 }
577 TextLayout layout =
578 new TextLayout(str, getFont(), getFontRenderContext());
579 layout.draw(this, x, y);
580 }
581
582 protected void drawString(String str, float x, float y,
583 Font font, FontRenderContext frc, float w) {
584 TextLayout layout =
585 new TextLayout(str, font, frc);
586 Shape textShape =
587 layout.getOutline(AffineTransform.getTranslateInstance(x, y));
1371 * (<i>x</i>, <i>y</i>) in this graphics context's coordinate
1372 * space. Transparent pixels in the image do not affect whatever
1373 * pixels are already there.
1374 * <p>
1375 * This method returns immediately in all cases, even if the
1376 * complete image has not yet been loaded, and it has not been dithered
1377 * and converted for the current output device.
1378 * <p>
1379 * If the image has not yet been completely loaded, then
1380 * <code>drawImage</code> returns <code>false</code>. As more of
1381 * the image becomes available, the process that draws the image notifies
1382 * the specified image observer.
1383 * @param img the specified image to be drawn.
1384 * @param x the <i>x</i> coordinate.
1385 * @param y the <i>y</i> coordinate.
1386 * @param observer object to be notified as more of
1387 * the image is converted.
1388 * @see java.awt.Image
1389 * @see java.awt.image.ImageObserver
1390 * @see java.awt.image.ImageObserver#imageUpdate(java.awt.Image, int, int, int, int, int)
1391 * @since 1.0
1392 */
1393 public boolean drawImage(Image img, int x, int y,
1394 ImageObserver observer) {
1395
1396 return drawImage(img, x, y, null, observer);
1397 }
1398
1399 /**
1400 * Draws as much of the specified image as has already been scaled
1401 * to fit inside the specified rectangle.
1402 * <p>
1403 * The image is drawn inside the specified rectangle of this
1404 * graphics context's coordinate space, and is scaled if
1405 * necessary. Transparent pixels do not affect whatever pixels
1406 * are already there.
1407 * <p>
1408 * This method returns immediately in all cases, even if the
1409 * entire image has not yet been scaled, dithered, and converted
1410 * for the current output device.
1411 * If the current output representation is not yet complete, then
1412 * <code>drawImage</code> returns <code>false</code>. As more of
1413 * the image becomes available, the process that draws the image notifies
1414 * the image observer by calling its <code>imageUpdate</code> method.
1415 * <p>
1416 * A scaled version of an image will not necessarily be
1417 * available immediately just because an unscaled version of the
1418 * image has been constructed for this output device. Each size of
1419 * the image may be cached separately and generated from the original
1420 * data in a separate image production sequence.
1421 * @param img the specified image to be drawn.
1422 * @param x the <i>x</i> coordinate.
1423 * @param y the <i>y</i> coordinate.
1424 * @param width the width of the rectangle.
1425 * @param height the height of the rectangle.
1426 * @param observer object to be notified as more of
1427 * the image is converted.
1428 * @see java.awt.Image
1429 * @see java.awt.image.ImageObserver
1430 * @see java.awt.image.ImageObserver#imageUpdate(java.awt.Image, int, int, int, int, int)
1431 * @since 1.0
1432 */
1433 public boolean drawImage(Image img, int x, int y,
1434 int width, int height,
1435 ImageObserver observer) {
1436
1437 return drawImage(img, x, y, width, height, null, observer);
1438
1439 }
1440
1441 /*
1442 * Draws as much of the specified image as is currently available.
1443 * The image is drawn with its top-left corner at
1444 * (<i>x</i>, <i>y</i>) in this graphics context's coordinate
1445 * space. Transparent pixels are drawn in the specified
1446 * background color.
1447 * <p>
1448 * This operation is equivalent to filling a rectangle of the
1449 * width and height of the specified image with the given color and then
1450 * drawing the image on top of it, but possibly more efficient.
1451 * <p>
1455 * <p>
1456 * If the image has not yet been completely loaded, then
1457 * <code>drawImage</code> returns <code>false</code>. As more of
1458 * the image becomes available, the process that draws the image notifies
1459 * the specified image observer.
1460 * @param img the specified image to be drawn.
1461 * This method does nothing if <code>img</code> is null.
1462 * @param x the <i>x</i> coordinate.
1463 * @param y the <i>y</i> coordinate.
1464 * @param bgcolor the background color to paint under the
1465 * non-opaque portions of the image.
1466 * In this WPathGraphics implementation,
1467 * this parameter can be null in which
1468 * case that background is made a transparent
1469 * white.
1470 * @param observer object to be notified as more of
1471 * the image is converted.
1472 * @see java.awt.Image
1473 * @see java.awt.image.ImageObserver
1474 * @see java.awt.image.ImageObserver#imageUpdate(java.awt.Image, int, int, int, int, int)
1475 * @since 1.0
1476 */
1477 public boolean drawImage(Image img, int x, int y,
1478 Color bgcolor,
1479 ImageObserver observer) {
1480
1481 if (img == null) {
1482 return true;
1483 }
1484
1485 boolean result;
1486 int srcWidth = img.getWidth(null);
1487 int srcHeight = img.getHeight(null);
1488
1489 if (srcWidth < 0 || srcHeight < 0) {
1490 result = false;
1491 } else {
1492 result = drawImage(img, x, y, srcWidth, srcHeight, bgcolor, observer);
1493 }
1494
1495 return result;
1516 * the specified image observer.
1517 * <p>
1518 * A scaled version of an image will not necessarily be
1519 * available immediately just because an unscaled version of the
1520 * image has been constructed for this output device. Each size of
1521 * the image may be cached separately and generated from the original
1522 * data in a separate image production sequence.
1523 * @param img the specified image to be drawn.
1524 * This method does nothing if <code>img</code> is null.
1525 * @param x the <i>x</i> coordinate.
1526 * @param y the <i>y</i> coordinate.
1527 * @param width the width of the rectangle.
1528 * @param height the height of the rectangle.
1529 * @param bgcolor the background color to paint under the
1530 * non-opaque portions of the image.
1531 * @param observer object to be notified as more of
1532 * the image is converted.
1533 * @see java.awt.Image
1534 * @see java.awt.image.ImageObserver
1535 * @see java.awt.image.ImageObserver#imageUpdate(java.awt.Image, int, int, int, int, int)
1536 * @since 1.0
1537 */
1538 public boolean drawImage(Image img, int x, int y,
1539 int width, int height,
1540 Color bgcolor,
1541 ImageObserver observer) {
1542
1543 if (img == null) {
1544 return true;
1545 }
1546
1547 boolean result;
1548 int srcWidth = img.getWidth(null);
1549 int srcHeight = img.getHeight(null);
1550
1551 if (srcWidth < 0 || srcHeight < 0) {
1552 result = false;
1553 } else {
1554 result = drawImage(img,
1555 x, y, x + width, y + height,
1556 0, 0, srcWidth, srcHeight,
1588 * destination rectangle.
1589 * @param dy1 the <i>y</i> coordinate of the first corner of the
1590 * destination rectangle.
1591 * @param dx2 the <i>x</i> coordinate of the second corner of the
1592 * destination rectangle.
1593 * @param dy2 the <i>y</i> coordinate of the second corner of the
1594 * destination rectangle.
1595 * @param sx1 the <i>x</i> coordinate of the first corner of the
1596 * source rectangle.
1597 * @param sy1 the <i>y</i> coordinate of the first corner of the
1598 * source rectangle.
1599 * @param sx2 the <i>x</i> coordinate of the second corner of the
1600 * source rectangle.
1601 * @param sy2 the <i>y</i> coordinate of the second corner of the
1602 * source rectangle.
1603 * @param observer object to be notified as more of the image is
1604 * scaled and converted.
1605 * @see java.awt.Image
1606 * @see java.awt.image.ImageObserver
1607 * @see java.awt.image.ImageObserver#imageUpdate(java.awt.Image, int, int, int, int, int)
1608 * @since 1.1
1609 */
1610 public boolean drawImage(Image img,
1611 int dx1, int dy1, int dx2, int dy2,
1612 int sx1, int sy1, int sx2, int sy2,
1613 ImageObserver observer) {
1614
1615 return drawImage(img,
1616 dx1, dy1, dx2, dy2,
1617 sx1, sy1, sx2, sy2,
1618 null, observer);
1619 }
1620
1621 /**
1622 * Draws as much of the specified area of the specified image as is
1623 * currently available, scaling it on the fly to fit inside the
1624 * specified area of the destination drawable surface.
1625 * <p>
1626 * Transparent pixels are drawn in the specified background color.
1627 * This operation is equivalent to filling a rectangle of the
1628 * width and height of the specified image with the given color and then
1653 * destination rectangle.
1654 * @param dx2 the <i>x</i> coordinate of the second corner of the
1655 * destination rectangle.
1656 * @param dy2 the <i>y</i> coordinate of the second corner of the
1657 * destination rectangle.
1658 * @param sx1 the <i>x</i> coordinate of the first corner of the
1659 * source rectangle.
1660 * @param sy1 the <i>y</i> coordinate of the first corner of the
1661 * source rectangle.
1662 * @param sx2 the <i>x</i> coordinate of the second corner of the
1663 * source rectangle.
1664 * @param sy2 the <i>y</i> coordinate of the second corner of the
1665 * source rectangle.
1666 * @param bgcolor the background color to paint under the
1667 * non-opaque portions of the image.
1668 * @param observer object to be notified as more of the image is
1669 * scaled and converted.
1670 * @see java.awt.Image
1671 * @see java.awt.image.ImageObserver
1672 * @see java.awt.image.ImageObserver#imageUpdate(java.awt.Image, int, int, int, int, int)
1673 * @since 1.1
1674 */
1675 public boolean drawImage(Image img,
1676 int dx1, int dy1, int dx2, int dy2,
1677 int sx1, int sy1, int sx2, int sy2,
1678 Color bgcolor,
1679 ImageObserver observer) {
1680
1681 if (img == null) {
1682 return true;
1683 }
1684 int imgWidth = img.getWidth(null);
1685 int imgHeight = img.getHeight(null);
1686
1687 if (imgWidth < 0 || imgHeight < 0) {
1688 return true;
1689 }
1690
1691 int srcWidth = sx2 - sx1;
1692 int srcHeight = sy2 - sy1;
1693
|