• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java NullBitmapException类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.andengine.util.exception.NullBitmapException的典型用法代码示例。如果您正苦于以下问题:Java NullBitmapException类的具体用法?Java NullBitmapException怎么用?Java NullBitmapException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



NullBitmapException类属于org.andengine.util.exception包,在下文中一共展示了NullBitmapException类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: writeTextureToHardware

import org.andengine.util.exception.NullBitmapException; //导入依赖的package包/类
@Override
protected void writeTextureToHardware(final GLState pGLState) throws IOException {
	final Config bitmapConfig = this.mBitmapTextureFormat.getBitmapConfig();
	final Bitmap bitmap = this.onGetBitmap(bitmapConfig);

	if (bitmap == null) {
		throw new NullBitmapException("Caused by: '" + this.toString() + "'.");
	}

	final boolean useDefaultAlignment = MathUtils.isPowerOfTwo(bitmap.getWidth()) && MathUtils.isPowerOfTwo(bitmap.getHeight()) && (this.mPixelFormat == PixelFormat.RGBA_8888);
	if (!useDefaultAlignment) {
		/* Adjust unpack alignment. */
		GLES20.glPixelStorei(GLES20.GL_UNPACK_ALIGNMENT, 1);
	}

	final boolean preMultipyAlpha = this.mTextureOptions.mPreMultiplyAlpha;
	if (preMultipyAlpha) {
		GLUtils.texImage2D(GLES20.GL_TEXTURE_2D, 0, bitmap, 0);
	} else {
		pGLState.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, bitmap, 0, this.mPixelFormat);
	}

	if (!useDefaultAlignment) {
		/* Restore default unpack alignment. */
		GLES20.glPixelStorei(GLES20.GL_UNPACK_ALIGNMENT, GLState.GL_UNPACK_ALIGNMENT_DEFAULT);
	}

	bitmap.recycle();
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:30,代码来源:BitmapTexture.java


示例2: writeTextureToHardware

import org.andengine.util.exception.NullBitmapException; //导入依赖的package包/类
@Override
protected void writeTextureToHardware(final GLState pGLState) throws IOException {
	final Config bitmapConfig = this.mBitmapTextureFormat.getBitmapConfig();
	final Bitmap bitmap = this.onGetBitmap(bitmapConfig);

	if(bitmap == null) {
		throw new NullBitmapException("Caused by: '" + this.toString() + "'.");
	}

	final boolean useDefaultAlignment = MathUtils.isPowerOfTwo(bitmap.getWidth()) && MathUtils.isPowerOfTwo(bitmap.getHeight()) && (this.mPixelFormat == PixelFormat.RGBA_8888);
	if(!useDefaultAlignment) {
		/* Adjust unpack alignment. */
		GLES20.glPixelStorei(GLES20.GL_UNPACK_ALIGNMENT, 1);
	}

	final boolean preMultipyAlpha = this.mTextureOptions.mPreMultiplyAlpha;
	if(preMultipyAlpha) {
		GLUtils.texImage2D(GLES20.GL_TEXTURE_2D, 0, bitmap, 0);
	} else {
		pGLState.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, bitmap, 0, this.mPixelFormat);
	}

	if(!useDefaultAlignment) {
		/* Restore default unpack alignment. */
		GLES20.glPixelStorei(GLES20.GL_UNPACK_ALIGNMENT, GLState.GL_UNPACK_ALIGNMENT_DEFAULT);
	}

	bitmap.recycle();
}
 
开发者ID:peterchaula,项目名称:ClassicF1,代码行数:30,代码来源:BitmapTexture.java


示例3: writeTextureToHardware

