mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-11 01:32:08 +10:00
darker/lighter logic
single coil improvement
This commit is contained in:
@@ -80,6 +80,18 @@ public abstract class AbstractComponent<T> implements IDIYComponent<T> {
|
||||
return ((int) x / 2) * 2 + 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns darker color if possible, or lighter if it's already dark
|
||||
*
|
||||
* @param color
|
||||
* @return
|
||||
*/
|
||||
protected Color darkerOrLighter(Color color) {
|
||||
float[] hsb = new float[3];
|
||||
Color.RGBtoHSB(color.getRed(), color.getGreen(), color.getBlue(), hsb);
|
||||
return new Color(Color.HSBtoRGB(hsb[0], hsb[1], hsb[2] > 0.5 ? hsb[2] - 0.25f : hsb[2] + 0.25f));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param clip
|
||||
* @return true if none of the control points lie in the clip rectangle.
|
||||
|
||||
Reference in New Issue
Block a user