Java Code Examples for org.pushingpixels.substance.internal.utils.SubstanceCoreUtilities#getOffsetInRootPaneCoords()
The following examples show how to use
org.pushingpixels.substance.internal.utils.SubstanceCoreUtilities#getOffsetInRootPaneCoords() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ArcDecorationPainter.java From radiance with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * Paints the background of non-title decoration areas. * * @param graphics * Graphics context. * @param parent * Component ancestor for computing the correct offset of the background painting. * @param comp * Component. * @param width * Width. * @param height * Height. * @param scheme * Color scheme for painting the title background. */ private void paintExtraBackground(Graphics2D graphics, Container parent, Component comp, int width, int height, SubstanceColorScheme scheme) { Point offset = SubstanceCoreUtilities.getOffsetInRootPaneCoords(comp); JRootPane rootPane = SwingUtilities.getRootPane(parent); // fix for bug 234 - Window doesn't have a root pane. JLayeredPane layeredPane = rootPane.getLayeredPane(); Insets layeredPaneInsets = (layeredPane != null) ? layeredPane.getInsets() : null; int pWidth = (layeredPane == null) ? parent.getWidth() : layeredPane.getWidth() - layeredPaneInsets.left - layeredPaneInsets.right; if (pWidth != 0) { LinearGradientPaint gradientBottom = new LinearGradientPaint(-offset.x, 0, -offset.x + pWidth, 0, new float[] { 0.0f, 0.5f, 1.0f }, new Color[] { scheme.getMidColor(), scheme.getLightColor(), scheme.getMidColor() }, CycleMethod.REPEAT); Graphics2D g2d = (Graphics2D) graphics.create(); g2d.setPaint(gradientBottom); g2d.fillRect(-offset.x, 0, pWidth, height); g2d.dispose(); } }
Example 2
Source File: ArcDecorationPainter.java From radiance with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Override public void paintDecorationArea(Graphics2D graphics, Component comp, DecorationAreaType decorationAreaType, Shape contour, SubstanceColorScheme colorScheme) { Component parent = SubstanceCoreUtilities.getHeaderParent(comp); Point offset = SubstanceCoreUtilities.getOffsetInRootPaneCoords(comp); JRootPane rootPane = SwingUtilities.getRootPane(parent); // fix for bug 234 - Window doesn't have a root pane. JLayeredPane layeredPane = rootPane.getLayeredPane(); Insets layeredPaneInsets = (layeredPane != null) ? layeredPane.getInsets() : null; int pWidth = (layeredPane == null) ? parent.getWidth() : layeredPane.getWidth() - layeredPaneInsets.left - layeredPaneInsets.right; if (pWidth != 0) { LinearGradientPaint gradientBottom = new LinearGradientPaint(-offset.x, 0, -offset.x + pWidth, 0, new float[] { 0.0f, 0.5f, 1.0f }, new Color[] { colorScheme.getMidColor(), colorScheme.getLightColor(), colorScheme.getMidColor() }, CycleMethod.REPEAT); Graphics2D g2d = (Graphics2D) graphics.create(); g2d.setPaint(gradientBottom); g2d.fill(contour); g2d.dispose(); } }
Example 3
Source File: MatteDecorationPainter.java From radiance with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Override public void paintDecorationArea(Graphics2D graphics, Component comp, DecorationAreaType decorationAreaType, Shape contour, SubstanceColorScheme colorScheme) { Point offset = SubstanceCoreUtilities.getOffsetInRootPaneCoords(comp); Color startColor = colorScheme.getLightColor(); Color endColor = SubstanceColorUtilities.getInterpolatedColor(startColor, colorScheme.getMidColor(), 0.4f); int gradientHeight = Math.max(FLEX_POINT, comp.getHeight() + offset.y); Paint paint = (gradientHeight == FLEX_POINT) ? new GradientPaint(0, -offset.y, startColor, 0, gradientHeight - offset.y, endColor) : new LinearGradientPaint( 0, -offset.y, 0, comp.getHeight() - offset.y, new float[] { 0.0f, (float) FLEX_POINT / (float) gradientHeight, 1.0f }, new Color[] { startColor, endColor, endColor }, MultipleGradientPaint.CycleMethod.NO_CYCLE); graphics.setPaint(paint); graphics.fill(contour); }
Example 4
Source File: ImageWrapperDecorationPainter.java From radiance with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * Paints the background of non-title decoration areas. * * @param graphics * Graphics context. * @param comp * Component. * @param decorationAreaType * Decoration area type. Must not be <code>null</code>. * @param width * Width. * @param height * Height. * @param skin * Skin for painting the background of non-title decoration areas. */ private void paintExtraBackground(Graphics2D graphics, Component comp, DecorationAreaType decorationAreaType, int width, int height, SubstanceSkin skin) { Point offset = SubstanceCoreUtilities.getOffsetInRootPaneCoords(comp); SubstanceColorScheme tileScheme = skin.getBackgroundColorScheme(decorationAreaType); if (this.baseDecorationPainter != null) { this.baseDecorationPainter.paintDecorationArea(graphics, comp, decorationAreaType, width, height, skin); } else { graphics.setColor(tileScheme.getMidColor()); graphics.fillRect(0, 0, width, height); } Graphics2D temp = (Graphics2D) graphics.create(); this.tileArea(temp, comp, tileScheme, offset.x, offset.y, width, height); temp.dispose(); }
Example 5
Source File: ImageWrapperDecorationPainter.java From radiance with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Override public void paintDecorationArea(Graphics2D graphics, Component comp, DecorationAreaType decorationAreaType, Shape contour, SubstanceColorScheme colorScheme) { Point offset = SubstanceCoreUtilities.getOffsetInRootPaneCoords(comp); if (this.baseDecorationPainter != null) { this.baseDecorationPainter.paintDecorationArea(graphics, comp, decorationAreaType, contour, colorScheme); } else { graphics.setColor(colorScheme.getMidColor()); graphics.fill(contour); } Graphics2D temp = (Graphics2D) graphics.create(); // Clip the area for tiling with the image. Ideally this would be done // with soft clipping (in SubstanceCoreUtilities), but that creates an // additional image. For now do hard clipping instead. temp.setClip(contour); this.tileArea(temp, comp, colorScheme, offset.x, offset.y, comp.getWidth(), comp.getHeight()); temp.dispose(); }
Example 6
Source File: MatteDecorationPainter.java From radiance with BSD 3-Clause "New" or "Revised" License | 3 votes |
/** * Paints the background of non-title decoration areas. * * @param graphics Graphics context. * @param comp Component. * @param width Width. * @param height Height. * @param scheme Color scheme for painting the title background. */ private void paintExtraBackground(Graphics2D graphics, Component comp, int width, int height, SubstanceColorScheme scheme) { Point offset = SubstanceCoreUtilities.getOffsetInRootPaneCoords(comp); Graphics2D g2d = (Graphics2D) graphics.create(); this.fill(g2d, scheme, offset.y, 0, 0, width, height); g2d.dispose(); }