/**
   * Draw a point at (x, y).
   *
   * @param x the x-coordinate of the point
   * @param y the y-coordinate of the point
   */
  public static void point(double x, double y) {
    double r = penRadius; // r is the pen radius

    // double ws = factorX(2*r);
    // double hs = factorY(2*r);
    // if (ws <= 1 && hs <= 1) pixel(x, y);
    if (r <= 1) pixel(x, y);
    else offscreen.fill(ShapeAssist.point(x, y, r));
    draw();
  }
  /**
   * Draw picture (gif, jpg, or png) centered on (x, y), rotated given number of degrees, rescaled
   * to w-by-h.
   *
   * @param x the center x-coordinate of the image
   * @param y the center y-coordinate of the image
   * @param s the name of the image/picture, e.g., "ball.gif"
   * @param w the width of the image
   * @param h the height of the image
   * @param degrees is the number of degrees to rotate counterclockwise
   * @throws RuntimeException if the image is corrupt
   */
  public static void picture(double x, double y, String s, double w, double h, double degrees) {
    Image image = getImage(s);
    double xs = scaleX(x);
    double ys = scaleY(y);
    double ws = factorX(w);
    double hs = factorY(h);
    if (ws < 0 || hs < 0) throw new RuntimeException("image " + s + " is corrupt");
    if (ws <= 1 && hs <= 1) pixel(x, y);

    offscreen.rotate(Math.toRadians(-degrees), xs, ys);
    offscreen.drawImage(
        image,
        (int) Math.round(xs - ws / 2.0),
        (int) Math.round(ys - hs / 2.0),
        (int) Math.round(ws),
        (int) Math.round(hs),
        null);
    offscreen.rotate(Math.toRadians(+degrees), xs, ys);

    draw();
  }
 /**
  * Draw picture (gif, jpg, or png) centered on (x, y), rescaled to w-by-h.
  *
  * @param x the center x coordinate of the image
  * @param y the center y coordinate of the image
  * @param s the name of the image/picture, e.g., "ball.gif"
  * @param w the width of the image
  * @param h the height of the image
  * @throws RuntimeException if the width height are negative
  * @throws RuntimeException if the image is corrupt
  */
 public static void picture(double x, double y, String s, double w, double h) {
   Image image = getImage(s);
   double xs = scaleX(x);
   double ys = scaleY(y);
   if (w < 0) throw new RuntimeException("width is negative: " + w);
   if (h < 0) throw new RuntimeException("height is negative: " + h);
   double ws = factorX(w);
   double hs = factorY(h);
   if (ws < 0 || hs < 0) throw new RuntimeException("image " + s + " is corrupt");
   if (ws <= 1 && hs <= 1) pixel(x, y);
   else {
     offscreen.drawImage(
         image,
         (int) Math.round(xs - ws / 2.0),
         (int) Math.round(ys - hs / 2.0),
         (int) Math.round(ws),
         (int) Math.round(hs),
         null);
   }
   draw();
 }