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


Java LoadableImageData.getWidth方法代码示例

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


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

示例1: 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


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