If you think the Android project android-augment-reality-framework listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
Java Source Code
package com.jwetherell.augmented_reality.ui.objects;
/*fromwww.java2s.com*/import android.graphics.Canvas;
/**
* This class extends PaintableObject to draw a circle with a given radius.
*
* @author Justin Wetherell <phishman3579@gmail.com>
*/publicclass PaintableCircle extends PaintableObject {
privateint color = 0;
privatefloat radius = 0;
privateboolean fill = false;
public PaintableCircle(int color, float radius, boolean fill) {
set(color, radius, fill);
}
/**
* Set the objects parameters. This should be used instead of creating new
* objects.
*
* @param color
* Color of the circle.
* @param radius
* Radius of the circle.
* @param fill
* Fill color of the circle.
*/publicvoid set(int color, float radius, boolean fill) {
this.color = color;
this.radius = radius;
this.fill = fill;
}
/**
* {@inheritDoc}
*/
@Override
publicvoid paint(Canvas canvas) {
if (canvas == null) thrownew NullPointerException();
canvas.save();
canvas.translate(-radius, -radius);
setFill(fill);
setColor(color);
paintCircle(canvas, x, y, radius);
canvas.restore();
}
/**
* {@inheritDoc}
*/
@Override
publicfloat getWidth() {
return radius * 2;
}
/**
* {@inheritDoc}
*/
@Override
publicfloat getHeight() {
return radius * 2;
}
}