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


Java BufferedImage.setData方法代码示例

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


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

示例1: processaAlgoritmo

import java.awt.image.BufferedImage; //导入方法依赖的package包/类
public BufferedImage processaAlgoritmo(BufferedImage img, PosicoesDTO posicoes) {
	WritableRaster raster = img.getRaster();
	BufferedImage newImage = new BufferedImage(img.getWidth(), img.getHeight(), BufferedImage.TYPE_INT_RGB);
	int pixels[] = new int[4];
	for (int i = posicoes.getX1(); i < posicoes.getY1() - 1; i++) {
		for (int j = posicoes.getX2(); j < posicoes.getY2() - 1; j++) {
			raster.getPixel(i, j, pixels);
			int[] novosPixels = calculaPixeis(img, i, j);
			pixels[0] = novosPixels[0];
			pixels[1] = novosPixels[1];
			pixels[2] = novosPixels[2];

			raster.setPixel(i, j, pixels);
		}
	}

	newImage.setData(raster);

	return newImage;

}
 
开发者ID:nbfontana,项目名称:pdi,代码行数:22,代码来源:ProcessadorImagem.java

示例2: toImage

import java.awt.image.BufferedImage; //导入方法依赖的package包/类
/**
 * Convert {@link AbstractImage} to {@link Image}.
 *
 * @param in
 *            the input image
 * @return the converted image
 */
public static Image toImage(AbstractImage in) {
	if (in == null) {
		return null;
	}
	BufferedImage res = new BufferedImage(in.width, in.height, BufferedImage.TYPE_INT_ARGB);
	int[] pixels = new int[in.pixels.length];
	for (int i = 0; i < pixels.length; i += 1) {
		pixels[i] = in.pixels[i] & 0xFF;
	}
	WritableRaster raster = Raster.createWritableRaster(res.getSampleModel(), null);
	raster.setPixels(0, 0, in.width, in.height, pixels);
	res.setData(raster);
	res.flush();
	return res;

}
 
开发者ID:rekit-group,项目名称:rekit-game,代码行数:24,代码来源:ImageManagement.java

示例3: girar

import java.awt.image.BufferedImage; //导入方法依赖的package包/类
public BufferedImage girar(BufferedImage img, PosicoesDTO posicoes) {
	WritableRaster raster = img.getRaster();
	BufferedImage newImage = new BufferedImage(img.getWidth(), img.getHeight(), BufferedImage.TYPE_INT_RGB);
	WritableRaster rasterNewImage = newImage.getRaster();
	int pixels[] = new int[4];
	for (int i = posicoes.getX1(); i < posicoes.getX2(); i++) {
		for (int j = posicoes.getY1(); j < posicoes.getY2(); j++) {
			raster.getPixel(i, j, pixels);
			rasterNewImage.setPixel(i, img.getHeight() - j, pixels);
		}
	}

	newImage.setData(rasterNewImage);

	return newImage;

}
 
开发者ID:nbfontana,项目名称:pdi,代码行数:18,代码来源:GiraImagem.java

示例4: girar

import java.awt.image.BufferedImage; //导入方法依赖的package包/类
public BufferedImage girar(BufferedImage img, PosicoesDTO posicoes) {
	WritableRaster raster = img.getRaster();
	BufferedImage newImage = new BufferedImage(img.getWidth(), img.getHeight(), BufferedImage.TYPE_INT_RGB);
	WritableRaster rasterNewImage = newImage.getRaster();
	int pixels[] = new int[4];
	for (int i = 1; i < img.getWidth() - 1; i++) {
		for (int j = 1; j < img.getHeight() - 1; j++) {
			raster.getPixel(i, j, pixels);
			rasterNewImage.setPixel(i, j, pixels);
		}
	}

	for (int i = posicoes.getX1(); i < posicoes.getX2(); i++) {
		int pixeisInvertidos = 0;
		for (int j = posicoes.getY1(); j < posicoes.getY2(); j++) {
			raster.getPixel(i, j, pixels);
			rasterNewImage.setPixel(i, posicoes.getY2() - pixeisInvertidos, pixels);
			pixeisInvertidos++;
		}
	}

	newImage.setData(rasterNewImage);

	return newImage;

}
 
开发者ID:nbfontana,项目名称:pdi,代码行数:27,代码来源:GiraImagemParcial.java

示例5: getNewImageInstance

import java.awt.image.BufferedImage; //导入方法依赖的package包/类
/**
 * Return a new instance of the BufferedImage
 * @return BufferedImage
 */
public BufferedImage getNewImageInstance(){
	BufferedImage buf = new BufferedImage(image.getWidth(),image.getHeight(), image.getType());
	buf.setData(image.getData());
	return buf;
}
 
开发者ID:Betalord,项目名称:BHBot,代码行数:10,代码来源:MarvinImage.java


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