import org.andengine.util.exception.NullBitmapException; //导入依赖的package包/类
@Override
protected void writeTextureToHardware(final GLState pGLState) {
	final PixelFormat pixelFormat = this.mBitmapTextureFormat.getPixelFormat();
	final int glInternalFormat = pixelFormat.getGLInternalFormat();
	final int glFormat = pixelFormat.getGLFormat();
	final int glType = pixelFormat.getGLType();

	GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, glInternalFormat, this.mWidth, this.mHeight, 0, glFormat, glType, null);

	final boolean preMultipyAlpha = this.mTextureOptions.mPreMultiplyAlpha;
	/* Non alpha premultiplied bitmaps are loaded with ARGB_8888 and converted down manually. */
	final Config bitmapConfig = (preMultipyAlpha) ? this.mBitmapTextureFormat.getBitmapConfig() : Config.ARGB_8888;

	final ArrayList<IBitmapTextureAtlasSource> textureSources = this.mTextureAtlasSources;
	final int textureSourceCount = textureSources.size();

	final ITextureAtlasStateListener<IBitmapTextureAtlasSource> textureStateListener = this.getTextureAtlasStateListener();
	for (int i = 0; i < textureSourceCount; i++) {
		final IBitmapTextureAtlasSource bitmapTextureAtlasSource = textureSources.get(i);
		try {
			final Bitmap bitmap = bitmapTextureAtlasSource.onLoadBitmap(bitmapConfig);
			if (bitmap == null) {
				throw new NullBitmapException("Caused by: " + bitmapTextureAtlasSource.getClass().toString() + " --> " + bitmapTextureAtlasSource.toString() + " returned a null Bitmap.");
			}

			final boolean useDefaultAlignment = MathUtils.isPowerOfTwo(bitmap.getWidth()) && MathUtils.isPowerOfTwo(bitmap.getHeight()) && pixelFormat == PixelFormat.RGBA_8888;
			if (!useDefaultAlignment) {
				/* Adjust unpack alignment. */
				GLES20.glPixelStorei(GLES20.GL_UNPACK_ALIGNMENT, 1);
			}

			if (preMultipyAlpha) {
				GLUtils.texSubImage2D(GLES20.GL_TEXTURE_2D, 0, bitmapTextureAtlasSource.getTextureX(), bitmapTextureAtlasSource.getTextureY(), bitmap, glFormat, glType);
			} else {
				pGLState.glTexSubImage2D(GLES20.GL_TEXTURE_2D, 0, bitmapTextureAtlasSource.getTextureX(), bitmapTextureAtlasSource.getTextureY(), bitmap, this.mPixelFormat);
			}

			if (!useDefaultAlignment) {
				/* Restore default unpack alignment. */
				GLES20.glPixelStorei(GLES20.GL_UNPACK_ALIGNMENT, GLState.GL_UNPACK_ALIGNMENT_DEFAULT);
			}

			bitmap.recycle();

			if (textureStateListener != null) {
				textureStateListener.onTextureAtlasSourceLoaded(this, bitmapTextureAtlasSource);
			}
		} catch (final NullBitmapException e) {
			if (textureStateListener != null) {
				textureStateListener.onTextureAtlasSourceLoadExeption(this, bitmapTextureAtlasSource, e);
			} else {
				throw e;
			}
		}
	}
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:57,代码来源:BitmapTextureAtlas.java


示例4: writeTextureToHardware

import org.andengine.util.exception.NullBitmapException; //导入依赖的package包/类
@Override
protected void writeTextureToHardware(final GLState pGLState) {
	final PixelFormat pixelFormat = this.mBitmapTextureFormat.getPixelFormat();
	final int glInternalFormat = pixelFormat.getGLInternalFormat();
	final int glFormat = pixelFormat.getGLFormat();
	final int glType = pixelFormat.getGLType();

	GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, glInternalFormat, this.mWidth, this.mHeight, 0, glFormat, glType, null);

	final boolean preMultipyAlpha = this.mTextureOptions.mPreMultiplyAlpha;
	/* Non alpha premultiplied bitmaps are loaded with ARGB_8888 and converted down manually. */
	final Config bitmapConfig = (preMultipyAlpha) ? this.mBitmapTextureFormat.getBitmapConfig() : Config.ARGB_8888;

	final ArrayList<IBitmapTextureAtlasSource> textureSources = this.mTextureAtlasSources;
	final int textureSourceCount = textureSources.size();

	final ITextureAtlasStateListener<IBitmapTextureAtlasSource> textureStateListener = this.getTextureAtlasStateListener();
	for(int i = 0; i < textureSourceCount; i++) {
		final IBitmapTextureAtlasSource bitmapTextureAtlasSource = textureSources.get(i);
		try {
			final Bitmap bitmap = bitmapTextureAtlasSource.onLoadBitmap(bitmapConfig);
			if(bitmap == null) {
				throw new NullBitmapException("Caused by: " + bitmapTextureAtlasSource.getClass().toString() + " --> " + bitmapTextureAtlasSource.toString() + " returned a null Bitmap.");
			}

			final boolean useDefaultAlignment = MathUtils.isPowerOfTwo(bitmap.getWidth()) && MathUtils.isPowerOfTwo(bitmap.getHeight()) && pixelFormat == PixelFormat.RGBA_8888;
			if(!useDefaultAlignment) {
				/* Adjust unpack alignment. */
				GLES20.glPixelStorei(GLES20.GL_UNPACK_ALIGNMENT, 1);
			}

			if(preMultipyAlpha) {
				GLUtils.texSubImage2D(GLES20.GL_TEXTURE_2D, 0, bitmapTextureAtlasSource.getTextureX(), bitmapTextureAtlasSource.getTextureY(), bitmap, glFormat, glType);
			} else {
				pGLState.glTexSubImage2D(GLES20.GL_TEXTURE_2D, 0, bitmapTextureAtlasSource.getTextureX(), bitmapTextureAtlasSource.getTextureY(), bitmap, this.mPixelFormat);
			}

			if(!useDefaultAlignment) {
				/* Restore default unpack alignment. */
				GLES20.glPixelStorei(GLES20.GL_UNPACK_ALIGNMENT, GLState.GL_UNPACK_ALIGNMENT_DEFAULT);
			}

			bitmap.recycle();

			if(textureStateListener != null) {
				textureStateListener.onTextureAtlasSourceLoaded(this, bitmapTextureAtlasSource);
			}
		} catch (final NullBitmapException e) {
			if(textureStateListener != null) {
				textureStateListener.onTextureAtlasSourceLoadExeption(this, bitmapTextureAtlasSource, e);
			} else {
				throw e;
			}
		}
	}
}
 
开发者ID:peterchaula,项目名称:ClassicF1,代码行数:57,代码来源:BitmapTextureAtlas.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java NormalAnnotationExpr类代码示例发布时间:2022-05-23
下一篇:
Java StatusTextEvent类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap