g.drawLine(xc, y, xc, y + h);
if (mask != null) { y0 = mask[xc - x0][0] + y; y1 = mask[xc - x0][1] + y; } g.drawLine(xc, y0, xc, y1);
  static void paintHorizontalGradient(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) (w * g1);    // The size of the solid c2 area.    int w2 = (int) (w * g2);    int x0 = x;    int x1 = x0 + w1;    int x2 = x1 + w2;    int x3 = x2 + w1;    int x4 = x + w;    // Paint first gradient area (c1->c2).    int xc; // The current y coordinate.    for (xc = x0; xc < x1; xc++)      {        if (xc > x + w)          break;        // Perform color interpolation;        double factor = (xc - x0) / (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(xc, y, xc, y + h);      }    // Paint solid c2 area.    g.setColor(c2);    g.fillRect(x1, y, x2 - x1, h);    // Paint second gradient area (c2->c1).    for (xc = x2; xc < x3; xc++)      {        if (xc > x + w)          break;        // Perform color interpolation;        double factor = (xc - x2) / (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(xc, y, xc, y + h);      }    // Paint third gradient area (c1->c3).    for (xc = x3; xc < x4; xc++)      {        if (xc > x + w)          break;        // Perform color interpolation;        double factor = (xc - x3) / (double) (x4 - x3);        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(xc, y, xc, y + h);      }  }