|
|
@ -101,9 +101,9 @@ object ColorUtils { |
|
|
|
* 随机颜色 |
|
|
|
* 随机颜色 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
class RandomColor(alpha: Int, lower: Int, upper: Int) { |
|
|
|
class RandomColor(alpha: Int, lower: Int, upper: Int) { |
|
|
|
internal var alpha: Int = 0 |
|
|
|
private var alpha: Int = 0 |
|
|
|
internal var lower: Int = 0 |
|
|
|
private var lower: Int = 0 |
|
|
|
internal var upper: Int = 0 |
|
|
|
private var upper: Int = 0 |
|
|
|
|
|
|
|
|
|
|
|
//随机数是前闭 后开 |
|
|
|
//随机数是前闭 后开 |
|
|
|
val color: Int |
|
|
|
val color: Int |
|
|
@ -124,32 +124,32 @@ object ColorUtils { |
|
|
|
setUpper(upper) |
|
|
|
setUpper(upper) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fun getAlpha(): Int { |
|
|
|
private fun getAlpha(): Int { |
|
|
|
return alpha |
|
|
|
return alpha |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fun setAlpha(alpha: Int) { |
|
|
|
private fun setAlpha(alpha: Int) { |
|
|
|
var alpha = alpha |
|
|
|
var alpha = alpha |
|
|
|
if (alpha > 255) alpha = 255 |
|
|
|
if (alpha > 255) alpha = 255 |
|
|
|
if (alpha < 0) alpha = 0 |
|
|
|
if (alpha < 0) alpha = 0 |
|
|
|
this.alpha = alpha |
|
|
|
this.alpha = alpha |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fun getLower(): Int { |
|
|
|
private fun getLower(): Int { |
|
|
|
return lower |
|
|
|
return lower |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fun setLower(lower: Int) { |
|
|
|
private fun setLower(lower: Int) { |
|
|
|
var lower = lower |
|
|
|
var lower = lower |
|
|
|
if (lower < 0) lower = 0 |
|
|
|
if (lower < 0) lower = 0 |
|
|
|
this.lower = lower |
|
|
|
this.lower = lower |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fun getUpper(): Int { |
|
|
|
private fun getUpper(): Int { |
|
|
|
return upper |
|
|
|
return upper |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fun setUpper(upper: Int) { |
|
|
|
private fun setUpper(upper: Int) { |
|
|
|
var upper = upper |
|
|
|
var upper = upper |
|
|
|
if (upper > 255) upper = 255 |
|
|
|
if (upper > 255) upper = 255 |
|
|
|
this.upper = upper |
|
|
|
this.upper = upper |
|
|
|