コード例 #1
0
ファイル: ImageBuilder.java プロジェクト: jensnerche/plantuml
  private ImageData writeImageMjpeg(OutputStream os) throws IOException {

    final LimitFinder limitFinder = new LimitFinder(TextBlockUtils.getDummyStringBounder(), true);
    udrawable.drawU(limitFinder);
    final Dimension2D dim =
        new Dimension2DDouble(
            limitFinder.getMaxX() + 1 + margin1 + margin2,
            limitFinder.getMaxY() + 1 + margin1 + margin2);

    final File f = new File("c:/tmp.avi");

    final int nbframe = 100;

    final MJPEGGenerator m =
        new MJPEGGenerator(
            f, getAviImage(null).getWidth(null), getAviImage(null).getHeight(null), 12.0, nbframe);
    for (int i = 0; i < nbframe; i++) {
      // AffineTransform at = AffineTransform.getRotateInstance(1.0);
      AffineTransform at =
          AffineTransform.getTranslateInstance(dim.getWidth() / 2, dim.getHeight() / 2);
      at.rotate(90.0 * Math.PI / 180.0 * i / 100);
      at.translate(-dim.getWidth() / 2, -dim.getHeight() / 2);
      // final AffineTransform at = AffineTransform.getTranslateInstance(i, 0);
      // final ImageIcon ii = new ImageIcon(getAviImage(at));
      // m.addImage(ii.getImage());
      throw new UnsupportedOperationException();
    }
    m.finishAVI();

    FileUtils.copyToStream(f, os);

    return new ImageDataSimple(dim);
  }
コード例 #2
0
ファイル: ImageBuilder.java プロジェクト: jensnerche/plantuml
  private ImageData writeImageAnimatedGif(OutputStream os) throws IOException {

    final LimitFinder limitFinder = new LimitFinder(TextBlockUtils.getDummyStringBounder(), true);
    udrawable.drawU(limitFinder);
    final Dimension2D dim =
        new Dimension2DDouble(
            limitFinder.getMaxX() + 1 + margin1 + margin2,
            limitFinder.getMaxY() + 1 + margin1 + margin2);

    final MinMax minmax = affineTransformations.getMinMax(dim);

    final AnimatedGifEncoder e = new AnimatedGifEncoder();
    // e.setQuality(1);
    e.setRepeat(0);
    e.start(os);
    // e.setDelay(1000); // 1 frame per sec
    // e.setDelay(100); // 10 frame per sec
    e.setDelay(60); // 16 frame per sec
    // e.setDelay(50); // 20 frame per sec

    for (AffineTransformation at : affineTransformations.getAll()) {
      final ImageIcon ii = new ImageIcon(getAviImage(at));
      e.addFrame((BufferedImage) ii.getImage());
    }
    e.finish();
    return new ImageDataSimple(dim);
  }
コード例 #3
0
ファイル: ImageBuilder.java プロジェクト: jensnerche/plantuml
  private ImageData writeImageTOBEMOVED(
      FileFormatOption fileFormatOption, OutputStream os, Animation affineTransforms)
      throws IOException {
    final LimitFinder limitFinder = new LimitFinder(TextBlockUtils.getDummyStringBounder(), true);
    udrawable.drawU(limitFinder);
    Dimension2D dim =
        new Dimension2DDouble(
            limitFinder.getMaxX() + 1 + margin1 + margin2,
            limitFinder.getMaxY() + 1 + margin1 + margin2);
    double dx = 0;
    double dy = 0;
    if (affineTransforms != null) {
      final MinMax minmax = affineTransformations.getMinMax(dim);
      affineTransforms.setDimension(dim);
      dim = minmax.getDimension();
      dx = -minmax.getMinX();
      dy = -minmax.getMinY();
    }

    final UGraphic2 ug = createUGraphic(fileFormatOption, dim, affineTransforms, dx, dy);
    udrawable.drawU(handwritten(ug.apply(new UTranslate(margin1, margin1))));
    ug.flushUg();
    ug.writeImageTOBEMOVED(os, metadata, 96);
    os.flush();

    if (ug instanceof UGraphicG2d) {
      final Set<Url> urls = ((UGraphicG2d) ug).getAllUrlsEncountered();
      if (urls.size() > 0) {
        final CMapData cmap = CMapData.cmapString(urls, dpiFactor);
        return new ImageDataComplex(dim, cmap, warningOrError);
      }
    }

    return new ImageDataSimple(dim);
  }
コード例 #4
0
 private UGraphicSvg(
     ColorMapper colorMapper, SvgGraphics svg, boolean textAsPath, String linkTarget) {
   super(colorMapper, svg);
   this.stringBounder = TextBlockUtils.getDummyStringBounder();
   this.textAsPath2 = textAsPath;
   this.target = linkTarget;
   register();
 }