package org.andengine.opengl.texture.atlas.bitmap.source.decorator.shape;
import org.andengine.opengl.texture.atlas.bitmap.source.decorator.BaseBitmapTextureAtlasSourceDecorator.TextureAtlasSourceDecoratorOptions;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.RectF;
/**
* (c) 2010 Nicolas Gramlich
* (c) 2011 Zynga Inc.
*
* @author Nicolas Gramlich
* @since 12:52:55 - 04.01.2011
*/
public class EllipseBitmapTextureAtlasSourceDecoratorShape implements IBitmapTextureAtlasSourceDecoratorShape {
// ===========================================================
// Constants
// ===========================================================
// ===========================================================
// Fields
// ===========================================================
private static EllipseBitmapTextureAtlasSourceDecoratorShape sDefaultInstance;
private final RectF mRectF = new RectF();
// ===========================================================
// Constructors
// ===========================================================
public EllipseBitmapTextureAtlasSourceDecoratorShape() {
}
public static EllipseBitmapTextureAtlasSourceDecoratorShape getDefaultInstance() {
if(sDefaultInstance == null) {
sDefaultInstance = new EllipseBitmapTextureAtlasSourceDecoratorShape();
}
return sDefaultInstance;
}
// ===========================================================
// Getter & Setter
// ===========================================================
// ===========================================================
// Methods for/from SuperClass/Interfaces
// ===========================================================
@Override
public void onDecorateBitmap(final Canvas pCanvas, final Paint pPaint, final TextureAtlasSourceDecoratorOptions pDecoratorOptions) {
final float left = pDecoratorOptions.getInsetLeft();
final float top = pDecoratorOptions.getInsetTop();
final float right = pCanvas.getWidth() - pDecoratorOptions.getInsetRight();
final float bottom = pCanvas.getHeight() - pDecoratorOptions.getInsetBottom();
this.mRectF.set(left, top, right, bottom);
pCanvas.drawOval(this.mRectF, pPaint);
}
// ===========================================================
// Methods
// ===========================================================
// ===========================================================
// Inner and Anonymous Classes
// ===========================================================
}