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

Commit

Permalink
First pass for fractional scaling support
Browse files Browse the repository at this point in the history
  • Loading branch information
kirill-grouchnikov committed Feb 9, 2018
1 parent 3ea3018 commit cb49db2
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 7 deletions.
Binary file modified drop/8.0.00-dev/substance-flamingo-8.0.00-dev.jar
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.image.BufferedImage;
import java.util.Map;

Expand Down Expand Up @@ -193,6 +194,9 @@ private SubstanceIconUIResource getIconToPaint() {
BufferedImage result = SubstanceCoreUtilities.getBlankImage(layerBase
.getIconWidth(), layerBase.getIconHeight());
Graphics2D g2d = result.createGraphics();
g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
RenderingHints.VALUE_INTERPOLATION_BICUBIC);

// draw the base layer
layerBase.paintIcon(this.comp, g2d, 0, 0);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import java.awt.Graphics2D;
import java.awt.Insets;
import java.awt.Rectangle;
import java.awt.RenderingHints;
import java.awt.event.MouseEvent;
import java.awt.image.BufferedImage;
import java.beans.PropertyChangeEvent;
Expand Down Expand Up @@ -634,9 +635,13 @@ public void paint(Graphics g, JComponent c) {
*/
@Override
protected void paintPopupActionIcon(Graphics g, Rectangle popupActionRect) {
popupActionIcon.paintIcon(this.commandButton, g,
Graphics2D g2d = (Graphics2D) g.create();
g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
RenderingHints.VALUE_INTERPOLATION_BICUBIC);
popupActionIcon.paintIcon(this.commandButton, g2d,
popupActionRect.x + (popupActionRect.width - popupActionIcon.getIconWidth()) / 2,
popupActionRect.y + (popupActionRect.height - popupActionIcon.getIconHeight()) / 2);
g2d.dispose();
}

/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import java.awt.Graphics2D;
import java.awt.Insets;
import java.awt.Rectangle;
import java.awt.RenderingHints;
import java.awt.event.MouseEvent;
import java.awt.image.BufferedImage;
import java.beans.PropertyChangeEvent;
Expand Down Expand Up @@ -254,6 +255,8 @@ protected void paintButtonIcon(Graphics g, Rectangle iconRect) {

if (regular != null) {
Graphics2D g2d = (Graphics2D) g.create();
g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
RenderingHints.VALUE_INTERPOLATION_BICUBIC);

GhostPaintingUtils.paintGhostIcon(g2d, jctb, regular, iconRect);
g2d.setComposite(WidgetUtilities.getAlphaComposite(jctb, g));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ protected void paintButtonIcon(Graphics g, Rectangle iconRect) {
Graphics2D g2d = (Graphics2D) g.create();
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
RenderingHints.VALUE_INTERPOLATION_BICUBIC);
ComponentState currState = this.commandButton.getActionModel().isEnabled()
? ComponentState.SELECTED
: ComponentState.DISABLED_SELECTED;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,7 @@ private static BufferedImage getSingleLayer(JRibbonTaskToggleButton button, int
if (button.getActionModel().isSelected() && (button.getContextualGroupHueColor() == null)) {
int fw = result.getWidth();
int fh = result.getHeight();
double scaleFactor = UIUtil.getScaleFactor();
BufferedImage fade = SubstanceCoreUtilities.getBlankImage((int) (fw / scaleFactor),
(int) (fh / scaleFactor));
BufferedImage fade = SubstanceCoreUtilities.getBlankUnscaledImage(result);
Graphics2D fadeGraphics = fade.createGraphics();
JRibbon parent = (JRibbon) SwingUtilities.getAncestorOfClass(JRibbon.class, button);
RibbonTask selectedTask = parent.getSelectedTask();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2005-2010 Substance Kirill Grouchnikov. All Rights Reserved.
* Copyright (c) 2005-2018 Flamingo / Substance Kirill Grouchnikov. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2005-2010 Substance Kirill Grouchnikov. All Rights Reserved.
* Copyright (c) 2005-2018 Flamingo / Substance Kirill Grouchnikov. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2005-2010 Substance Kirill Grouchnikov. All Rights Reserved.
* Copyright (c) 2005-2018 Flamingo / Substance Kirill Grouchnikov. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
Expand Down

0 comments on commit cb49db2

Please sign in to comment.