ClassicButtonShaper shaper = ClassicButtonShaper.INSTANCE;
int comboFontSize = SubstanceSizeUtils.getComponentFontSize(combo);
float radius = SubstanceSizeUtils
.getClassicButtonCornerRadius(comboFontSize);
SubstanceColorScheme baseFillScheme = SubstanceColorSchemeUtilities
.getColorScheme(combo, currState);
SubstanceColorScheme baseBorderScheme = SubstanceColorSchemeUtilities
.getColorScheme(combo, ColorSchemeAssociationKind.BORDER,
currState);
HashMapKey keyBase = SubstanceCoreUtilities.getHashKey(width, height,
baseFillScheme.getDisplayName(), baseBorderScheme
.getDisplayName(), fillPainter.getDisplayName(),
borderPainter.getDisplayName(), combo.getClass().getName(),
radius, comboFontSize);
BufferedImage layerBase = regularBackgrounds.get(keyBase);
if (layerBase == null) {
layerBase = createBackgroundImage(combo, shaper, fillPainter,
borderPainter, width, height, baseFillScheme,
baseBorderScheme, radius);
regularBackgrounds.put(keyBase, layerBase);
}
if (currState.isDisabled() || (activeStates.size() == 1)) {
return layerBase;
}
BufferedImage result = SubstanceCoreUtilities.getBlankImage(width,
height);
Graphics2D g2d = result.createGraphics();
// draw the base layer
g2d.drawImage(layerBase, 0, 0, null);
// System.out.println("\nPainting base state " + currState);
// draw the other active layers
for (Map.Entry<ComponentState, StateTransitionTracker.StateContributionInfo> activeEntry : activeStates
.entrySet()) {
ComponentState activeState = activeEntry.getKey();
// System.out.println("Painting state " + activeState + "[curr is "
// + currState + "] with " + activeEntry.getValue());
if (activeState == currState)
continue;
float stateContribution = activeEntry.getValue().getContribution();
if (stateContribution > 0.0f) {
g2d.setComposite(AlphaComposite.SrcOver
.derive(stateContribution));
SubstanceColorScheme fillScheme = SubstanceColorSchemeUtilities
.getColorScheme(combo, activeState);
SubstanceColorScheme borderScheme = SubstanceColorSchemeUtilities
.getColorScheme(combo,
ColorSchemeAssociationKind.BORDER, activeState);
HashMapKey key = SubstanceCoreUtilities.getHashKey(width,
height, fillScheme.getDisplayName(), borderScheme
.getDisplayName(),
fillPainter.getDisplayName(), borderPainter
.getDisplayName(), combo.getClass().getName(),
radius, comboFontSize);
BufferedImage layer = regularBackgrounds.get(key);