Package java.awt

Examples of java.awt.Shape


    if (getObjectClass().isAssignableFrom(o.getClass()) == false)
    {
      throw new ObjectFactoryException("Class is not assignable");
    }

    final Shape s = (Shape) o;
    final PathIterator pi = s.getPathIterator(AffineTransform.getTranslateInstance(0, 0));
    if (pi.getWindingRule() == PathIterator.WIND_EVEN_ODD)
    {
      setParameter(GeneralPathObjectDescription.WINDING_RULE_NAME, GeneralPathObjectDescription.WINDING_RULE_EVEN_ODD);
    }
    else
View Full Code Here


  /**
   * @see Graphics2D#drawGlyphVector(GlyphVector, float, float)
   */
  public void drawGlyphVector(final GlyphVector g, final float x, final float y)
  {
    final Shape s = g.getOutline(x, y);
    fill(s);
  }
View Full Code Here

        }
        final BufferedImage img = new BufferedImage((int) width, (int) height, type);
        final Graphics2D g = (Graphics2D) img.getGraphics();
        g.transform(transform);
        final AffineTransform inv = transform.createInverse();
        Shape fillRect = new Rectangle2D.Double(0, 0, img.getWidth(), img.getHeight());
        fillRect = inv.createTransformedShape(fillRect);
        g.setPaint(paint);
        g.fill(fillRect);
        if (invert)
        {
View Full Code Here

      // it is part of the users responsibility to resolve that. Magic does not
      // solve all problems, you know.
      final Line2D line = new Line2D.Float
          (Math.abs(x1), Math.abs(y1), Math.abs(x2), Math.abs(y2));
      final Rectangle2D shapeBounds = line.getBounds2D();
      final Shape transformedShape =
          ShapeTransform.translateShape(line, -shapeBounds.getX(), -shapeBounds.getY());
      // and use that shape with the user's bounds to create the element.
      final ContentElementFactory elementFactory = new ContentElementFactory();
      elementFactory.setName(name);
      elementFactory.setColor(c);
View Full Code Here

      // it is part of the users reponsibility to resolve that. Magic does not
      // solve all problems, you know.
      final Line2D line = new Line2D.Float
          (Math.abs(x1), Math.abs(y1), Math.abs(x2), Math.abs(y2));
      final Rectangle2D shapeBounds = line.getBounds2D();
      final Shape transformedShape =
          ShapeTransform.translateShape(line, -shapeBounds.getX(), -shapeBounds.getY());
      // and use that shape with the user's bounds to create the element.
      final ContentElementFactory elementFactory = new ContentElementFactory();
      elementFactory.setName(name);
      elementFactory.setColor(c);
View Full Code Here

    final Color oldColor = g2d.getColor();
    final Stroke oldStroke = g2d.getStroke();

    if (isSameForAllSides())
    {
      final Shape borderShape = getBorderShape();

      if (backgroundColor != null)
      {
        g2d.setColor(backgroundColor);
        g2d.fill(borderShape);
      }

      if (staticBoxLayoutProperties.getBorderTop() > 0)
      {
        final BorderEdge borderEdge = border.getTop();

        final BasicStroke basicStroke = createStroke(borderEdge, staticBoxLayoutProperties.getBorderTop());
        if (basicStroke != null)
        {
          g2d.setColor(borderEdge.getColor());
          g2d.setStroke(basicStroke);
          g2d.draw(borderShape);
        }
      }
      g2d.setColor(oldColor);
      g2d.setStroke(oldStroke);
      return;
    }


    if (backgroundColor != null)
    {
      final Shape borderShape = getBorderShape();
      g2d.setColor(backgroundColor);
      g2d.fill(borderShape);
    }

    final StaticBoxLayoutProperties sblp = this.staticBoxLayoutProperties;
View Full Code Here

     */
    final Rectangle2D bounds = shape.getBounds2D();
    final AffineTransform translateTransform
        = AffineTransform.getTranslateInstance(0 - bounds.getX(), 0 - bounds.getY());
    // apply normalisation translation ...
    final Shape translatedShape = translateTransform.createTransformedShape(shape);

    final AffineTransform scaleTransform = AffineTransform.getScaleInstance(scaleX, scaleY);
    // apply scaling ...
    final Shape scaledShape = scaleTransform.createTransformedShape(translatedShape);

    // now retranslate the shape to its original position ...
    final AffineTransform translateBackTransform =
        AffineTransform.getTranslateInstance(bounds.getX(), bounds.getY());
    return translateBackTransform.createTransformedShape(scaledShape);
View Full Code Here

    }

    final Rectangle2D b = this.shape.getBounds2D();
    double x = area.getMinX() + b.getWidth() / 2.0 + 1.0;
    final double y = area.getCenterY();
    final Shape s = getShape();
    g2.translate(x, y);
    g2.setPaint(Color.black);
    if (this.draw)
    {
      g2.setStroke(new BasicStroke(0.5f));
View Full Code Here

    if (rawbackend instanceof ShapeDrawable == false)
    {
      return;
    }
    final ShapeDrawable drawable = (ShapeDrawable) rawbackend;
    final Shape shape = drawable.getShape();

    final StyleSheet styleSheet = node.getStyleSheet();
    final boolean draw = styleSheet.getBooleanStyleProperty(ElementStyleKeys.DRAW_SHAPE);
    if (draw && shape instanceof Line2D)
    {
View Full Code Here

        contentHeight = StrictGeomUtility.toInternalValue(preferredSize.getHeight());
      }
    }
    else if (content instanceof Shape)
    {
      final Shape s = (Shape) content;
      final Rectangle2D bounds2D = s.getBounds2D();
      contentWidth = StrictGeomUtility.toInternalValue(bounds2D.getWidth());
      contentHeight = StrictGeomUtility.toInternalValue(bounds2D.getHeight());
    }
  }
View Full Code Here

TOP

Related Classes of java.awt.Shape

Copyright © 2018 www.massapicom. 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.