当前位置: 首页>>代码示例>>Java>>正文


Java FileFormatOption类代码示例

本文整理汇总了Java中net.sourceforge.plantuml.FileFormatOption的典型用法代码示例。如果您正苦于以下问题:Java FileFormatOption类的具体用法?Java FileFormatOption怎么用?Java FileFormatOption使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


FileFormatOption类属于net.sourceforge.plantuml包,在下文中一共展示了FileFormatOption类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: exportDiagramInternal

import net.sourceforge.plantuml.FileFormatOption; //导入依赖的package包/类
@Override
protected ImageData exportDiagramInternal(OutputStream os, int index, FileFormatOption fileFormatOption)
		throws IOException {
	// BUG42
	// COMPRESSION
	// TextBlock result = swinlanes;
	TextBlock result = new TextBlockCompressed(swinlanes);
	result = new TextBlockRecentred(result);
	final ISkinParam skinParam = getSkinParam();
	result = new AnnotatedWorker(this, skinParam).addAdd(result);
	final Dimension2D dim = TextBlockUtils.getMinMax(result, fileFormatOption.getDefaultStringBounder())
			.getDimension();
	final double margin = 10;
	final double dpiFactor = getDpiFactor(fileFormatOption, Dimension2DDouble.delta(dim, 2 * margin, 0));

	final ImageBuilder imageBuilder = new ImageBuilder(skinParam.getColorMapper(), dpiFactor, getSkinParam()
			.getBackgroundColor(), fileFormatOption.isWithMetadata() ? getMetadata() : null, getWarningOrError(),
			margin, margin, getAnimation(), getSkinParam().handwritten());
	imageBuilder.setUDrawable(result);

	return imageBuilder.writeImageTOBEMOVED(fileFormatOption, os);

}
 
开发者ID:Banno,项目名称:sbt-plantuml-plugin,代码行数:24,代码来源:ActivityDiagram3.java

示例2: createUGraphic

import net.sourceforge.plantuml.FileFormatOption; //导入依赖的package包/类
private UGraphic2 createUGraphic(FileFormatOption fileFormatOption, final Dimension2D dim, Animation animationArg,
		double dx, double dy) {
	final FileFormat fileFormat = fileFormatOption.getFileFormat();
	switch (fileFormat) {
	case PNG:
		return createUGraphicPNG(colorMapper, dpiFactor, dim, mybackcolor, animationArg, dx, dy);
	case SVG:
		return createUGraphicSVG(colorMapper, dpiFactor, dim, mybackcolor, fileFormatOption.getSvgLinkTarget());
	case EPS:
		return new UGraphicEps(colorMapper, EpsStrategy.getDefault2());
	case EPS_TEXT:
		return new UGraphicEps(colorMapper, EpsStrategy.WITH_MACRO_AND_TEXT);
	case HTML5:
		return new UGraphicHtml5(colorMapper);
	case VDX:
		return new UGraphicVdx(colorMapper);
	case LATEX:
		return new UGraphicTikz(colorMapper, true);
	case LATEX_NO_PREAMBLE:
		return new UGraphicTikz(colorMapper, false);
	case BRAILLE_PNG:
		return new UGraphicBraille(colorMapper, fileFormat);
	default:
		throw new UnsupportedOperationException(fileFormat.toString());
	}
}
 
开发者ID:Banno,项目名称:sbt-plantuml-plugin,代码行数:27,代码来源:ImageBuilder.java

示例3: exportDiagramInternal

import net.sourceforge.plantuml.FileFormatOption; //导入依赖的package包/类
@Override
final protected ImageData exportDiagramInternal(OutputStream os, int index, FileFormatOption fileFormatOption)
		throws IOException {
	final UGraphic ug = createImage(fileFormatOption);
	drawU(ug);
	if (ug instanceof UGraphicG2d) {
		final BufferedImage im = ((UGraphicG2d) ug).getBufferedImage();
		PngIO.write(im, os, fileFormatOption.isWithMetadata() ? getMetadata() : null, this.getDpi(fileFormatOption));
	} else if (ug instanceof UGraphicSvg) {
		final UGraphicSvg svg = (UGraphicSvg) ug;
		svg.createXml(os);
	} else if (ug instanceof UGraphicEps) {
		final UGraphicEps eps = (UGraphicEps) ug;
		os.write(eps.getEPSCode().getBytes());
	}
	return new ImageDataSimple();
}
 
