本文整理汇总了Java中org.andengine.opengl.util.GLHelper类的典型用法代码示例。如果您正苦于以下问题:Java GLHelper类的具体用法?Java GLHelper怎么用?Java GLHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GLHelper类属于org.andengine.opengl.util包,在下文中一共展示了GLHelper类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: grab
import org.andengine.opengl.util.GLHelper; //导入依赖的package包/类
private static Bitmap grab(final int pGrabX, final int pGrabY, final int pGrabWidth, final int pGrabHeight) {
final int[] pixelsRGBA_8888 = new int[pGrabWidth * pGrabHeight];
final IntBuffer pixelsRGBA_8888_Buffer = IntBuffer.wrap(pixelsRGBA_8888);
// TODO Check availability of OpenGL and GLES20.GL_RGBA combinations that require less conversion operations.
GLES20.glReadPixels(pGrabX, pGrabY, pGrabWidth, pGrabHeight, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, pixelsRGBA_8888_Buffer);
/* Convert from RGBA_8888 (Which is actually ABGR as the whole buffer seems to be inverted) --> ARGB_8888. */
final int[] pixelsARGB_8888 = GLHelper.convertRGBA_8888toARGB_8888(pixelsRGBA_8888);
return Bitmap.createBitmap(pixelsARGB_8888, pGrabWidth, pGrabHeight, Config.ARGB_8888);
}
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:13,代码来源:ScreenGrabber.java
示例2: getPixelsARGB_8888
import org.andengine.opengl.util.GLHelper; //导入依赖的package包/类
public int[] getPixelsARGB_8888(final GLState pGLState, final int pX, final int pY, final int pWidth, final int pHeight) {
final int[] pixelsRGBA_8888 = new int[pWidth * pHeight];
final IntBuffer glPixelBuffer = IntBuffer.wrap(pixelsRGBA_8888);
glPixelBuffer.position(0);
this.begin(pGLState);
GLES20.glReadPixels(pX, pY, pWidth, pHeight, this.mPixelFormat.getGLFormat(), this.mPixelFormat.getGLType(), glPixelBuffer);
this.end(pGLState);
return GLHelper.convertRGBA_8888toARGB_8888(pixelsRGBA_8888);
}
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:12,代码来源:RenderTexture.java
示例3: swapColorARGB_8888
import org.andengine.opengl.util.GLHelper; //导入依赖的package包/类
protected static final Bitmap swapColorARGB_8888(final Bitmap pBitmap, final int pColorKeyColorARGBPackedInt, final int pTolerance, final int pColorSwapColorARGBPackedInt) {
final int[] pixelsARGB_8888 = GLHelper.getPixelsARGB_8888(pBitmap);
pBitmap.recycle();
final int keyRed = (pColorKeyColorARGBPackedInt >> Color.ARGB_PACKED_RED_SHIFT) & 0xFF;
final int keyGreen = (pColorKeyColorARGBPackedInt >> Color.ARGB_PACKED_GREEN_SHIFT) & 0xFF;
final int keyBlue = (pColorKeyColorARGBPackedInt >> Color.ARGB_PACKED_BLUE_SHIFT) & 0xFF;
final int keyAlpha = (pColorKeyColorARGBPackedInt >> Color.ARGB_PACKED_ALPHA_SHIFT) & 0xFF;
for (int i = pixelsARGB_8888.length - 1; i >= 0; i--) {
final int pixelARGB_8888 = pixelsARGB_8888[i];
final int red = (pixelARGB_8888 >> Color.ARGB_PACKED_RED_SHIFT) & 0xFF;
if (Math.abs(red - keyRed) <= pTolerance) {
final int green = (pixelARGB_8888 >> Color.ARGB_PACKED_GREEN_SHIFT) & 0xFF;
if (Math.abs(green - keyGreen) <= pTolerance) {
final int blue = (pixelARGB_8888 >> Color.ARGB_PACKED_BLUE_SHIFT) & 0xFF;
if (Math.abs(blue - keyBlue) <= pTolerance) {
final int alpha = (pixelARGB_8888 >> Color.ARGB_PACKED_ALPHA_SHIFT) & 0xFF;
if (Math.abs(alpha - keyAlpha) <= pTolerance) {
pixelsARGB_8888[i] = pColorSwapColorARGBPackedInt;
}
}
}
}
}
return Bitmap.createBitmap(pixelsARGB_8888, pBitmap.getWidth(), pBitmap.getHeight(), Config.ARGB_8888);
}
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:30,代码来源:ColorSwapBitmapTextureAtlasSource.java
注:本文中的org.andengine.opengl.util.GLHelper类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论