StateTransitionTracker stateTransitionTracker = transitionAwareUI
.getTransitionTracker();
StateTransitionTracker.ModelStateInfo modelStateInfo = stateTransitionTracker
.getModelStateInfo();
ComponentState currState = modelStateInfo.getCurrModelState();
SubstanceColorScheme baseFillScheme = SubstanceColorSchemeUtilities
.getColorScheme(button, currState);
SubstanceColorScheme baseBorderScheme = SubstanceColorSchemeUtilities
.getColorScheme(button, ColorSchemeAssociationKind.BORDER,
currState);
SubstanceFillPainter fillPainter = SubstanceCoreUtilities
.isSpinnerButton(button) ? MatteFillPainter.INSTANCE
: SubstanceImageCreator.SimplisticSoftBorderReverseFillPainter.INSTANCE;
BufferedImage baseLayer = getPairwiseFullAlphaBackground(button,
fillPainter, shaper, width, height, side, baseFillScheme,
baseBorderScheme, toIgnoreOpenSides);
BufferedImage fullOpacity = null;
Map<ComponentState, StateTransitionTracker.StateContributionInfo> activeStates = modelStateInfo
.getStateContributionMap();
if (currState.isDisabled() || (activeStates.size() == 1)) {
fullOpacity = baseLayer;
} else {
fullOpacity = SubstanceCoreUtilities.getBlankImage(baseLayer
.getWidth(), baseLayer.getHeight());
Graphics2D g2fullOpacity = fullOpacity.createGraphics();
// draw the base layer
g2fullOpacity.drawImage(baseLayer, 0, 0, null);
for (Map.Entry<ComponentState, StateTransitionTracker.StateContributionInfo> activeEntry : activeStates
.entrySet()) {
ComponentState activeState = activeEntry.getKey();
if (activeState == currState)
continue;
float contribution = activeEntry.getValue().getContribution();
if (contribution == 0.0f)
continue;
SubstanceColorScheme fillScheme = SubstanceColorSchemeUtilities
.getColorScheme(button, activeState);
SubstanceColorScheme borderScheme = SubstanceColorSchemeUtilities
.getColorScheme(button,
ColorSchemeAssociationKind.BORDER, activeState);
BufferedImage layer = getPairwiseFullAlphaBackground(button,
fillPainter, shaper, width, height, side, fillScheme,
borderScheme, toIgnoreOpenSides);
g2fullOpacity.setComposite(AlphaComposite.SrcOver
.derive(contribution));
g2fullOpacity.drawImage(layer, 0, 0, null);
}
g2fullOpacity.dispose();
}
boolean isFlat = SubstanceCoreUtilities.hasFlatAppearance(button);
boolean isSpecial = isFlat || !button.isEnabled();
float extraAlpha = 1.0f;
if (isSpecial) {
if (isFlat) {
// Special handling of flat buttons
extraAlpha = 0.0f;
for (Map.Entry<ComponentState, StateTransitionTracker.StateContributionInfo> activeEntry : activeStates
.entrySet()) {
ComponentState activeState = activeEntry.getKey();
if (activeState.isDisabled())
continue;
if (activeState == ComponentState.ENABLED)
continue;
extraAlpha += activeEntry.getValue().getContribution();
}