/* * (non-Javadoc) * * @seeorg.jvnet.flamingo.common.ui.BasicCommandButtonUI# * paintButtonVerticalSeparator(java.awt.Graphics, int) */ @Override protected void paintButtonVerticalSeparator(Graphics graphics, Rectangle separatorArea) { Graphics2D g2d = (Graphics2D) graphics.create(); g2d.translate(separatorArea.x, 0); SubstanceColorScheme colorScheme = SubstanceColorSchemeUtilities.getColorScheme( this.commandButton, ColorSchemeAssociationKind.SEPARATOR, ComponentState.getState(this.commandButton.getActionModel(), this.commandButton)); float fadeAlpha = this.getSeparatorAlpha(); g2d.setComposite(AlphaComposite.SrcOver.derive(fadeAlpha)); SeparatorPainterUtils.paintSeparator( this.commandButton, g2d, colorScheme, 1, this.commandButton.getHeight(), JSlider.VERTICAL, true, 4, 4, true); g2d.dispose(); }
public void paintComponent(Graphics g) { if (Principal.fondoBlur) { if (isVisible() && blurBuffer != null && listo) { Graphics2D g2 = (Graphics2D) g.create(); g2.setRenderingHint( RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); g2.drawImage(backBuffer, 0, 0, null); g2.setComposite(AlphaComposite.SrcOver.derive(alpha)); g2.drawImage(blurBuffer, 0, 0, getWidth(), getHeight(), null); g2.dispose(); } } }
private BufferedImage construirSombra() { Rectangle2D b = cuadrado.getBounds2D(); BufferedImage sombra = new BufferedImage( (int) b.getWidth() + 20, (int) b.getHeight() + 30, BufferedImage.TYPE_INT_ARGB); Graphics2D g2 = sombra.createGraphics(); g2.setComposite(AlphaComposite.SrcOver.derive(0.5f)); g2.setColor(Color.DARK_GRAY); g2.translate(5, 5); Shape cuadrado = new RoundRectangle2D.Float(0, 0, 265, 68, 20, 20); g2.fill(cuadrado); sombra = getBlurFilter(5).filter(sombra, null); return sombra; }
public void paintComponent(Graphics g) { if (!Principal.fondoBlur) { if (isVisible() && blurBuffer != null) { Graphics2D g2 = (Graphics2D) g.create(); g2.setRenderingHint( RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); g2.drawImage(backBuffer, 0, 0, null); g2.setComposite(AlphaComposite.SrcOver.derive(alpha)); g2.drawImage(blurBuffer, 0, 0, getWidth(), getHeight(), null); g2.setColor(new Color(55, 55, 255, 150)); g2.fillRect(0, 0, getBounds().width, getBounds().height); g2.dispose(); } } else { Graphics2D g2d = (Graphics2D) g; g2d.drawImage(fondo, 0, 0, null); } }
void paintSkin(Skin skin, Graphics _g, int dx, int dy, int dw, int dh, State state) { assert SwingUtilities.isEventDispatchThread(); updateProgress(); if (!isDone()) { Graphics2D g = (Graphics2D) _g.create(); skin.paintSkinRaw(g, dx, dy, dw, dh, startState); float alpha; if (isForward) { alpha = progress; } else { alpha = 1 - progress; } g.setComposite(AlphaComposite.SrcOver.derive(alpha)); skin.paintSkinRaw(g, dx, dy, dw, dh, state); g.dispose(); } else { skin.paintSkinRaw(_g, dx, dy, dw, dh, state); } }
public void render(Graphics2D g, int x, int y) { if (alpha == 0f) { return; } Graphics2D g2d = (Graphics2D) g.create(); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2d.setRenderingHint( RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); g2d.setComposite(AlphaComposite.SrcOver.derive(alpha * 0.7f)); g2d.setColor(bgColor); g2d.setFont(g2d.getFont().deriveFont(20.0f)); TextLayout tl = new TextLayout(text, g2d.getFont(), g2d.getFontRenderContext()); Rectangle2D bounds = tl.getBounds(); int tw = (int) bounds.getWidth(); int th = (int) bounds.getHeight(); g2d.fillRoundRect(x, y, tw + GAP * 2, th + GAP * 2, 10, 10); g2d.setColor(fgColor); tl.draw(g2d, x + GAP, y + GAP + th - tl.getDescent()); g2d.dispose(); }
@Override protected void paintComponent(Graphics g) { Graphics2D g2 = (Graphics2D) g.create(); if (image != null && bounds != null) { int width = image.getWidth(this); width += (int) (image.getWidth(this) * MAGNIFY_FACTOR * getZoom()); int height = image.getHeight(this); height += (int) (image.getHeight(this) * MAGNIFY_FACTOR * getZoom()); int x = (bounds.width - width) / 2; int y = (bounds.height - height) / 2; g2.setRenderingHint( RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); g2.setComposite(AlphaComposite.SrcOver.derive(1.0f - getZoom())); g2.drawImage(image, x + bounds.x, y + bounds.y, width, height, null); } if (showHint) { bounds = link.getBounds(); Point location = new Point(0, 0); location = SwingUtilities.convertPoint(link, location, this); bounds.setLocation(location); Font font = new Font(Font.SANS_SERIF, Font.BOLD, 12); FontMetrics m = getFontMetrics(font); int width = m.charsWidth(hint.toCharArray(), 0, hint.length()); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2.setColor(Color.black); g2.setComposite(AlphaComposite.SrcOver.derive(hintOpacity)); int balloon_x = bounds.x + bounds.width / 2 - width / 2 - hint_x_offset; int balloon_width = width + 2 * hint_width_inset; int balloon_center = balloon_x + balloon_width / 2; int balloon_height = 20; int[] arrow_x = new int[3]; int[] arrow_y = new int[3]; arrow_x[0] = balloon_center - 5; arrow_x[1] = balloon_center + 5; arrow_x[2] = balloon_center; arrow_y[0] = bounds.y - hint_y_pos + balloon_height; arrow_y[1] = bounds.y - hint_y_pos + balloon_height; arrow_y[2] = bounds.y - hint_y_pos + balloon_height + 10; g2.fillRoundRect(balloon_x, bounds.y - hint_y_pos, balloon_width, balloon_height, 15, 15); g2.fillPolygon(arrow_x, arrow_y, arrow_x.length); g2.setColor(Color.white); g2.setFont(font); g2.setComposite(AlphaComposite.SrcOver.derive(Math.min(1.0f, 2.0f * hintOpacity))); g2.drawString(hint, balloon_x + hint_width_inset, bounds.y - hint_y_pos + font.getSize() + 3); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); g2.dispose(); } }