本文整理汇总了Java中org.newdawn.slick.opengl.LoadableImageData类的典型用法代码示例。如果您正苦于以下问题:Java LoadableImageData类的具体用法?Java LoadableImageData怎么用?Java LoadableImageData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LoadableImageData类属于org.newdawn.slick.opengl包,在下文中一共展示了LoadableImageData类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: build
import org.newdawn.slick.opengl.LoadableImageData; //导入依赖的package包/类
/**
* Create a new big image by loading it from the specified reference
*
* @param ref The reference to the image to load
* @param filter The image filter to apply (@see #Image.FILTER_NEAREST)
* @param tileSize The maximum size of the tiles to use to build the bigger image
* @throws SlickException Indicates we were unable to locate the resource
*/
private void build(String ref, int filter, int tileSize) throws SlickException {
try {
final LoadableImageData data = ImageDataFactory.getImageDataFor(ref);
final ByteBuffer imageBuffer = data.loadImage(ResourceLoader.getResourceAsStream(ref), false, null);
build(data, imageBuffer, filter, tileSize);
} catch (IOException e) {
throw new SlickException("Failed to load: "+ref, e);
}
}
开发者ID:j-dong,项目名称:trashjam2017,代码行数:18,代码来源:BigImage.java
示例2: run
import org.newdawn.slick.opengl.LoadableImageData; //导入依赖的package包/类
@Override
public void run() {
// load image data into a ByteBuffer to use constructor Image(ImageData)
LoadableImageData imageData = ImageDataFactory.getImageDataFor(file.getAbsolutePath());
try (BufferedInputStream in = this.in = new BufferedInputStream(new FileInputStream(file))) {
ByteBuffer textureBuffer = imageData.loadImage(in, false, null);
if (!isInterrupted())
data = new LoadedImageData(imageData, textureBuffer);
} catch (Exception e) {
if (!isInterrupted())
Log.warn(String.format("Failed to load background image '%s'.", file), e);
}
this.in = null;
}
开发者ID:housq,项目名称:osu-beatmap-utils,代码行数:15,代码来源:ImageLoader.java
示例3: run
import org.newdawn.slick.opengl.LoadableImageData; //导入依赖的package包/类
@Override
public void run() {
// load image data into a ByteBuffer to use constructor Image(ImageData)
LoadableImageData imageData = ImageDataFactory.getImageDataFor(file.getAbsolutePath());
try (BufferedInputStream in = this.in = new BufferedInputStream(new FileInputStream(file))) {
ByteBuffer textureBuffer = imageData.loadImage(in, false, null);
if (!isInterrupted())
data = new LoadedImageData(imageData, textureBuffer);
} catch (IOException e) {
if (!isInterrupted())
Log.warn(String.format("Failed to load background image '%s'.", file), e);
}
this.in = null;
}
开发者ID:yugecin,项目名称:opsu-dance,代码行数:15,代码来源:ImageLoader.java
示例4: work
import org.newdawn.slick.opengl.LoadableImageData; //导入依赖的package包/类
@Override
public Object[] work(String resourceKey) throws PromiseException
{
// avoid the resource cache, AsyncTextureLoader has its own cache
InputStream in = db.getInputStreamSync(resourceKey);
ResourceDB.FileEntry fileEntry = db.getFileEntry(resourceKey);
if (in == null || fileEntry == null)
{
log.log(Level.SEVERE, "Unable to load texture, the given resource key ({0}) does not exist", resourceKey);
throw new InvalidResourceKeyException();
}
String fileName = fileEntry.zipEntry == null ? fileEntry.file.getName() : fileEntry.zipEntry;
LoadableImageData imageData = ImageDataFactory.getImageDataFor(fileName);
try
{
ByteBuffer textureBytes = imageData.loadImage(new BufferedInputStream(in), false, null);
if (textureBytes == null)
{
throw new IOException("loadImage returned null");
}
log.log(Level.INFO, "Texture data for {0} read. {1} {2} {3} {4} {5}", new Object[] {
resourceKey,
imageData.getWidth(),
imageData.getHeight(),
imageData.getDepth(),
imageData.getTexWidth(),
imageData.getTexHeight()
});
return new Object[] {
textureBytes,
imageData.getWidth(),
imageData.getHeight(),
imageData.getDepth(),
imageData.getTexWidth(),
imageData.getTexHeight()
};
}
catch (IOException | UnsatisfiedLinkError | UnsupportedOperationException ex)
{
log.log(Level.SEVERE, "Exception while parsing image for texture " + resourceKey, ex);
throw new PromiseException(ex);
}
}
开发者ID:Periapsis,项目名称:aphelion,代码行数:52,代码来源:AsyncTextureLoader.java
示例5: BigImage
import org.newdawn.slick.opengl.LoadableImageData; //导入依赖的package包/类
/**
* Create a new big image by loading it from the specified image data
*
* @param data The pixelData to use to create the image
* @param imageBuffer The buffer containing texture data
* @param filter The image filter to apply (@see #Image.FILTER_NEAREST)
*/
public BigImage(LoadableImageData data, ByteBuffer imageBuffer, int filter) {
build(data, imageBuffer, filter, getMaxSingleImageSize());
}
开发者ID:j-dong,项目名称:trashjam2017,代码行数:11,代码来源:BigImage.java
注:本文中的org.newdawn.slick.opengl.LoadableImageData类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论