Skip to content
This repository has been archived by the owner on Mar 17, 2023. It is now read-only.

Commit

Permalink
Fixed out of range alpha composite.
Browse files Browse the repository at this point in the history
  • Loading branch information
Stephane-D committed Nov 12, 2015
1 parent d4c8897 commit b1f6c8d
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -998,7 +998,7 @@ public static BufferedImage getCheckBox(AbstractButton button,
if (checkMarkVisibility > 0.0) {
if (isCheckMarkFadingOut) {
graphics.setComposite(AlphaComposite.getInstance(
AlphaComposite.SRC_OVER, alpha * checkMarkVisibility));
AlphaComposite.SRC_OVER, Math.max(1f, alpha * checkMarkVisibility)));
checkMarkVisibility = 1.0f;
}

Expand Down Expand Up @@ -1109,15 +1109,15 @@ private static BufferedImage overlayEcho(BufferedImage image,
height);
Graphics2D graphics = (Graphics2D) result.getGraphics().create();
graphics.setComposite(AlphaComposite.getInstance(
AlphaComposite.SRC_OVER, 0.2f * echoAlpha * echoAlpha
* echoAlpha));
AlphaComposite.SRC_OVER, Math.max(1f, 0.2f * echoAlpha * echoAlpha
* echoAlpha)));
graphics.drawImage(negated, offsetX - 1, offsetY - 1, null);
graphics.drawImage(negated, offsetX + 1, offsetY - 1, null);
graphics.drawImage(negated, offsetX - 1, offsetY + 1, null);
graphics.drawImage(negated, offsetX + 1, offsetY + 1, null);
graphics.setComposite(AlphaComposite.getInstance(
AlphaComposite.SRC_OVER, 0.7f * echoAlpha * echoAlpha
* echoAlpha));
AlphaComposite.SRC_OVER, Math.max(1f, 0.7f * echoAlpha * echoAlpha
* echoAlpha)));
graphics.drawImage(negated, offsetX, offsetY - 1, null);
graphics.drawImage(negated, offsetX, offsetY + 1, null);
graphics.drawImage(negated, offsetX - 1, offsetY, null);
Expand Down

2 comments on commit b1f6c8d

@IvanRF
Copy link

@IvanRF IvanRF commented on b1f6c8d Feb 24, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Stephane-D do you have an scenario for this same issue on kirill-grouchnikov#18? (in order to find the root cause)

@Stephane-D
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was happening with some systems only and difficult to replicate honestly. I saw these reports from our centralized application bug report and it may be due to a specific JVM version. For "safety" i preferred to protect against though.

Please sign in to comment.