Skip to content
This repository has been archived by the owner on Jul 10, 2018. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
kirill-grouchnikov committed Feb 24, 2017
2 parents 819d3ba + 6659a92 commit a5cc2f7
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 23 deletions.
6 changes: 3 additions & 3 deletions .settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#Sun Aug 01 16:28:45 PDT 2010
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.6
org.eclipse.jdt.core.compiler.source=1.8
Original file line number Diff line number Diff line change
Expand Up @@ -602,8 +602,7 @@ public static BufferedImage getRadioButton(JComponent component,
graphics.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL,
RenderingHints.VALUE_STROKE_PURE);

graphics.setComposite(AlphaComposite.getInstance(
AlphaComposite.SRC_OVER, alpha));
graphics.setComposite(getAlphaComposite(alpha));

graphics.translate(offsetX, 0);
fillPainter.paintContourBackground(graphics, component, dimension,
Expand All @@ -623,15 +622,13 @@ public static BufferedImage getRadioButton(JComponent component,
2 * radius, 2 * radius);
if (checkMarkVisibility > 0.0) {
// mark
graphics.setComposite(AlphaComposite.getInstance(
AlphaComposite.SRC_OVER, alpha * checkMarkVisibility));
graphics.setComposite(getAlphaComposite(alpha * checkMarkVisibility));
graphics.setColor(SubstanceColorUtilities.getMarkColor(
markColorScheme, !componentState.isDisabled()));
graphics.fill(markOval);
} else {
// draw ghost mark holder
graphics.setComposite(AlphaComposite.getInstance(
AlphaComposite.SRC_OVER, alpha * 0.3f));
graphics.setComposite(getAlphaComposite(alpha * 0.3f));
graphics.setPaint(new GradientPaint(rc + radius, rc - radius,
fillColorScheme.getDarkColor(), rc - radius, rc + radius,
fillColorScheme.getLightColor()));
Expand All @@ -642,6 +639,16 @@ public static BufferedImage getRadioButton(JComponent component,
return offBackground;
}

private static AlphaComposite getAlphaComposite(float alpha) {
// Fix for "alpha value out of range"
float finalAlpha = alpha;
if (finalAlpha < 0.0f)
finalAlpha = 0.0f;
else if (finalAlpha > 1.0f)
finalAlpha = 1.0f;
return AlphaComposite.getInstance(AlphaComposite.SRC_OVER, finalAlpha);
}

/**
* Retrieves check box of the specified size that matches the specified
* component state.
Expand Down Expand Up @@ -701,8 +708,7 @@ public static BufferedImage getCheckBox(AbstractButton button,
BufferedImage offBackground = SubstanceCoreUtilities.getBlankImage(
dimension, dimension);
Graphics2D graphics = (Graphics2D) offBackground.getGraphics();
graphics.setComposite(AlphaComposite.getInstance(
AlphaComposite.SRC_OVER, alpha));
graphics.setComposite(getAlphaComposite(alpha));

graphics.translate(delta - 1, delta - 1);
fillPainter.paintContourBackground(graphics, button, contourDim,
Expand All @@ -717,8 +723,7 @@ public static BufferedImage getCheckBox(AbstractButton button,
graphics.translate(-delta, 1 - delta);
if (checkMarkVisibility > 0.0) {
if (isCheckMarkFadingOut) {
graphics.setComposite(AlphaComposite.getInstance(
AlphaComposite.SRC_OVER, alpha * checkMarkVisibility));
graphics.setComposite(getAlphaComposite(alpha * checkMarkVisibility));
checkMarkVisibility = 1.0f;
}

Expand Down Expand Up @@ -760,23 +765,18 @@ private static BufferedImage overlayEcho(BufferedImage image,
BufferedImage result = SubstanceCoreUtilities.getBlankImage(tweakedWidth,
tweakedHeight);
Graphics2D graphics = (Graphics2D) result.getGraphics().create();
graphics.setComposite(AlphaComposite.getInstance(
AlphaComposite.SRC_OVER, 0.2f * echoAlpha * echoAlpha
* echoAlpha));
graphics.setComposite(getAlphaComposite(0.2f * echoAlpha * echoAlpha * echoAlpha));
graphics.drawImage(echo, offsetX - 1, offsetY - 1, tweakedWidth, tweakedHeight, null);
graphics.drawImage(echo, offsetX + 1, offsetY - 1, tweakedWidth, tweakedHeight, null);
graphics.drawImage(echo, offsetX - 1, offsetY + 1, tweakedWidth, tweakedHeight, null);
graphics.drawImage(echo, offsetX + 1, offsetY + 1, tweakedWidth, tweakedHeight, null);
graphics.setComposite(AlphaComposite.getInstance(
AlphaComposite.SRC_OVER, 0.7f * echoAlpha * echoAlpha
* echoAlpha));
graphics.setComposite(getAlphaComposite(0.7f * echoAlpha * echoAlpha * echoAlpha));
graphics.drawImage(echo, offsetX, offsetY - 1, tweakedWidth, tweakedHeight, null);
graphics.drawImage(echo, offsetX, offsetY + 1, tweakedWidth, tweakedHeight, null);
graphics.drawImage(echo, offsetX - 1, offsetY, tweakedWidth, tweakedHeight, null);
graphics.drawImage(echo, offsetX + 1, offsetY, tweakedWidth, tweakedHeight, null);

graphics.setComposite(AlphaComposite.getInstance(
AlphaComposite.SRC_OVER, 1.0f));
graphics.setComposite(getAlphaComposite(1.0f));
graphics.drawImage(image, 0, 0, tweakedWidth, tweakedHeight, null);

graphics.dispose();
Expand Down Expand Up @@ -1345,8 +1345,7 @@ public static void paintSplitDividerBumpImage(Graphics g,
dotGraphics.setColor(markColor);
dotGraphics.fillOval(0, 0, bumpDotDiameter, bumpDotDiameter);

dotGraphics.setComposite(AlphaComposite.getInstance(
AlphaComposite.SRC_OVER, 0.4f));
dotGraphics.setComposite(getAlphaComposite(0.4f));
SubstanceBorderPainter borderPainter = SubstanceCoreUtilities
.getBorderPainter(divider);
borderPainter.paintBorder(dotGraphics, divider, bumpDotDiameter, bumpDotDiameter,
Expand Down

0 comments on commit a5cc2f7

Please sign in to comment.