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


Java Image.getColor方法代码示例

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


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

示例1: init

import org.newdawn.slick.Image; //导入方法依赖的package包/类
/**
 * @see org.newdawn.slick.BasicGame#init(org.newdawn.slick.GameContainer)
 */
public void init(GameContainer container) throws SlickException {
	image = new Image("testdata/testcard.png");
	read[0] = image.getColor(0, 0);
	read[1] = image.getColor(30, 40);
	read[2] = image.getColor(55, 70);
	read[3] = image.getColor(80, 90);
}
 
开发者ID:j-dong,项目名称:trashjam2017,代码行数:11,代码来源:ImageReadTest.java

示例2: isCollision

import org.newdawn.slick.Image; //导入方法依赖的package包/类
private boolean isCollision(float x, float y) {
	int tileW = this.map.getTileWidth();
	int tileH = this.map.getTileHeight();
	int logicLayer = this.map.getLayerIndex("obstacles");
	Image tile = this.map.getTileImage((int) x / tileW, (int) y / tileH, logicLayer);
	boolean collision = tile != null;
	if (collision) {
		Color color = tile.getColor((int) x % tileW, (int) y % tileH);
		collision = color.getAlpha() > 0;
	}
	return collision;
}
 
开发者ID:EnzoMolion,项目名称:Projet-PLA,代码行数:13,代码来源:WindowGame.java

示例3: saveImage

import org.newdawn.slick.Image; //导入方法依赖的package包/类
/**
 * @see org.newdawn.slick.imageout.ImageWriter#saveImage(org.newdawn.slick.Image, java.lang.String, java.io.OutputStream, boolean)
 */
public void saveImage(Image image, String format, OutputStream output, boolean writeAlpha) throws IOException {
	DataOutputStream out = new DataOutputStream(new BufferedOutputStream(output));

	// ID Length
	out.writeByte((byte) 0);

	// Color Map
	out.writeByte((byte) 0);

	// Image Type
	out.writeByte((byte) 2);

	// Color Map - Ignored
	out.writeShort(flipEndian((short) 0));
	out.writeShort(flipEndian((short) 0));
	out.writeByte((byte) 0);

	// X, Y Offset
	out.writeShort(flipEndian((short) 0));
	out.writeShort(flipEndian((short) 0));

	// Width, Height, Depth
	out.writeShort(flipEndian((short) image.getWidth()));
	out.writeShort(flipEndian((short) image.getHeight()));
	if (writeAlpha) {
		out.writeByte((byte) 32);
		// Image Descriptor (can't be 0 since we're using 32-bit TGAs)
		// needs to not have 0x20 set to indicate it's not a flipped image
		out.writeByte((byte) 1);
	} else {
		out.writeByte((byte) 24);
		// Image Descriptor (must be 0 since we're using 24-bit TGAs)
		// needs to not have 0x20 set to indicate it's not a flipped image
		out.writeByte((byte) 0);
	}
	

	// Write out the image data
	Color c;

	for (int y = image.getHeight()-1; y <= 0; y--) {
		for (int x = 0; x < image.getWidth(); x++) {
			c = image.getColor(x, y);

			out.writeByte((byte) (c.b * 255.0f));
			out.writeByte((byte) (c.g * 255.0f));
			out.writeByte((byte) (c.r * 255.0f));
			if (writeAlpha) {
				out.writeByte((byte) (c.a * 255.0f));
			}
		}
	}

	out.close();
}
 
开发者ID:j-dong,项目名称:trashjam2017,代码行数:59,代码来源:TGAWriter.java


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