Package java.awt

Examples of java.awt.Graphics2D.rotate()


                break;
            case 3: // 180�
                dx = (double)dim.width / (double)w;
                dy = (double)dim.height / (double)h;
                d = Math.min(dx, dy);
                g2d.rotate(Math.PI);
                g2d.translate(-w*d, -h*d);
                g2d.scale(d, d);
                if ((int)(w*d + .5) < dim.width)
                    xOffset = (int)((dim.width - w*d)/(2.0*d) + 0.5);
                if ((int)(h*d + .5) < dim.height)
View Full Code Here


               break;
            case 4: // 180� + <->
                dx = (double)dim.width / (double)w;
                dy = (double)dim.height / (double)h;
                d = Math.min(dx, dy);
                g2d.rotate(Math.PI);
                g2d.translate(0, -h*d);
                g2d.scale(-d, d);
                if ((int)(w*d + .5) < dim.width)
                    xOffset = (int)((dim.width - w*d)/(2.0*d) + 0.5);
                if ((int)(h*d + .5) < dim.height)
View Full Code Here

               break;
            case 5: // -90� + <->
                dx = (double)dim.width / (double)h;
                dy = (double)dim.height / (double)w;
                d = Math.min(dx, dy);
                g2d.rotate(Math.PI/2);
                g2d.scale(d, -d);
                if ((int)(h*d + .5) < dim.width)
                    xOffset = (int)((dim.width - h*d)/(2.0*d) + 0.5);
                if ((int)(w*d + .5) < dim.height)
                    yOffset = (int)((dim.height - w*d)/(2.0*d) + 0.5);
View Full Code Here

                break;
            case 6: // -90�
                dx = (double)dim.width / (double)h;
                dy = (double)dim.height / (double)w;
                d = Math.min(dx, dy);
                g2d.rotate(Math.PI/2);
                g2d.translate(0, -h*d);
                g2d.scale(d, d);
                if ((int)(h*d + .5) < dim.width)
                    xOffset = (int)((dim.width - h*d)/(2.0*d) + 0.5);
                if ((int)(w*d + .5) < dim.height)
View Full Code Here

                break;
            case 7: // 90� + <->
                dx = (double)dim.width / (double)h;
                dy = (double)dim.height / (double)w;
                d = Math.min(dx, dy);
                g2d.rotate(-Math.PI/2);
                g2d.translate(-w*d, h*d);
                g2d.scale(d, -d);
                if ((int)(h*d + .5) < dim.width)
                    xOffset = (int)((dim.width - h*d)/(2.0*d) + 0.5);
                if ((int)(w*d + .5) < dim.height)
View Full Code Here

                break;
            case 8: // 90�
                dx = (double)dim.width / (double)h;
                dy = (double)dim.height / (double)w;
                d = Math.min(dx, dy);
                g2d.rotate(-Math.PI/2);
                g2d.translate(-w*d, 0);
                g2d.scale(d, d);
                if ((int)(h*d + .5) < dim.width)
                    xOffset = (int)((dim.width - h*d)/(2.0*d) + 0.5);
                if ((int)(w*d + .5) < dim.height)
View Full Code Here

      g.drawImage(srcImg.getScaledInstance(srcImg.getWidth(null), srcImg
          .getHeight(null), Image.SCALE_SMOOTH), 0, 0, null);
      if (null != degree)
      {
        // 设置水印旋转
        g.rotate(Math.toRadians(degree),
            (double) buffImg.getWidth() / 2, (double) buffImg
                .getHeight() / 2);
      }

      // 水印图象的路径 水印一般为gif或者png的,这样可设置透明度
View Full Code Here

          .getHeight(null), Image.SCALE_SMOOTH), 0, 0, null);

      if (null != degree)
      {
        // 设置水印旋转
        g.rotate(Math.toRadians(degree),
            (double) buffImg.getWidth() / 2, (double) buffImg
                .getHeight() / 2);
      }

      // 设置颜色
View Full Code Here

          super.paint(g);
          final Graphics2D graphics = (Graphics2D) g.create();
          graphics.setColor(GuiResources.HIGHLIGHT_COLOR_DARKER);
          GuiUtil.configureGraphics(graphics);
          graphics.setFont(getFont().deriveFont(Font.BOLD, 33f));
          graphics.rotate(.3);
          graphics.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, .7f));
          final String str = "Work in progress ...";
          final int strWidth = SwingUtilities.computeStringWidth(getFontMetrics(getFont()), str);
          graphics.drawString(str, getSize().width / 2 - strWidth / 2, 10);
          graphics.dispose();
View Full Code Here

    g.setFont(_font);
    g.setColor(JBColor.BLACK);
    if (_clockwise) {
      g2.translate(x + getIconWidth(), y);
      g2.rotate(Math.PI / 2);
    } else {
      g2.translate(x, y + getIconHeight());
      g2.rotate(-Math.PI / 2);
    }
    int extraSpace = 0;
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.