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.
|
||||
|
||||
Binary file not shown.
@@ -117,7 +117,7 @@ public class SingleCoilPickup extends AbstractTransparentComponent<String> {
|
||||
} else {
|
||||
finalBorderColor =
|
||||
componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING ? SELECTION_COLOR
|
||||
: getBaseColor().darker();
|
||||
: darkerOrLighter(getBaseColor());
|
||||
}
|
||||
|
||||
g2d.setColor(finalBorderColor);
|
||||
@@ -132,7 +132,7 @@ public class SingleCoilPickup extends AbstractTransparentComponent<String> {
|
||||
} else {
|
||||
finalBorderColor =
|
||||
componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING ? SELECTION_COLOR
|
||||
: color.darker();
|
||||
: darkerOrLighter(color);
|
||||
}
|
||||
|
||||
g2d.setColor(finalBorderColor);
|
||||
@@ -141,10 +141,10 @@ public class SingleCoilPickup extends AbstractTransparentComponent<String> {
|
||||
g2d.draw(body[3]);
|
||||
|
||||
if (componentState != ComponentState.DRAGGING && !outlineMode) {
|
||||
g2d.setColor(getPoleColor().darker());
|
||||
g2d.draw(body[2]);
|
||||
g2d.setColor(getPoleColor());
|
||||
g2d.fill(body[2]);
|
||||
g2d.setColor(darkerOrLighter(getPoleColor()));
|
||||
g2d.draw(body[2]);
|
||||
}
|
||||
|
||||
Color finalLabelColor;
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user