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


Java FImage.createRenderer方法代码示例

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


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

示例1: randomPointTriangle

import org.openimaj.image.FImage; //导入方法依赖的package包/类
/**
 * Draw a Sierpinski Triangle by plotting random points
 * @return image with triangle
 */
public static FImage randomPointTriangle() {
	FImage image = new FImage(500, 500);
	FImageRenderer renderer = image.createRenderer();
	
	Point2d [] vertices = {
		new Point2dImpl(0, 500),
		new Point2dImpl(250, 0),
		new Point2dImpl(500, 500),
	};
	
	Point2d p = new Point2dImpl(75, 450);
	
	Random random = new Random();
	
	for (int i=0; i<5000; i++) {
		int j = random.nextInt(3);
		
		p.setX((p.getX() + vertices[j].getX()) / 2);
		p.setY((p.getY() + vertices[j].getY()) / 2);
		
		renderer.drawPoint(p, 1.0f, 1);
	}
	
	return image;
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:30,代码来源:SierpinskiTriangle.java

示例2: render

import org.openimaj.image.FImage; //导入方法依赖的package包/类
protected FImage render(List<IndependentPair<String, Point2d>> pts, int sz) {
	FImage image = new FImage(sz, sz);
	FImageRenderer renderer = image.createRenderer(RenderHints.ANTI_ALIASED);


	for (IndependentPair<String, Point2d> pair : pts) {
		double x = pair.secondObject().getX();
		double y = pair.secondObject().getY();

		int ix = (int) Math.round((x + 0.5) * sz/2);
		int iy = (int) Math.round((y + 0.5) * sz/2);

		renderer.drawShapeFilled(new Circle(ix, iy, 2), 1f);
		renderer.drawText(pair.firstObject(), ix+5, iy, HersheyFont.TIMES_MEDIUM, 20, 1f);
	}
	
	return image;
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:19,代码来源:MDS.java

示例3: main

import org.openimaj.image.FImage; //导入方法依赖的package包/类
/**
 * @param args
 */
public static void main(String[] args) {
	MathMLFontRenderer<Float[]> rend = new MathMLFontRenderer<Float[]>();
	
	String mathML = "x = 2\\mathrm{wang}wang" ;
	
	MBFImage img = new MBFImage(300, 300, ColourSpace.RGB);
	img.fill(RGBColour.WHITE);
	MBFImageRenderer renderer = img.createRenderer();
	MathMLFontStyle<Float[]> style = new MathMLFontStyle<Float[]>(new MathMLFont(), RGBColour.WHITE);
	style.setColour(RGBColour.RED);
	style.setFontSize(30);
	rend.renderText(renderer, mathML, 0, 100, style);
	DisplayUtilities.display(img);
	
	MathMLFontRenderer<Float> rendf = new MathMLFontRenderer<Float>();
	
	FImage imgf = new FImage(300, 300);
	imgf.fill(0f);
	FImageRenderer rendererf = imgf.createRenderer();
	MathMLFontStyle<Float> stylef = new MathMLFontStyle<Float>(new MathMLFont(), 0.5f);
	stylef.setFontSize(30);
	rendf.renderText(rendererf, mathML, 0, 100, stylef);
	DisplayUtilities.display(imgf);
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:28,代码来源:MathMLFontRenderer.java

示例4: main

import org.openimaj.image.FImage; //导入方法依赖的package包/类
/**
 * 	Default main
 *  @param args Command-line arguments
 */
public static void main(String [] args) {
	Point2d[] pixels = {
			new Point2dImpl(0,0),
			new Point2dImpl(100,0),
			new Point2dImpl(20,20),
			new Point2dImpl(40,20),
			new Point2dImpl(60,20),
			new Point2dImpl(80,20),
			new Point2dImpl(45,55),
			new Point2dImpl(55,55),
			new Point2dImpl(50,60),
			new Point2dImpl(30,65),
			new Point2dImpl(70,65),
			new Point2dImpl(0,100),
			new Point2dImpl(100,100),
	};
	
	List<Triangle> tris = DelaunayTriangulator.triangulate(new ArrayList<Point2d>(Arrays.asList(pixels)));
	
	FImage image = new FImage(101, 101);
	FImageRenderer renderer = image.createRenderer();
	
	for (Triangle t : tris) {
		renderer.drawShape(t, 1f);
	}
	System.out.println(tris);
	DisplayUtilities.display(image);
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:33,代码来源:Triangulation.java

示例5: polygonTriangle

import org.openimaj.image.FImage; //导入方法依赖的package包/类
/**
 * Draw a Sierpinski Triangle by recursively drawing sub-triangles
 * @return image with triangle
 */
public static FImage polygonTriangle() {
	FImage image = new FImage(500, 500);
	FImageRenderer renderer = image.createRenderer();
	
	Point2d [] v = new Point2d[] {
			new Point2dImpl(0, 500),
			new Point2dImpl(500, 500),
			new Point2dImpl(250, 0),
	};
	
	divideTriangle(v[0], v[1], v[2], 4, renderer);
	
	return image;
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:19,代码来源:SierpinskiTriangle.java

示例6: main

import org.openimaj.image.FImage; //导入方法依赖的package包/类
/**
 * Just for testing render quality against AWT
 *
 * @param args
 */
public static void main(String[] args) {
	final FImage tmp = new FImage(800, 800);
	final int size = 40;
	tmp.drawText("Hello World!", 20, 20 + size, new GeneralFont("Arial", Font.PLAIN), size);

	final GeneralFontStyle<Float> gfs = new GeneralFontStyle<Float>(new GeneralFont("Arial", Font.PLAIN),
			tmp.createRenderer(RenderHints.ANTI_ALIASED));
	gfs.setFontSize(size);
	final Polygon[] polys = getPolygons("Hello World!", 20, 20 + 2 * size, gfs);
	for (final Polygon p : polys)
		tmp.drawPolygon(p, 1f);

	final Font fnt = new Font("Arial", Font.PLAIN, size);
	final BufferedImage bimg = ImageUtilities.createBufferedImage(tmp);

	final Graphics g = bimg.getGraphics();
	g.setFont(fnt);
	g.drawString("Hello World!", 20, 20 + 3 * size);

	final GlyphVector gl = fnt.createGlyphVector(new FontRenderContext(null, true, true),
			"Hello World!");
	for (int i = 0; i < gl.getNumGlyphs(); i++) {
		((Graphics2D) g).fill(gl.getGlyphOutline(i, 20, 20 + 4 * size));
	}

	DisplayUtilities.display(bimg);
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:33,代码来源:GeneralFontRenderer.java


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