本文整理汇总了Java中org.andengine.opengl.texture.atlas.bitmap.source.IBitmapTextureAtlasSource类的典型用法代码示例。如果您正苦于以下问题:Java IBitmapTextureAtlasSource类的具体用法?Java IBitmapTextureAtlasSource怎么用?Java IBitmapTextureAtlasSource使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IBitmapTextureAtlasSource类属于org.andengine.opengl.texture.atlas.bitmap.source包,在下文中一共展示了IBitmapTextureAtlasSource类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: LinearGradientFillBitmapTextureAtlasSourceDecorator
import org.andengine.opengl.texture.atlas.bitmap.source.IBitmapTextureAtlasSource; //导入依赖的package包/类
public LinearGradientFillBitmapTextureAtlasSourceDecorator(final IBitmapTextureAtlasSource pBitmapTextureAtlasSource, final IBitmapTextureAtlasSourceDecoratorShape pBitmapTextureAtlasSourceDecoratorShape, final int[] pColors, final float[] pPositions, final LinearGradientDirection pLinearGradientDirection, final TextureAtlasSourceDecoratorOptions pTextureAtlasSourceDecoratorOptions) {
super(pBitmapTextureAtlasSource, pBitmapTextureAtlasSourceDecoratorShape, pTextureAtlasSourceDecoratorOptions);
this.mColors = pColors;
this.mPositions = pPositions;
this.mLinearGradientDirection = pLinearGradientDirection;
this.mPaint.setStyle(Style.FILL);
final int right = pBitmapTextureAtlasSource.getTextureWidth() - 1;
final int bottom = pBitmapTextureAtlasSource.getTextureHeight() - 1;
final float fromX = pLinearGradientDirection.getFromX(right);
final float fromY = pLinearGradientDirection.getFromY(bottom);
final float toX = pLinearGradientDirection.getToX(right);
final float toY = pLinearGradientDirection.getToY(bottom);
this.mPaint.setShader(new LinearGradient(fromX, fromY, toX, toY, pColors, pPositions, TileMode.CLAMP));
}
开发者ID:mediamonks,项目名称:tilt-game-android,代码行数:19,代码来源:LinearGradientFillBitmapTextureAtlasSourceDecorator.java
示例2: RadialGradientFillBitmapTextureAtlasSourceDecorator
import org.andengine.opengl.texture.atlas.bitmap.source.IBitmapTextureAtlasSource; //导入依赖的package包/类
public RadialGradientFillBitmapTextureAtlasSourceDecorator(final IBitmapTextureAtlasSource pBitmapTextureAtlasSource, final IBitmapTextureAtlasSourceDecoratorShape pBitmapTextureAtlasSourceDecoratorShape, final int[] pColors, final float[] pPositions, final RadialGradientDirection pRadialGradientDirection, final TextureAtlasSourceDecoratorOptions pTextureAtlasSourceDecoratorOptions) {
super(pBitmapTextureAtlasSource, pBitmapTextureAtlasSourceDecoratorShape, pTextureAtlasSourceDecoratorOptions);
this.mColors = pColors;
this.mPositions = pPositions;
this.mRadialGradientDirection = pRadialGradientDirection;
this.mPaint.setStyle(Style.FILL);
final int width = pBitmapTextureAtlasSource.getTextureWidth();
final int height = pBitmapTextureAtlasSource.getTextureHeight();
final float centerX = width * 0.5f;
final float centerY = height * 0.5f;
final float radius = Math.max(centerX, centerY);
switch(pRadialGradientDirection) {
case INSIDE_OUT:
this.mPaint.setShader(new RadialGradient(centerX, centerY, radius, pColors, pPositions, TileMode.CLAMP));
break;
case OUTSIDE_IN:
ArrayUtils.reverse(pColors);
this.mPaint.setShader(new RadialGradient(centerX, centerY, radius, pColors, pPositions, TileMode.CLAMP));
break;
}
}
开发者ID:peterchaula,项目名称:ClassicF1,代码行数:27,代码来源:RadialGradientFillBitmapTextureAtlasSourceDecorator.java
示例3: RadialGradientFillBitmapTextureAtlasSourceDecorator
import org.andengine.opengl.texture.atlas.bitmap.source.IBitmapTextureAtlasSource; //导入依赖的package包/类
public RadialGradientFillBitmapTextureAtlasSourceDecorator(final IBitmapTextureAtlasSource pBitmapTextureAtlasSource, final IBitmapTextureAtlasSourceDecoratorShape pBitmapTextureAtlasSourceDecoratorShape, final int[] pColors, final float[] pPositions, final RadialGradientDirection pRadialGradientDirection, final TextureAtlasSourceDecoratorOptions pTextureAtlasSourceDecoratorOptions) {
super(pBitmapTextureAtlasSource, pBitmapTextureAtlasSourceDecoratorShape, pTextureAtlasSourceDecoratorOptions);
this.mColors = pColors;
this.mPositions = pPositions;
this.mRadialGradientDirection = pRadialGradientDirection;
this.mPaint.setStyle(Style.FILL);
final int width = pBitmapTextureAtlasSource.getTextureWidth();
final int height = pBitmapTextureAtlasSource.getTextureHeight();
final float centerX = width * 0.5f;
final float centerY = height * 0.5f;
final float radius = Math.max(centerX, centerY);
switch (pRadialGradientDirection) {
case INSIDE_OUT:
this.mPaint.setShader(new RadialGradient(centerX, centerY, radius, pColors, pPositions, TileMode.CLAMP));
break;
case OUTSIDE_IN:
ArrayUtils.reverse(pColors);
this.mPaint.setShader(new RadialGradient(centerX, centerY, radius, pColors, pPositions, TileMode.CLAMP));
break;
}
}
开发者ID:mediamonks,项目名称:tilt-game-android,代码行数:27,代码来源:RadialGradientFillBitmapTextureAtlasSourceDecorator.java
示例4: OutlineBitmapTextureAtlasSourceDecorator
import org.andengine.opengl.texture.atlas.bitmap.source.IBitmapTextureAtlasSource; //导入依赖的package包/类
public OutlineBitmapTextureAtlasSourceDecorator(final IBitmapTextureAtlasSource pBitmapTextureAtlasSource, final IBitmapTextureAtlasSourceDecoratorShape pBitmapTextureAtlasSourceDecoratorShape, final int pOutlineColor, final TextureAtlasSourceDecoratorOptions pTextureAtlasSourceDecoratorOptions) {
super(pBitmapTextureAtlasSource, pBitmapTextureAtlasSourceDecoratorShape, pTextureAtlasSourceDecoratorOptions);
this.mOutlineColor = pOutlineColor;
this.mPaint.setStyle(Style.STROKE);
this.mPaint.setColor(pOutlineColor);
}
示例5: FillBitmapTextureAtlasSourceDecorator
import org.andengine.opengl.texture.atlas.bitmap.source.IBitmapTextureAtlasSource; //导入依赖的package包/类
public FillBitmapTextureAtlasSourceDecorator(final IBitmapTextureAtlasSource pBitmapTextureAtlasSource, final IBitmapTextureAtlasSourceDecoratorShape pBitmapTextureAtlasSourceDecoratorShape, final int pFillColor, final TextureAtlasSourceDecoratorOptions pTextureAtlasSourceDecoratorOptions) {
super(pBitmapTextureAtlasSource, pBitmapTextureAtlasSourceDecoratorShape, pTextureAtlasSourceDecoratorOptions);
this.mFillColor = pFillColor;
this.mPaint.setStyle(Style.FILL);
this.mPaint.setColor(pFillColor);
}
示例6: ColorSwapBitmapTextureAtlasSourceDecorator
import org.andengine.opengl.texture.atlas.bitmap.source.IBitmapTextureAtlasSource; //导入依赖的package包/类
public ColorSwapBitmapTextureAtlasSourceDecorator(final IBitmapTextureAtlasSource pBitmapTextureAtlasSource, final IBitmapTextureAtlasSourceDecoratorShape pBitmapTextureAtlasSourceDecoratorShape, final int pColorKeyColorARGBPackedInt, final int pTolerance, final int pColorSwapColorARGBPackedInt, final TextureAtlasSourceDecoratorOptions pTextureAtlasSourceDecoratorOptions) {
super(pBitmapTextureAtlasSource, pBitmapTextureAtlasSourceDecoratorShape, pTextureAtlasSourceDecoratorOptions);
this.mColorKeyColorARGBPackedInt = pColorKeyColorARGBPackedInt;
this.mTolerance = pTolerance;
this.mColorSwapColorARGBPackedInt = pColorSwapColorARGBPackedInt;
this.mPaint.setXfermode(new AvoidXfermode(pColorKeyColorARGBPackedInt, pTolerance, Mode.TARGET));
this.mPaint.setColor(pColorSwapColorARGBPackedInt);
if (SystemUtils.isAndroidVersionOrHigher(Build.VERSION_CODES.JELLY_BEAN)) {
Debug.w("The class " + ColorSwapBitmapTextureAtlasSourceDecorator.class.getSimpleName() + " is deprecated for Android API Level: '" + Build.VERSION_CODES.JELLY_BEAN + "' and higher, since the class " + AvoidXfermode.class.getSimpleName() + " is deprecated since then.");
}
}
开发者ID:mediamonks,项目名称:tilt-game-android,代码行数:14,代码来源:ColorSwapBitmapTextureAtlasSourceDecorator.java
示例7: ColorSwapBitmapTextureAtlasSourceDecorator
import org.andengine.opengl.texture.atlas.bitmap.source.IBitmapTextureAtlasSource; //导入依赖的package包/类
public ColorSwapBitmapTextureAtlasSourceDecorator(final IBitmapTextureAtlasSource pBitmapTextureAtlasSource, final IBitmapTextureAtlasSourceDecoratorShape pBitmapTextureAtlasSourceDecoratorShape, final int pColorKeyColorARGBPackedInt, final int pTolerance, final int pColorSwapColorARGBPackedInt, final TextureAtlasSourceDecoratorOptions pTextureAtlasSourceDecoratorOptions) {
super(pBitmapTextureAtlasSource, pBitmapTextureAtlasSourceDecoratorShape, pTextureAtlasSourceDecoratorOptions);
this.mColorKeyColorARGBPackedInt = pColorKeyColorARGBPackedInt;
this.mTolerance = pTolerance;
this.mColorSwapColorARGBPackedInt = pColorSwapColorARGBPackedInt;
this.mPaint.setXfermode(new AvoidXfermode(pColorKeyColorARGBPackedInt, pTolerance, Mode.TARGET));
this.mPaint.setColor(pColorSwapColorARGBPackedInt);
}
示例8: createBackground
import org.andengine.opengl.texture.atlas.bitmap.source.IBitmapTextureAtlasSource; //导入依赖的package包/类
private void createBackground(final Bitmap background, @Nullable final String backgroundUrl) {
if (background == null) return;
BitmapTextureAtlas bitmapTextureAtlas = new BitmapTextureAtlas(_engine.getTextureManager(), _width, _height, TextureOptions.BILINEAR);
IBitmapTextureAtlasSource baseTextureSource = new EmptyBitmapTextureAtlasSource(_width, _height);
final IBitmapTextureAtlasSource bitmapTextureAtlasSource = new BaseBitmapTextureAtlasSourceDecorator(baseTextureSource) {
@Override
protected void onDecorateBitmap(Canvas pCanvas) throws Exception {
if (backgroundUrl != null) {
Bitmap template = BitmapFactory.decodeStream(GoogleFlipGameApplication.sContext.getAssets().open(backgroundUrl));
pCanvas.drawBitmap(template, 0, 0, mPaint);
}
pCanvas.drawColor(_backgroundColor);
pCanvas.drawBitmap(background, 0, 0, mPaint);
}
@Override
public BaseBitmapTextureAtlasSourceDecorator deepCopy() {
throw new IModifier.DeepCopyNotSupportedException();
}
};
ITextureRegion mDecoratedBalloonTextureRegion = BitmapTextureAtlasTextureRegionFactory.createFromSource(bitmapTextureAtlas, bitmapTextureAtlasSource,
0, 0);
bitmapTextureAtlas.load();
Sprite sprite = new Sprite(0, 0, mDecoratedBalloonTextureRegion, _engine.getVertexBufferObjectManager());
sprite.setOffsetCenter(0, 0);
sprite.setWidth(_width);
sprite.setHeight(_height);
_background = new SpriteBackground(sprite);
_engine.getScene().setBackground(_background);
}
示例9: createFromAsset
import org.andengine.opengl.texture.atlas.bitmap.source.IBitmapTextureAtlasSource; //导入依赖的package包/类
public static TextureRegion createFromAsset(final BitmapTextureAtlas pBitmapTextureAtlas, final AssetManager pAssetManager, final String pAssetPath, final int pTextureX, final int pTextureY) {
final IBitmapTextureAtlasSource bitmapTextureAtlasSource = AssetBitmapTextureAtlasSource.create(pAssetManager, BitmapTextureAtlasTextureRegionFactory.sAssetBasePath + pAssetPath);
return BitmapTextureAtlasTextureRegionFactory.createFromSource(pBitmapTextureAtlas, bitmapTextureAtlasSource, pTextureX, pTextureY);
}
示例10: writeTextureToHardware
import org.andengine.opengl.texture.atlas.bitmap.source.IBitmapTextureAtlasSource; //导入依赖的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;
}
}
}
}
示例11: createTiledFromAsset
import org.andengine.opengl.texture.atlas.bitmap.source.IBitmapTextureAtlasSource; //导入依赖的package包/类
public static TiledTextureRegion createTiledFromAsset(final BitmapTextureAtlas pBitmapTextureAtlas, final AssetManager pAssetManager, final String pAssetPath, final int pTextureX, final int pTextureY, final int pTileColumns, final int pTileRows) {
final IBitmapTextureAtlasSource bitmapTextureAtlasSource = AssetBitmapTextureAtlasSource.create(pAssetManager, BitmapTextureAtlasTextureRegionFactory.sAssetBasePath + pAssetPath);
return BitmapTextureAtlasTextureRegionFactory.createTiledFromSource(pBitmapTextureAtlas, bitmapTextureAtlasSource, pTextureX, pTextureY, pTileColumns, pTileRows);
}
示例12: createFromResource
import org.andengine.opengl.texture.atlas.bitmap.source.IBitmapTextureAtlasSource; //导入依赖的package包/类
public static TextureRegion createFromResource(final BitmapTextureAtlas pBitmapTextureAtlas, final Resources pResources, final int pDrawableResourceID, final int pTextureX, final int pTextureY) {
final IBitmapTextureAtlasSource bitmapTextureAtlasSource = ResourceBitmapTextureAtlasSource.create(pResources, pDrawableResourceID);
return BitmapTextureAtlasTextureRegionFactory.createFromSource(pBitmapTextureAtlas, bitmapTextureAtlasSource, pTextureX, pTextureY);
}
示例13: createTiledFromResource
import org.andengine.opengl.texture.atlas.bitmap.source.IBitmapTextureAtlasSource; //导入依赖的package包/类
public static TiledTextureRegion createTiledFromResource(final BitmapTextureAtlas pBitmapTextureAtlas, final Resources pResources, final int pDrawableResourceID, final int pTextureX, final int pTextureY, final int pTileColumns, final int pTileRows) {
final IBitmapTextureAtlasSource bitmapTextureAtlasSource = ResourceBitmapTextureAtlasSource.create(pResources, pDrawableResourceID);
return BitmapTextureAtlasTextureRegionFactory.createTiledFromSource(pBitmapTextureAtlas, bitmapTextureAtlasSource, pTextureX, pTextureY, pTileColumns, pTileRows);
}
示例14: createFromSource
import org.andengine.opengl.texture.atlas.bitmap.source.IBitmapTextureAtlasSource; //导入依赖的package包/类
public static TextureRegion createFromSource(final BitmapTextureAtlas pBitmapTextureAtlas, final IBitmapTextureAtlasSource pBitmapTextureAtlasSource, final int pTextureX, final int pTextureY) {
return TextureRegionFactory.createFromSource(pBitmapTextureAtlas, pBitmapTextureAtlasSource, pTextureX, pTextureY);
}
示例15: createTiledFromResource
import org.andengine.opengl.texture.atlas.bitmap.source.IBitmapTextureAtlasSource; //导入依赖的package包/类
public static TiledTextureRegion createTiledFromResource(final BuildableBitmapTextureAtlas pBuildableBitmapTextureAtlas, final Resources pResources, final int pDrawableResourceID, final int pTileColumns, final int pTileRows) {
final IBitmapTextureAtlasSource bitmapTextureAtlasSource = ResourceBitmapTextureAtlasSource.create(pResources, pDrawableResourceID);
return BitmapTextureAtlasTextureRegionFactory.createTiledFromSource(pBuildableBitmapTextureAtlas, bitmapTextureAtlasSource, pTileColumns, pTileRows);
}