开发者ID:Banno,项目名称:sbt-plantuml-plugin,代码行数:18,代码来源:PostItDiagram.java

示例4: createImage

import net.sourceforge.plantuml.FileFormatOption; //导入依赖的package包/类
private UGraphic createImage(FileFormatOption fileFormatOption) {
	final Color backColor = getSkinParam().getColorMapper()
			.getMappedColor(this.getSkinParam().getBackgroundColor());
	final FileFormat fileFormat = fileFormatOption.getFileFormat();
	if (fileFormat == FileFormat.PNG) {
		final double height = getDefaultArea().heightWhenWidthIs(width, fileFormat.getDefaultStringBounder());
		final EmptyImageBuilder builder = new EmptyImageBuilder(width, height, backColor);

		final Graphics2D graphics2D = builder.getGraphics2D();
		final double dpiFactor = this.getDpiFactor(fileFormatOption);
		final UGraphicG2d result = new UGraphicG2d(new ColorMapperIdentity(), graphics2D, dpiFactor);
		result.setBufferedImage(builder.getBufferedImage());
		return result;
	}
	throw new UnsupportedOperationException();
}
 
开发者ID:Banno,项目名称:sbt-plantuml-plugin,代码行数:17,代码来源:PostItDiagram.java

示例5: exportDiagram

import net.sourceforge.plantuml.FileFormatOption; //导入依赖的package包/类
public ImageData exportDiagram(OutputStream os, int num, FileFormatOption fileFormat) throws IOException {
	final Display display = Display.create(lines);
	final UFont font = new UFont("Serif", Font.PLAIN, 14);
	final FontConfiguration fontConfiguration = FontConfiguration.blackBlueTrue(font);
	final Sheet sheet = new CreoleParser(fontConfiguration, HorizontalAlignment.LEFT, null, CreoleMode.FULL)
			.createSheet(display);
	final SheetBlock1 sheetBlock = new SheetBlock1(sheet, 0, 0);

	final ImageBuilder builder = new ImageBuilder(new ColorMapperIdentity(), 1.0, null, null, null, 0, 0, null,
			false);
	builder.setUDrawable(sheetBlock);
	return builder.writeImageTOBEMOVED(fileFormat, os);

	// final Dimension2D dim = TextBlockUtils.getDimension(sheetBlock);
	// final UGraphic2 ug = fileFormat.createUGraphic(new ColorMapperIdentity(), 1, dim, null, false);
	// // sheetBlock.drawU(ug.apply(new UTranslate(0, 10)));
	// sheetBlock.drawU(ug);
	// ug.writeImageTOBEMOVED(os, null, 96);
	// return new ImageDataSimple(dim);
}
 
开发者ID:Banno,项目名称:sbt-plantuml-plugin,代码行数:21,代码来源:PSystemCreole.java

示例6: exportDiagram

import net.sourceforge.plantuml.FileFormatOption; //导入依赖的package包/类
public ImageData exportDiagram(OutputStream os, int num, FileFormatOption fileFormat) throws IOException {
	final Element salt = SaltUtils.createElement(data);

	final Dimension2D size = salt.getPreferredDimension(fileFormat.getDefaultStringBounder(), 0, 0);
	final ImageBuilder builder = new ImageBuilder(new ColorMapperIdentity(), 1.0, HtmlColorUtils.WHITE, null, null,
			5, 5, null, false);
	builder.setUDrawable(new UDrawable() {

		public void drawU(UGraphic ug) {
			ug = ug.apply(new UChangeColor(HtmlColorUtils.BLACK));
			salt.drawU(ug, 0, new Dimension2DDouble(size.getWidth(), size.getHeight()));
			salt.drawU(ug, 1, new Dimension2DDouble(size.getWidth(), size.getHeight()));
		}
	});
	return builder.writeImageTOBEMOVED(fileFormat, os);
}
 
