コード例 #1
0
 private void writeTextAreaElement(IXMLElement parent, SVGTextAreaFigure f) throws IOException {
     IXMLElement elem = parent.createElement("AREA");
     Rectangle2D.Double rect = f.getBounds();
     double grow = getPerpendicularHitGrowth(f);
     rect.x -= grow;
     rect.y -= grow;
     rect.width += grow;
     rect.height += grow;
     if (writeRectAttributes(elem, f, rect)) {
         parent.addChild(elem);
     }
 }
コード例 #2
0
 private void writeRectElement(IXMLElement parent, SVGRectFigure f) throws IOException {
     IXMLElement elem = parent.createElement("AREA");
     boolean isContained;
     if (f.getArcHeight() == 0 && f.getArcWidth() == 0) {
         Rectangle2D.Double rect = f.getBounds();
         double grow = getPerpendicularHitGrowth(f);
         rect.x -= grow;
         rect.y -= grow;
         rect.width += grow;
         rect.height += grow;
         isContained = writeRectAttributes(elem, f, rect);
     } else {
         isContained = writePolyAttributes(elem, f,
                 new GrowStroke((float) (getStrokeTotalWidth(f) / 2d), (float) getStrokeTotalWidth(f)).
                 createStrokedShape(new RoundRectangle2D.Double(
                 f.getX(), f.getY(), f.getWidth(), f.getHeight(),
                 f.getArcWidth(), f.getArcHeight()
                 )));
     }
     if (isContained) {
         parent.addChild(elem);
     }
 }
コード例 #3
0
 /**
  * All other write methods delegate their work to here.
  */
 public void write(OutputStream out, java.util.List<Figure> figures) throws IOException {
     Rectangle2D.Double drawingRect = null;
     
     for (Figure f : figures) {
         if (drawingRect == null) {
             drawingRect = f.getBounds();
         } else {
             drawingRect.add(f.getBounds());
         }
     }
     
     AffineTransform drawingTransform = new AffineTransform();
     drawingTransform.translate(
             -Math.min(0, drawingRect.x),
             -Math.min(0, drawingRect.y)
             );
     
     write(out, figures, drawingTransform,
             new Dimension(
             (int) (Math.abs(drawingRect.x) + drawingRect.width),
             (int) (Math.abs(drawingRect.y) + drawingRect.height))
             );
 }