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


Java FileFormat.PNG属性代码示例

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


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

示例1: createImage

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,代码行数:16,代码来源:PostItDiagram.java

示例2: writeImage

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,代码行数:19,代码来源:UGraphicUtils.java

示例3: processImage

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,代码行数:25,代码来源:FtpConnexion.java

示例4: createImage

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,代码行数:16,代码来源:PostItDiagram.java

示例5: createOne

public ImageData createOne(OutputStream os, int index, boolean isWithMetadata) throws IOException {
	final UGraphic2 ug = createImage((int) fullDimension.getWidth(), pages.get(index), index);

	ug.writeImageTOBEMOVED(os, isWithMetadata ? diagram.getMetadata() : null, diagram.getDpi(fileFormatOption));
	final Dimension2D info = new Dimension2DDouble(fullDimension.getWidth(), fullDimension.getHeight());

	if (fileFormatOption.getFileFormat() == FileFormat.PNG && ug instanceof UGraphicG2d) {
		final Set<Url> urls = ((UGraphicG2d) ug).getAllUrlsEncountered();
		if (urls.size() > 0) {
			if (scale == 0) {
				throw new IllegalStateException();
			}
			final CMapData cmap = CMapData.cmapString(urls, scale);
			return new ImageDataComplex(info, cmap, null);
		}
	}
	return new ImageDataSimple(info);
}
 
开发者ID:mar9000,项目名称:plantuml,代码行数:18,代码来源:SequenceDiagramFileMakerPuma.java

示例6: stor

private void stor(String fileName, Socket socket) throws UnknownHostException, IOException {
	final InputStream is = socket.getInputStream();
	final ByteArrayOutputStream baos = new ByteArrayOutputStream();
	FileUtils.copyToStream(is, baos);
	myOut("226 Transfer complete.");
	final String data = new String(baos.toByteArray(), ftpServer.getCharset());
	final FileFormat format = FileFormat.PNG;
	final String pngFileName = format.changeName(fileName, 0);
	connexion.removeOutgoing(pngFileName);
	connexion.addIncoming(fileName, data);

	ftpServer.processImage(connexion, fileName);
}
 
开发者ID:mar9000,项目名称:plantuml,代码行数:13,代码来源:FtpLoop.java

示例7: getFormatOption

@Override
public FileFormatOption getFormatOption() {
    return new FileFormatOption(FileFormat.PNG);
}
 
开发者ID:protostuff,项目名称:protostuff-compiler,代码行数:4,代码来源:PlantUmlVerbatimSerializer.java

示例8: FtpServer

public FtpServer(int listenPort, FileFormat defaultfileFormat) {
	this.listenPort = listenPort;
	this.defaultfileFormat = defaultfileFormat == null ? FileFormat.PNG : defaultfileFormat;
}
 
开发者ID:Banno,项目名称:sbt-plantuml-plugin,代码行数:4,代码来源:FtpServer.java

示例9: createFileInternalOld

private ImageData createFileInternalOld(OutputStream os, List<String> dotStrings, FileFormatOption fileFormatOption)
		throws IOException, InterruptedException {
	if (diagram.getUmlDiagramType() == UmlDiagramType.ACTIVITY) {
		new CucaDiagramSimplifierActivity(diagram, dotStrings);
	} else if (diagram.getUmlDiagramType() == UmlDiagramType.STATE) {
		new CucaDiagramSimplifierState(diagram, dotStrings);
	}

	CucaDiagramFileMakerSvek2 svek2 = buildCucaDiagramFileMakerSvek2(DotMode.NORMAL);
	TextBlockBackcolored result = svek2.createFile(diagram.getDotStringSkek());
	if (result instanceof GraphvizCrash) {
		svek2 = buildCucaDiagramFileMakerSvek2(DotMode.NO_LEFT_RIGHT);
		result = svek2.createFile(diagram.getDotStringSkek());
	}
	result = addLegend(result);
	result = addTitle(result);
	result = addHeaderAndFooter(result);

	final Dimension2D dim = result.calculateDimension(stringBounder);

	final FileFormat fileFormat = fileFormatOption.getFileFormat();
	Set<Url> allUrlEncountered = null;
	double scale = 0;
	if (fileFormat == FileFormat.PNG) {
		allUrlEncountered = new HashSet<Url>();
		scale = createPng(os, fileFormatOption, result, dim, allUrlEncountered, fileFormatOption.isWithMetadata());
	} else if (fileFormat == FileFormat.SVG) {
		createSvg(os, fileFormatOption, result, dim);
	} else if (fileFormat == FileFormat.VDX) {
		createVdx(os, fileFormatOption, result, dim);
	} else if (fileFormat == FileFormat.LATEX) {
		createTikz(os, fileFormatOption, result, dim);
	} else if (fileFormat == FileFormat.EPS) {
		createEps(os, fileFormatOption, result, dim);
	} else {
		throw new UnsupportedOperationException(fileFormat.toString());
	}

	double deltaX = 0;
	double deltaY = 0;
	if (result instanceof DecorateEntityImage) {
		deltaX += ((DecorateEntityImage) result).getDeltaX();
		deltaY += ((DecorateEntityImage) result).getDeltaY();
	}

	final Dimension2D finalDimension = Dimension2DDouble.delta(dim, deltaX, deltaY);

	CMapData cmap = null;
	if (diagram.hasUrl() && fileFormatOption.getFileFormat() == FileFormat.PNG) {
		cmap = CMapData.cmapString(allUrlEncountered, scale);
	}

	final String widthwarning = diagram.getSkinParam().getValue("widthwarning");
	if (widthwarning != null && widthwarning.matches("\\d+")) {
		this.warningOrError = svek2.getBibliotekon().getWarningOrError(Integer.parseInt(widthwarning));
	} else {
		this.warningOrError = null;
	}

	return new ImageDataComplex(finalDimension, cmap, getWarningOrError());
}
 
开发者ID:mar9000,项目名称:plantuml,代码行数:61,代码来源:CucaDiagramFileMakerSvek.java


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