本文整理匯總了Java中org.newdawn.slick.Image.getHeight方法的典型用法代碼示例。如果您正苦於以下問題:Java Image.getHeight方法的具體用法?Java Image.getHeight怎麽用?Java Image.getHeight使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.newdawn.slick.Image
的用法示例。
在下文中一共展示了Image.getHeight方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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/logo.png");
width = image.getWidth() / 3;
height = image.getHeight() / 3;
images = new Image[] {
image.getSubImage(0, 0, width, height), image.getSubImage(width,0,width,height), image.getSubImage(width*2,0,width,height),
image.getSubImage(0, height, width, height), image.getSubImage(width,height,width,height), image.getSubImage(width*2,height,width,height),
image.getSubImage(0, height*2, width, height), image.getSubImage(width,height*2,width,height), image.getSubImage(width*2,height*2,width,height),
};
images[0].setColor(Image.BOTTOM_RIGHT, 0,1,1,1);
images[1].setColor(Image.BOTTOM_LEFT, 0,1,1,1);
images[1].setColor(Image.BOTTOM_RIGHT, 0,1,1,1);
images[2].setColor(Image.BOTTOM_LEFT, 0,1,1,1);
images[3].setColor(Image.TOP_RIGHT, 0,1,1,1);
images[3].setColor(Image.BOTTOM_RIGHT, 0,1,1,1);
images[4].setColor(Image.TOP_RIGHT, 0,1,1,1);
images[4].setColor(Image.TOP_LEFT, 0,1,1,1);
images[4].setColor(Image.BOTTOM_LEFT, 0,1,1,1);
images[4].setColor(Image.BOTTOM_RIGHT, 0,1,1,1);
images[5].setColor(Image.TOP_LEFT, 0,1,1,1);
images[5].setColor(Image.BOTTOM_LEFT, 0,1,1,1);
images[6].setColor(Image.TOP_RIGHT, 0,1,1,1);
images[7].setColor(Image.TOP_RIGHT, 0,1,1,1);
images[7].setColor(Image.TOP_LEFT, 0,1,1,1);
images[8].setColor(Image.TOP_LEFT, 0,1,1,1);
}
示例2: LocatedImage
import org.newdawn.slick.Image; //導入方法依賴的package包/類
/**
* Create a new located image
*
* @param image The image to be drawn
* @param x The x location at which the image should be drawn
* @param y The y location at which the image should be drawn
*/
public LocatedImage(Image image, int x, int y) {
this.image = image;
this.x = x;
this.y = y;
this.width = image.getWidth();
this.height = image.getHeight();
}
示例3: render
import org.newdawn.slick.Image; //導入方法依賴的package包/類
@Override
public void render(Graphics g, long cTime) {
Image icon = getIcon();
if(isActive(cTime) && (icon != null)) {
float x = position.x - (icon.getWidth() / 2);
float y = position.y - (icon.getHeight() / 2);
g.drawImage(icon, x, y);
}
}
示例4: isTouching
import org.newdawn.slick.Image; //導入方法依賴的package包/類
public boolean isTouching(double distance) {
Image icon = getIcon();
if(icon != null) {
float width = icon.getWidth();
float height = icon.getHeight();
return (distance <= ((width + height) / 2));
} else return false;
}
示例5: 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();
}
示例6: MouseOverArea
import org.newdawn.slick.Image; //導入方法依賴的package包/類
/**
* Create a new mouse over area
*
* @param container
* The container displaying the mouse over area
* @param image
* The normalImage to display
* @param x
* The position of the area
* @param y
* the position of the area
* @param listener
* A listener to add to the area
*/
public MouseOverArea(GUIContext container, Image image, int x, int y, ComponentListener listener) {
this(container, image, x, y, image.getWidth(), image.getHeight());
addListener(listener);
}