开发者ID:Banno,项目名称:sbt-plantuml-plugin,代码行数:17,代码来源:PSystemSalt.java

示例7: exportDiagramOld

import net.sourceforge.plantuml.FileFormatOption; //导入依赖的package包/类
private ImageData exportDiagramOld(OutputStream os, int num, FileFormatOption fileFormat) throws IOException {
	final Element salt = SaltUtils.createElement(data);

	EmptyImageBuilder builder = new EmptyImageBuilder(10, 10, Color.WHITE);
	Graphics2D g2d = builder.getGraphics2D();

	final Dimension2D size = salt.getPreferredDimension(
			new UGraphicG2d(new ColorMapperIdentity(), g2d, 1.0).getStringBounder(), 0, 0);
	g2d.dispose();

	builder = new EmptyImageBuilder(size.getWidth() + 6, size.getHeight() + 6, Color.WHITE);
	final BufferedImage im = builder.getBufferedImage();
	g2d = builder.getGraphics2D();
	g2d.translate(3, 3);
	UAntiAliasing.ANTI_ALIASING_ON.apply(g2d);
	UGraphic ug = new UGraphicG2d(new ColorMapperIdentity(), g2d, 1.0);
	ug = ug.apply(new UChangeColor(HtmlColorUtils.BLACK));
	salt.drawU(ug, 0, new Dimension2DDouble(size.getWidth(), size.getHeight()));
	salt.drawU(ug, 1, new Dimension2DDouble(size.getWidth(), size.getHeight()));
	g2d.dispose();

	// Writes the off-screen image into a PNG file
	ImageIO.write(im, "png", os);
	return new ImageDataSimple(im.getWidth(), im.getHeight());
}
 
开发者ID:Banno,项目名称:sbt-plantuml-plugin,代码行数:26,代码来源:PSystemSalt.java

示例8: exportDiagram

import net.sourceforge.plantuml.FileFormatOption; //导入依赖的package包/类
public ImageData exportDiagram(OutputStream os, int num, FileFormatOption fileFormat) throws IOException {
		final OpenIcon icon = OpenIcon.retrieve(iconName);
		// final Dimension2D dim = new Dimension2DDouble(100, 100);

		final ImageBuilder imageBuilder = new ImageBuilder(new ColorMapperIdentity(), 1.0,
				null, null, null, 5, 5, null, false);
		imageBuilder.setUDrawable(icon.asTextBlock(HtmlColorUtils.BLACK, factor));
		return imageBuilder.writeImageTOBEMOVED(fileFormat, os);

//		UGraphic2 ug = fileFormat.createUGraphic(dim);
//		ug = (UGraphic2) ug.apply(new UTranslate(10, 10));
//		// ug = ug.apply(new UChangeColor(HtmlColorUtils.BLACK));
//		// ug.draw(new URectangle(7, 6));
//		icon.asTextBlock(HtmlColorUtils.BLACK, factor).drawU(ug);
//		ug.writeImageTOBEMOVED(os, null, 96);
//		return new ImageDataSimple(dim);
	}
 
开发者ID:Banno,项目名称:sbt-plantuml-plugin,代码行数:18,代码来源:PSystemOpenIconic.java

示例9: exportDiagram

import net.sourceforge.plantuml.FileFormatOption; //导入依赖的package包/类
public ImageData exportDiagram(OutputStream os, int num, FileFormatOption fileFormat) throws IOException {
	// Copy data to diagramString.
	StringBuffer diagramString = new StringBuffer();
	Iterator<String> iter = data.iterator();
	while (iter.hasNext()) {
		diagramString.append(iter.next()).append("\n");
	}
	// Process diagramString with Salt9000.
	SaltProcessor salt = new SaltProcessor(diagramString.toString());
	salt.setLookAndFeel(SaltProcessor.JGOODIES_PLASTIC_LOOKANDFEEL);
	final BufferedImage image = salt.getImage();
	final ImageBuilder builder = new ImageBuilder(new ColorMapperIdentity(), 1.0, HtmlColorUtils.WHITE, null,
			null, 5, 5, null);
	builder.addUDrawable(new UDrawable() {
		public void drawU(UGraphic ug) {
			ug = ug.apply(new UChangeColor(HtmlColorUtils.BLACK));
			ug.draw(new UImage(image));
		}
	});
	return builder.writeImageTOBEMOVED(fileFormat.getFileFormat(), os);
}
 
