Package org.eclipse.swt.graphics

Examples of org.eclipse.swt.graphics.Transform


    Rectangle bounds = item.getBounds().getNow();
    OIPoint imageLocation = computeImageLocation(item, bounds);
    OIPoint imageSize = item.getImageSize();
    Rectangle imageBounds = OIPoint.makeRect(imageLocation, imageSize, isVertical());
   
    Transform transform = new Transform(getDisplay());
   
    if (isVertical() && !isImageRotationPreservedInVerticalMode()) {
      boolean vertLeft = getPosition() == SWT.LEFT;
      transform.translate(vertLeft ? 0 : imageBounds.width, vertLeft ? imageBounds.height : 0);
      transform.translate(imageBounds.x, imageBounds.y);
      transform.rotate(vertLeft ? -90 : 90);
      transform.translate(-imageBounds.x, -imageBounds.y);
    }
   
    gc.setTransform(transform);
   
    gc.drawImage(item.getImage(), imageBounds.x, imageBounds.y);
View Full Code Here


    Rectangle bounds = item.getBounds().getNow();
    OIPoint textLocation = computeTextLocation(item, bounds);
    OIPoint textSize = item.getTextSize();
    Rectangle textBounds = OIPoint.makeRect(textLocation, textSize, isVertical());
   
    Transform transform = new Transform(getDisplay());
   
    if (isVertical()) {
      boolean vertLeft = getPosition() == SWT.LEFT;
      transform.translate(vertLeft ? 0 : textBounds.width, vertLeft ? textBounds.height : 0);
      transform.translate(textBounds.x, textBounds.y);
      transform.rotate(vertLeft ? -90 : 90);
      transform.translate(-textBounds.x, -textBounds.y);
      gc.setTransform(transform);
    }
   
    gc.setTransform(transform);
   
View Full Code Here

   
    Rectangle bounds = stripItem.getBounds(true);
    Rectangle imageBounds = computeStripItemImageBounds(stripItem, bounds, renderType);
    Display display = getDisplay();
   
    Transform transform = new Transform(display);
   
    if (renderType == renderType.VERTICAL_ALL) {
      transform.translate(imageBounds.x, imageBounds.y);
      transform.rotate(-90);
      transform.translate(-imageBounds.x, -imageBounds.y);
      transform.translate(-imageBounds.height, 0);
    } else {
     
    }
   
    gc.setTransform(transform);
   
    Image image = stripItem.getImage();
    gc.drawImage(image, imageBounds.x, imageBounds.y);
   
    gc.setTransform(null);
    transform.dispose();
  }
View Full Code Here

    Display display = getDisplay();
    Image closeButtonImage = getCloseButtonImage(false);
    Rectangle boundsNow = item.getBoundsNow();
    Rectangle closeButtonBounds = computeCloseButtonBounds(item, boundsNow);
   
    Transform transform = new Transform(display);
   
    if (placement.isRotateAll()) {
      transform.translate(closeButtonBounds.x, closeButtonBounds.y);
     
      if (placement == Placement.LEFT_ROTATE_ALL) {
        transform.translate(0, closeButtonBounds.height);
        transform.rotate(-90);
      } else if (placement == Placement.RIGHT_ROTATE_ALL) {
        transform.rotate(90);
        transform.translate(0, -closeButtonBounds.width);
      }
     
      transform.translate(-closeButtonBounds.x, -closeButtonBounds.y);
    }
   
    gc.setTransform(transform);
   
    gc.drawImage(closeButtonImage, closeButtonBounds.x, closeButtonBounds.y);
   
    gc.setTransform(null);
    transform.dispose();
  }
View Full Code Here

        }

        if (robot != null) {
          if (robot.getSimPos() != null) {
            // Robot zeichnen
            Transform tr = new Transform(gc.getDevice());
            Rectangle bounds = robot.getImage().getBounds();
            int heading = robot.getHeading();
            int x = (int) Math.round(robot.getSimPos()
                .getDoubleX()
                - ((double) bounds.width / 2));
            int y = (int) Math.round(robot.getSimPos()
                .getDoubleY()
                - ((double) bounds.height / 2));

            tr.translate((int) ((double) bounds.width / 2 + x),
                (int) ((double) bounds.height / 2 + y));
            tr.rotate(heading);
            tr.translate((int) (-((double) bounds.width / 2 + x)),
                (int) (-((double) bounds.height / 2 + y)));
            gc.setTransform(tr);
            gc.drawImage(robot.getImage(), x, y);

            tr.dispose();
          }
        }
        gc.dispose();
      }
    });
View Full Code Here

  public PilotSimulatorApp() {
    super();
    if (display == null)
      display = new Display();
    shell = new Shell(display);
    transform = new Transform(display);
    shell.setLayout(new FillLayout());
  }
View Full Code Here

    /*
     * Now draw the car. The translate/rotate/translate settings account for any
     * nonzero carRotation values.
     */
    Transform transform = new Transform(gc.getDevice());
    transform.translate(carPosition.x, carPosition.y);
    final double drawCarRotation;
    if (carReverse) {
      double result = carRotation + 180;
      if (result > 360)
        result = result - 360;
      drawCarRotation = result;
    } else {
      drawCarRotation = carRotation;
    }
    transform.rotate((float) drawCarRotation);
    transform.translate(-(carPosition.x), -(carPosition.y));
    gc.setTransform(transform);
    /*
     * Now the graphics has been set up appropriately; draw the car in position
     */
    gc.drawImage(car, carPosition.x - carWHalf, carPosition.y - carHHalf);
    transform.dispose();
  }
View Full Code Here

        tmpGc.setBackground(gc.getBackground());
        tmpGc.setFont(getFont());
        tmpGc.drawText(text, 0, 0);

        // set transform to rotate
        Transform transform = new Transform(gc.getDevice());
        transform.translate(x, y);
        transform.rotate(360 - angle);
        gc.setTransform(transform);

        // draw the image on the rotated graphics context
        gc.drawImage(image, 0, 0);

        // dispose resources
        tmpGc.dispose();
        transform.dispose();
        image.dispose();
        gc.setTransform(null);
    }
View Full Code Here

            tmpGc.setBackground(getBackground());
            tmpGc.setFont(getFont());
            tmpGc.drawText(text, 0, 0);

            // set transform to rotate
            Transform transform = new Transform(gc.getDevice());
            transform.translate(0, textWidth);
            transform.rotate(270);
            gc.setTransform(transform);

            // draw the image on the rotated graphics context
            int y = (int) (height / 2d - textWidth / 2d);
            if (y < 0) {
                y = 0;
            }
            gc.drawImage(image, -y, 0);

            // dispose resources
            tmpGc.dispose();
            transform.dispose();
            image.dispose();
        }
    }
View Full Code Here

     * Returns the current transform.
     *
     * @return The current transform.
     */
    public AffineTransform getTransform() {
        Transform swtTransform = new Transform(this.gc.getDevice());
        this.gc.getTransform(swtTransform);
        AffineTransform awtTransform = toAwtTransform(swtTransform);
        swtTransform.dispose();
        return awtTransform;
    }
View Full Code Here

TOP

Related Classes of org.eclipse.swt.graphics.Transform

Copyright © 2018 www.massapicom. 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.