Esempio n. 1
0
  public static Shape draw(
      Graphics2D g2, Parameters param, GRenderer gRendreres, Shape shape, Point2D center) {
    shape = transformeShape(param, gRendreres, shape, center);

    Stroke oldStroke = g2.getStroke();
    Color oldColor = g2.getColor();
    /*TODO : Regarder setPaint*/

    Stroke newStroke = (Stroke) param.getObject(Parameters.ParameterType.Stroke);
    if (newStroke != null) {
      g2.setStroke(newStroke);
    }
    Color c = param.getColor(Parameters.ParameterType.BgColor);
    if (c != null) {

      g2.setColor(c);
      g2.fill(shape);
    }
    c = param.getColor(Parameters.ParameterType.FgColor);
    if (c != null) {
      g2.setColor(c);
      g2.draw(shape);
    }

    g2.setColor(oldColor);
    g2.setStroke(oldStroke);
    return shape;
  }
Esempio n. 2
0
  public static Shape transformeShape(
      Parameters param, GRenderer gRendreres, Shape shape, Point2D center) {
    AffineTransform af = new AffineTransform();
    // System.out.println(""+param.getDouble(Parameters.ParameterType.Angular));
    af.rotate(param.getDouble(Parameters.ParameterType.Angular), center.getX(), center.getY());

    /* --- new renderer ---*/
    AffineTransformeParameter atp = new AffineTransformeParameter(param);
    if (atp.isReady()) {
      atp.loadAf();
      af.concatenate(atp.getAf());
    }
    /* --- end new renderer */

    shape = af.createTransformedShape(shape);
    if (gRendreres != null) {
      shape = gRendreres.transform(shape);
    }

    // af.rotate(param.getDouble(Parameters.ParameterType.RScale), shape.getBounds2D().getCenterX(),
    // shape.getBounds2D().getCenterY());
    return shape;
  }