本文整理汇总了Java中org.newdawn.slick.opengl.ImageData类的典型用法代码示例。如果您正苦于以下问题:Java ImageData类的具体用法?Java ImageData怎么用?Java ImageData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ImageData类属于org.newdawn.slick.opengl包,在下文中一共展示了ImageData类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import org.newdawn.slick.opengl.ImageData; //导入依赖的package包/类
@Override
public void init(GameContainer container) throws SlickException {
// Set up the rendering system
texture = PixelData.createTexture(container.getWidth(), container.getHeight(), ImageData.Format.RGB, Image.FILTER_NEAREST);
image = new Image(texture);
pixels = new PixelData(container.getWidth(), container.getHeight());
pixels.clear(0x00);
// Creates the Set
if(fractalType == MANDELBROT_SET) {
set = new Mandelbrot();
} else if(fractalType == JULIA_SET) {
set = new Julia(constantReal, constantImaginary);
}
// Calculates the first frame
pixels = set.updateSet(container, pixels, zoom, maxIterations, xOffset, yOffset, colorFactor);
// Updates the texture
pixels.apply(texture);
}
示例2: setMouseCursor
import org.newdawn.slick.opengl.ImageData; //导入依赖的package包/类
/**
* @see org.newdawn.slick.GameContainer#setMouseCursor(org.newdawn.slick.opengl.ImageData, int, int)
*/
public void setMouseCursor(ImageData data, int hotSpotX, int hotSpotY) throws SlickException {
try {
Cursor cursor = CursorLoader.get().getCursor(data, hotSpotX, hotSpotY);
Mouse.setNativeCursor(cursor);
} catch (Throwable e) {
Log.error("Failed to load and apply cursor.", e);
throw new SlickException("Failed to set mouse cursor", e);
}
}
示例3: setMouseCursor
import org.newdawn.slick.opengl.ImageData; //导入依赖的package包/类
/**
* @see org.newdawn.slick.GameContainer#setMouseCursor(org.newdawn.slick.opengl.ImageData, int, int)
*/
public void setMouseCursor(ImageData data, int hotSpotX, int hotSpotY) throws SlickException {
try {
Cursor cursor = CursorLoader.get().getCursor(data, hotSpotX, hotSpotY);
Mouse.setNativeCursor(cursor);
} catch (Throwable e) {
Log.error("Failed to load and apply cursor.", e);
throw new SlickException("Failed to set mouse cursor", e);
}
}
示例4: Image
import org.newdawn.slick.opengl.ImageData; //导入依赖的package包/类
/**
* Create an image from a image data source. Note that this method uses
*
* @param data The pixelData to use to create the image
* @param f The filter to use when scaling this image
*/
public Image(ImageData data, int f) {
try {
this.filter = f == FILTER_LINEAR ? SGL.GL_LINEAR : SGL.GL_NEAREST;
texture = InternalTextureLoader.get().getTexture(data, this.filter);
ref = texture.toString();
} catch (IOException e) {
Log.error(e);
}
}
示例5: setMouseCursor
import org.newdawn.slick.opengl.ImageData; //导入依赖的package包/类
/**
* @see org.newdawn.slick.GameContainer#setMouseCursor(org.newdawn.slick.opengl.ImageData, int, int)
*/
public void setMouseCursor(ImageData data, int hotSpotX, int hotSpotY) throws SlickException {
try {
Cursor cursor = CursorLoader.get().getCursor(data, hotSpotX, hotSpotY);
Mouse.setNativeCursor(cursor);
} catch (Exception e) {
Log.error("Failed to load and apply cursor.", e);
}
}
示例6: setMouseCursor
import org.newdawn.slick.opengl.ImageData; //导入依赖的package包/类
/**
* @see org.newdawn.slick.GameContainer#setMouseCursor(org.newdawn.slick.opengl.ImageData, int, int)
*/
public void setMouseCursor(ImageData data, int hotSpotX, int hotSpotY) throws SlickException {
try {
Cursor cursor = CursorLoader.get().getCursor(data, hotSpotX, hotSpotY);
Mouse.setNativeCursor(cursor);
} catch (Exception e) {
Log.error("Failed to load and apply cursor.", e);
}
}
示例7: setMouseCursor
import org.newdawn.slick.opengl.ImageData; //导入依赖的package包/类
/**
* Set the mouse cursor to be displayed - this is a hardware cursor and hence shouldn't have any impact of FPS.
*
* @param data The cursor to be used
* @param hotSpotX The x offset of the cursor
* @param hotSpotY The y offset of the cursor
*/
public static void setMouseCursor(ImageData data, int hotSpotX, int hotSpotY){
if(appgc == null){
return;
}
try{
appgc.setMouseCursor(data, hotSpotX, hotSpotY);
}catch(SlickException e){
Logger.getLogger(Game.class.getName()).log(Level.WARNING, "Could Not Set Mouse Cursor " + data.toString(), e);
}
}
示例8: Image
import org.newdawn.slick.opengl.ImageData; //导入依赖的package包/类
/**
* Create an image from a image data source. Note that this method uses
*
* @param data The pixelData to use to create the image
* @param f The filter to use when scaling this image
*/
private Image(@Nonnull ImageData data, int f) {
try {
this.filter = f;
texture = InternalTextureLoader.get().getTexture(data, this.filter);
ref = texture.toString();
} catch (IOException e) {
Log.error(e);
}
}
示例9: createTexture
import org.newdawn.slick.opengl.ImageData; //导入依赖的package包/类
/**
* Convenience method to create a texture with a given internal format.
* @param width the width of the empty texture
* @param height the height of the empty texture
* @param filter the filter to use
* @param format the internal format
* @return a generated texture
*/
public static Texture createTexture(int width, int height, ImageData.Format format, int filter) throws SlickException {
EmptyImageData data = new EmptyImageData(width, height);
ByteBuffer dataBuffer = data.getImageBufferData();
String ref = "pixelhandler:"+width+"x"+height+":"+format.toString();
try {
return InternalTextureLoader.get().createTexture(data, dataBuffer, ref,
GL11.GL_TEXTURE_2D, filter, filter, false, format);
} catch (IOException e) {
throw new SlickException("Error generating texture", e);
}
}
示例10: PixelData
import org.newdawn.slick.opengl.ImageData; //导入依赖的package包/类
/**
* Creates a PixelData buffer with the specified size and format.
*
* Note that Slick currently loads textures with an internal RGBA format;
* this means that even if we upload, say, 2-component (e.g. GRAYALPHA)
* texture data, it will eventually be stored in OpenGL video memory
* using RGBA. For better performance and memory management,
* create textures with the same internal format as the format given to PixelData.
* The static 'createTexture' utility method is intended for this purpose.
*
* Also note that most drivers will expand formats to RGBA internally, so this optimization may
* not be necessary.
*
* @param width the width in pixels of our data
* @param height the height in pixels of our data
* @param format the desired format to use during uploading (RGB, RGBA, GRAY, GRAYALPHA, ALPHA)
*/
public PixelData(int width, int height, ImageData.Format format) {
this.format = format;
this.width = width;
this.height = height;
this.pixels = BufferUtils.createByteBuffer(width * height * format.getColorComponents());
}
示例11: setMouseCursor
import org.newdawn.slick.opengl.ImageData; //导入依赖的package包/类
/**
* Set the mouse cursor to be displayed - this is a hardware cursor and hence
* shouldn't have any impact on FPS.
*
* @param data The image data from which the cursor can be construted
* @param hotSpotX The x coordinate of the hotspot within the cursor image
* @param hotSpotY The y coordinate of the hotspot within the cursor image
* @throws SlickException Indicates a failure to load the cursor image or create the hardware cursor
*/
public abstract void setMouseCursor(ImageData data, int hotSpotX, int hotSpotY) throws SlickException;