Package java.awt.geom

Examples of java.awt.geom.AffineTransform.rotate()


                // rotate midline of glyph to be normal to path
                if (horizontal) {
                    glyphPathTransform.rotate(angle);
                } else {
                    glyphPathTransform.rotate(angle-(Math.PI/2));
                }

                // re-apply any offset eg from tspan, or spacing adjust
                if (horizontal) {
                    glyphPathTransform.translate(0, glyphOffset);
View Full Code Here


    g2d.setColor(getForeground());

    final AffineTransform trans = new AffineTransform();
    trans.concatenate(oldTransform);
    trans.translate(x, y - 2);
    trans.rotate(Math.PI * 3 / 2, height / 2, width / 2);
    g2d.setTransform(trans);
    g2d.drawString(text, (height - width) / 2, (width - height) / 2 + ascent);
    g2d.setTransform(oldTransform);
  }

View Full Code Here

    else if (rotate == RotateTextIcon.CW)
    {
      final AffineTransform trans = new AffineTransform();
      trans.concatenate(oldTransform);
      trans.translate(0, 2);
      trans.rotate(Math.PI / 2, height / 2, width / 2);
      g2d.setTransform(trans);
      g2d.drawString(text, (height - width) / 2, (width - height) / 2 + ascent);
    }
    else if (rotate == RotateTextIcon.CCW)
    {
View Full Code Here

    else if (rotate == RotateTextIcon.CCW)
    {
      final AffineTransform trans = new AffineTransform();
      trans.concatenate(oldTransform);
      trans.translate(0, -2);
      trans.rotate(Math.PI * 3 / 2, height / 2, width / 2);
      g2d.setTransform(trans);
      g2d.drawString(text, (height - width) / 2, (width - height) / 2 + ascent);
    }

    return new ImageIcon(bufferedImage);
View Full Code Here

    AffineTransform transformation = new AffineTransform();
    transformation.setToIdentity();
    double angle = Math.atan2(line.y2 - line.y1, line.x2 - line.x1);
    transformation.translate(line.x2, line.y2);
    transformation.rotate((angle - Math.PI / 2d));

    AffineTransform originalTransformation = g.getTransform();
    g.setTransform(transformation);
    g.fill(arrowHead);
    g.setTransform(originalTransformation);
View Full Code Here

    AffineTransform transformation = new AffineTransform();
    transformation.setToIdentity();
    double angle = Math.atan2(line.y2 - line.y1, line.x2 - line.x1);
    transformation.translate(line.x1, line.y1);
    transformation.rotate((angle - Math.PI / 2d));

    AffineTransform originalTransformation = g.getTransform();
    g.setTransform(transformation);
    g.draw(conditionalIndicator);
View Full Code Here

      int availableTextSpace = height - 6;

      // Create rotation for derived font
      AffineTransform transformation = new AffineTransform();
      transformation.setToIdentity();
      transformation.rotate(270 * Math.PI/180);

      Font currentFont = g.getFont();
      Font theDerivedFont = currentFont.deriveFont(transformation);
      g.setFont(theDerivedFont);
     
View Full Code Here

    private void drawArrow(double theta, double srcX, double srcY, double dx, double dy, Graphics g) {
      AffineTransform tx = new AffineTransform();
      double arrX = srcX + (dx) / 2.0;
      double arrY = srcY + (dy) / 2.0;
      tx.translate(arrX, arrY);
      tx.rotate(theta);
      Shape arrowTx = tx.createTransformedShape(ARROW_SHAPE);
      if (g instanceof Graphics2D) {
        g.setColor(ARROW_HEAD_FILL_COLOR);
        ((Graphics2D) g).fill(arrowTx);
        ((Graphics2D) g).setStroke(ARROW_BORDER_STROKE);
View Full Code Here

            double centerX = anchor.getX() + anchor.getWidth()/2;
            double centerY = anchor.getY() + anchor.getHeight()/2;

            AffineTransform trans = new AffineTransform();
            trans.translate(centerX, centerY);
            trans.rotate(Math.toRadians(angle));
            trans.translate(-centerX, -centerY);

            Rectangle2D rect = trans.createTransformedShape(anchor).getBounds2D();
            if((anchor.getWidth() < anchor.getHeight() && rect.getWidth() > rect.getHeight()) ||
                (anchor.getWidth() > anchor.getHeight() && rect.getWidth() < rect.getHeight())    ){
View Full Code Here

            Rectangle2D rect = trans.createTransformedShape(anchor).getBounds2D();
            if((anchor.getWidth() < anchor.getHeight() && rect.getWidth() > rect.getHeight()) ||
                (anchor.getWidth() > anchor.getHeight() && rect.getWidth() < rect.getHeight())    ){
                trans = new AffineTransform();
                trans.translate(centerX, centerY);
                trans.rotate(Math.PI/2);
                trans.translate(-centerX, -centerY);
                anchor = trans.createTransformedShape(anchor).getBounds2D();
            }
        }
        return anchor;
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.