-
Notifications
You must be signed in to change notification settings - Fork 12
/
ParticleShape.java
68 lines (60 loc) 路 1.61 KB
/
ParticleShape.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
package me.samlss.bloom.shape;
import android.graphics.Path;
/**
* @author SamLeung
* @e-mail samlssplus@gmail.com
* @github https://github.com/samlss
* @description The base class for shape of particle.
*/
public abstract class ParticleShape {
private float mRadius;
private float mCenterX;
private float mCenterY;
private Path mPath;
/**
* Construct the shape of particle.
*
* @param centerX The center x coordinate of the particle.
* @param centerY The center y coordinate of the particle.
* @param radius The radius of the particle.
* */
public ParticleShape(float centerX, float centerY, float radius){
mCenterX = centerX;
mCenterY = centerY;
mRadius = radius;
mPath = new Path();
}
/**
* Return the radius of the particle.
* */
public float getRadius() {
return mRadius;
}
/**
* Return the center x coordinate of the particle.
* */
public float getCenterX() {
return mCenterX;
}
/**
* Return the center y coordinate of the particle.
* */
public float getCenterY() {
return mCenterY;
}
/**
* Need to implement this method to generate shape.
* You only need to implement this method, you don't have to deal with the call timing.
*
* 鍙渶瀹炵幇璇ユ帴鍙e嵆鍙紝鏃犻渶鍦ㄦ剰瀹冧綍鏃惰璋冪敤
*
* @param path The path you need to handle.
* */
public abstract void generateShape(Path path);
/**
* Get the path shape for particle.
* */
public Path getShapePath(){
return mPath;
}
}