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 tx=new AffineTransform();
  tx.translate(-Math.min(0,drawingRect.x),-Math.min(0,drawingRect.y));
  write(out,figures,tx,new Dimension((int)(Math.abs(drawingRect.x) + drawingRect.width),(int)(Math.abs(drawingRect.y) + drawingRect.height)));
}

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 tx = new AffineTransform ( ) ; tx . translate ( - Math . min ( 0 , drawingRect . x ) , - Math . min ( 0 , drawingRect . y ) ) ; write ( out , figures , tx , new Dimension ( ( int ) ( Math . abs ( drawingRect . x ) + drawingRect . width ) , ( int ) ( Math . abs ( drawingRect . y ) + drawingRect . height ) ) ) ; }
all other write methods delegate their work to here .
