g.drawLine(x, yc, x + w, yc);
if (mask != null) { x0 = mask[yc - y0][0] + x; x1 = mask[yc - y0][1] + x; } g.drawLine(x0, yc, x1, yc);
  static void paintVerticalGradient(Graphics g, int x, int y, int w, int h,                                    double g1, double g2, Color c1, Color c2,                                    Color c3)  {    // Calculate the coordinates.    // The size of the first gradient area (c1->2).    int w1 = (int) (h * g1);    // The size of the solid c2 area.    int w2 = (int) (h * g2);    int y0 = y;    int y1 = y0 + w1;    int y2 = y1 + w2;    int y3 = y2 + w1;    int y4 = y + h;    // Paint first gradient area (c1->c2).    int yc; // The current y coordinate.    for (yc = y0; yc < y1; yc++)      {        if (yc > y + h)          break;        // Perform color interpolation;        double factor = (yc - y0) / (double) w1;        int rInt = (int) ((c2.getRed() - c1.getRed()) * factor + c1.getRed());        int gInt = (int) ((c2.getGreen() - c1.getGreen()) * factor            + c1.getGreen());        int bInt = (int) ((c2.getBlue() - c1.getBlue()) * factor            + c1.getBlue());        Color interpolated = new Color(rInt, gInt, bInt);        g.setColor(interpolated);        g.drawLine(x, yc, x + w, yc);      }    // Paint solid c2 area.    g.setColor(c2);    g.fillRect(x, y1, w, y2 - y1);    // Paint second gradient area (c2->c1).    for (yc = y2; yc < y3; yc++)      {        if (yc > y + h)          break;        // Perform color interpolation;        double factor = (yc - y2) / (double) w1;        int rInt = (int) ((c1.getRed() - c2.getRed()) * factor + c2.getRed());        int gInt = (int) ((c1.getGreen() - c2.getGreen()) * factor            + c2.getGreen());        int bInt = (int) ((c1.getBlue() - c2.getBlue()) * factor            + c2.getBlue());        Color interpolated = new Color(rInt, gInt, bInt);        g.setColor(interpolated);        g.drawLine(x, yc, x + w, yc);      }    // Paint third gradient area (c1->c3).    for (yc = y3; yc < y4; yc++)      {        if (yc > y + h)          break;        // Perform color interpolation;        double factor = (yc - y3) / (double) (y4 - y3);        int rInt = (int) ((c3.getRed() - c1.getRed()) * factor + c1.getRed());        int gInt = (int) ((c3.getGreen() - c1.getGreen()) * factor            + c1.getGreen());        int bInt = (int) ((c3.getBlue() - c1.getBlue()) * factor            + c1.getBlue());        Color interpolated = new Color(rInt, gInt, bInt);        g.setColor(interpolated);        g.drawLine(x, yc, x + w, yc);      }  }