Skip to content

Commit

Permalink
Add TODOs for the tonal world
Browse files Browse the repository at this point in the history
For #400
  • Loading branch information
kirill-grouchnikov committed Nov 30, 2024
1 parent ca35c39 commit 3a98328
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -130,22 +130,24 @@ public void paintIcon(Component c, Graphics g, int x, int y) {
float iconAlpha = RadianceColorSchemeUtilities.getAlpha(c,
modelStateInfo.getCurrModelState());

BladeUtils.populateColorScheme(mutableColorScheme, modelStateInfo,
currState,
BladeUtils.getDefaultColorSchemeDelegate(this.component,
this.colorSchemeAssociationKindDelegate),
false);
RadianceSkin skin = RadianceCoreUtilities.getSkin(c);

Graphics2D graphics = (Graphics2D) g.create();
graphics.translate(x, y);
RadianceSkin skin = RadianceCoreUtilities.getSkin(c);
if (skin instanceof TonalSkin) {
// TODO: TONAL - add animations
this.delegate.drawColorSchemeIcon(graphics,
BladeUtils.getDefaultColorSchemeDelegate(this.component,
this.colorSchemeAssociationKindDelegate)
.getRenderColorTokensForCurrentState(currState),
iconAlpha);
} else {
BladeUtils.populateColorScheme(mutableColorScheme, modelStateInfo,
currState,
BladeUtils.getDefaultColorSchemeDelegate(this.component,
this.colorSchemeAssociationKindDelegate),
false);

this.delegate.drawColorSchemeIcon(graphics, mutableColorScheme, iconAlpha);
}
graphics.dispose();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,13 @@
package org.pushingpixels.radiance.theming.internal.blade;

import org.pushingpixels.radiance.theming.api.ComponentState;
import org.pushingpixels.radiance.theming.api.RadianceSkin;
import org.pushingpixels.radiance.theming.api.RadianceThemingSlices.ColorSchemeAssociationKind;
import org.pushingpixels.radiance.theming.api.RadianceThemingSlices.ComponentStateFacet;
import org.pushingpixels.radiance.theming.api.palette.TonalSkin;
import org.pushingpixels.radiance.theming.internal.animation.StateTransitionTracker;
import org.pushingpixels.radiance.theming.internal.utils.RadianceColorSchemeUtilities;
import org.pushingpixels.radiance.theming.internal.utils.RadianceCoreUtilities;
import org.pushingpixels.radiance.theming.internal.utils.icon.TransitionAware;

import javax.swing.*;
Expand Down Expand Up @@ -95,16 +98,27 @@ public void paintIcon(Component c, Graphics g, int x, int y) {
float iconAlpha = RadianceColorSchemeUtilities.getAlpha(c,
modelStateInfo.getCurrModelState());

// Use HIGHLIGHT when necessary and MARK for the rest
BladeUtils.populateColorScheme(mutableColorScheme, modelStateInfo,
currState,
BladeUtils.getDefaultColorSchemeDelegate(this.component,
this.colorSchemeAssociationKindDelegate),
false);
RadianceSkin skin = RadianceCoreUtilities.getSkin(c);

Graphics2D graphics = (Graphics2D) g.create();
graphics.translate(x, y);
this.delegate.drawColorSchemeIcon(graphics, mutableColorScheme, iconAlpha);
if (skin instanceof TonalSkin) {
// TODO: TONAL - add animations
this.delegate.drawColorSchemeIcon(graphics,
BladeUtils.getDefaultColorSchemeDelegate(this.component,
this.colorSchemeAssociationKindDelegate)
.getRenderColorTokensForCurrentState(currState),
iconAlpha);
} else {
// Use HIGHLIGHT when necessary and MARK for the rest
BladeUtils.populateColorScheme(mutableColorScheme, modelStateInfo,
currState,
BladeUtils.getDefaultColorSchemeDelegate(this.component,
this.colorSchemeAssociationKindDelegate),
false);

this.delegate.drawColorSchemeIcon(graphics, mutableColorScheme, iconAlpha);
}
graphics.dispose();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,22 +157,23 @@ public void paintIcon(Component c, Graphics g, int x, int y) {
currState = ComponentState.ENABLED;
}

BladeUtils.populateColorScheme(mutableColorScheme, modelStateInfo, currState,
BladeUtils.getDefaultColorSchemeDelegate(c,
this.colorSchemeAssociationKindDelegate),
false);
RadianceSkin skin = RadianceCoreUtilities.getSkin(c);

Graphics2D graphics = (Graphics2D) g.create();
graphics.translate(x, y);

RadianceSkin skin = RadianceCoreUtilities.getSkin(c);
if (skin instanceof TonalSkin) {
// TODO: TONAL - add animations
this.delegate.drawColorSchemeIcon(graphics,
BladeUtils.getDefaultColorSchemeDelegate(c,
this.colorSchemeAssociationKindDelegate)
.getRenderColorTokensForCurrentState(currState),
iconAlpha);
} else {
BladeUtils.populateColorScheme(mutableColorScheme, modelStateInfo, currState,
BladeUtils.getDefaultColorSchemeDelegate(c,
this.colorSchemeAssociationKindDelegate),
false);

this.delegate.drawColorSchemeIcon(graphics, mutableColorScheme, iconAlpha);
}
graphics.dispose();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ private void drawBackground(
ContainerRenderColorTokens buttonRenderColorTokens =
skin.getColorRenderTokens(button, currState);

// TODO: TONAL - add animations
drawBackground(graphics, button, shaper, fillPainter, borderPainter, width, height,
buttonRenderColorTokens, openSides, isContentAreaFilled, isBorderPainted);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ public static ContainerRenderColorTokens getColorRenderTokens(Component componen
}
ContainerRenderColorTokens nonColorized = skin.getColorRenderTokens(component,
componentState);
// TODO: TONAL - add colorization
return nonColorized;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,7 @@ public static Color getForegroundColor(Component component,

RadianceSkin skin = RadianceCoreUtilities.getSkin(component);
if (skin instanceof TonalSkin) {
// TODO: TONAL - add animations
ContainerRenderColorTokens colorTokens = skin.getColorRenderTokens(component, currState);
return colorTokens.getOnContainerColorTokens().getOnContainer();
} else {
Expand Down

0 comments on commit 3a98328

Please sign in to comment.