开发者ID:mar9000,项目名称:plantuml,代码行数:22,代码来源:PSystemSalt9000.java

示例10: exportDiagramInternal

import net.sourceforge.plantuml.FileFormatOption; //导入依赖的package包/类
@Override
protected ImageData exportDiagramInternal(OutputStream os, int index, FileFormatOption fileFormatOption) throws IOException {
	// BUG42
	// TextBlock result = swinlanes;
	TextBlock result = new TextBlockCompressed(swinlanes);
	result = new TextBlockRecentred(result);
	result = addLegend(result);
	result = addTitle(result);
	result = addHeaderAndFooter(result);
	final ISkinParam skinParam = getSkinParam();
	final Dimension2D dim = TextBlockUtils.getMinMax(result).getDimension();
	final double margin = 10;
	final double dpiFactor = getDpiFactor(fileFormatOption, Dimension2DDouble.delta(dim, 2 * margin, 0));

	final ImageBuilder imageBuilder = new ImageBuilder(skinParam.getColorMapper(), dpiFactor, getSkinParam()
			.getBackgroundColor(), fileFormatOption.isWithMetadata() ? getMetadata() : null, getWarningOrError(),
			margin, margin, getAnimation());
	imageBuilder.addUDrawable(result);

	return imageBuilder.writeImageTOBEMOVED(fileFormatOption.getFileFormat(), os);

}
 
开发者ID:mar9000,项目名称:plantuml,代码行数:23,代码来源:ActivityDiagram3.java

示例11: writeImage

import net.sourceforge.plantuml.FileFormatOption; //导入依赖的package包/类
public static void writeImage(OutputStream os, String metadata, FileFormatOption fileFormatOption,
		ColorMapper colorMapper, HtmlColor background, TextBlock image) throws IOException {
	final FileFormat fileFormat = fileFormatOption.getFileFormat();
	if (fileFormat == FileFormat.PNG) {
		final BufferedImage im = createImage(colorMapper, background, image);
		PngIO.write(im, os, fileFormatOption.isWithMetadata() ? metadata : null, 96);
	} else if (fileFormat == FileFormat.SVG) {
		final UGraphicSvg svg = new UGraphicSvg(colorMapper, StringUtils.getAsHtml(colorMapper
				.getMappedColor(background)), false, 1.0);
		image.drawU(svg);
		svg.createXml(os);
	} else if (fileFormat == FileFormat.EPS) {
		final UGraphicEps ug = new UGraphicEps(colorMapper, EpsStrategy.getDefault2());
		image.drawU(ug);
		os.write(ug.getEPSCode().getBytes());
	} else {
		throw new UnsupportedOperationException();
	}
}
 
开发者ID:mar9000,项目名称:plantuml,代码行数:20,代码来源:UGraphicUtils.java

示例12: processImage

import net.sourceforge.plantuml.FileFormatOption; //导入依赖的package包/类
public void processImage(String fileName) throws IOException {
	if (fileName.startsWith("/")) {
		throw new IllegalArgumentException();
	}
	final SourceStringReader sourceStringReader = new SourceStringReader(incoming.get(fileName));
	final ByteArrayOutputStream baos = new ByteArrayOutputStream();
	final FileFormat format = FileFormat.PNG;
	final DiagramDescription desc = sourceStringReader.generateDiagramDescription(baos,
			new FileFormatOption(format));
	final String pngFileName = format.changeName(fileName, 0);
	final String errorFileName = pngFileName.substring(0, pngFileName.length() - 4) + ".err";
	synchronized (this) {
		outgoing.remove(pngFileName);
		outgoing.remove(errorFileName);
		if (desc != null && desc.getDescription() != null) {
			outgoing.put(pngFileName, baos.toByteArray());
			if (desc.getDescription().startsWith("(Error)")) {
				final ByteArrayOutputStream errBaos = new ByteArrayOutputStream();
				sourceStringReader.generateImage(errBaos, new FileFormatOption(FileFormat.ATXT));
				errBaos.close();
				outgoing.put(errorFileName, errBaos.toByteArray());
			}
		}
	}
}
 
开发者ID:mar9000,项目名称:plantuml,代码行数:26,代码来源:FtpConnexion.java

示例13: exportDiagramInternal

import net.sourceforge.plantuml.FileFormatOption; //导入依赖的package包/类
@Override
final protected ImageData exportDiagramInternal(OutputStream os, int index, FileFormatOption fileFormatOption) throws IOException {
	final UGraphic ug = createImage(fileFormatOption);
	drawU(ug);
	if (ug instanceof UGraphicG2d) {
		final BufferedImage im = ((UGraphicG2d) ug).getBufferedImage();
		PngIO.write(im, os, fileFormatOption.isWithMetadata() ? getMetadata() : null, this.getDpi(fileFormatOption));
	} else if (ug instanceof UGraphicSvg) {
		final UGraphicSvg svg = (UGraphicSvg) ug;
		svg.createXml(os);
	} else if (ug instanceof UGraphicEps) {
		final UGraphicEps eps = (UGraphicEps) ug;
		os.write(eps.getEPSCode().getBytes());
	}
	return new ImageDataSimple();
}
 
开发者ID:mar9000,项目名称:plantuml,代码行数:17,代码来源:PostItDiagram.java

示例14: createImage

import net.sourceforge.plantuml.FileFormatOption; //导入依赖的package包/类
private UGraphic createImage(FileFormatOption fileFormatOption) {
	final Color backColor = getSkinParam().getColorMapper()
			.getMappedColor(this.getSkinParam().getBackgroundColor());
	final FileFormat fileFormat = fileFormatOption.getFileFormat();
	if (fileFormat == FileFormat.PNG) {
		final double height = getDefaultArea().heightWhenWidthIs(width, TextBlockUtils.getDummyStringBounder());
		final EmptyImageBuilder builder = new EmptyImageBuilder(width, height, backColor);

		final Graphics2D graphics2D = builder.getGraphics2D();
		final double dpiFactor = this.getDpiFactor(fileFormatOption);
		final UGraphicG2d result = new UGraphicG2d(new ColorMapperIdentity(), graphics2D, dpiFactor);
		result.setBufferedImage(builder.getBufferedImage());
		return result;
	}
	throw new UnsupportedOperationException();
}
 
开发者ID:mar9000,项目名称:plantuml,代码行数:17,代码来源:PostItDiagram.java

示例15: createSvg

import net.sourceforge.plantuml.FileFormatOption; //导入依赖的package包/类
private void createSvg(OutputStream os, FileFormatOption fileFormatOption, final TextBlockBackcolored result,
		final Dimension2D dim) throws IOException {
	final double scale = getScale(fileFormatOption, dim);

	Color backColor = Color.WHITE;
	if (result.getBackcolor() instanceof HtmlColorSimple) {
		backColor = diagram.getSkinParam().getColorMapper().getMappedColor(result.getBackcolor());
	}
	final UGraphicSvg ug;
	if (result.getBackcolor() instanceof HtmlColorGradient) {
		ug = new UGraphicSvg(diagram.getSkinParam().getColorMapper(), (HtmlColorGradient) result.getBackcolor(),
				false, scale);
	} else if (backColor == null || backColor.equals(Color.WHITE)) {
		ug = new UGraphicSvg(diagram.getSkinParam().getColorMapper(), false, scale);
	} else {
		ug = new UGraphicSvg(diagram.getSkinParam().getColorMapper(), StringUtils.getAsHtml(backColor), false,
				scale);
	}
	result.drawU(ug);
	ug.createXml(os);
}
 
开发者ID:mar9000,项目名称:plantuml,代码行数:22,代码来源:CucaDiagramFileMakerSvek.java


注:本文中的net.sourceforge.plantuml.FileFormatOption类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。