Package org.eclipse.swt.graphics

Examples of org.eclipse.swt.graphics.Transform.translate()


    transform.dispose();

    // right
    transform = new Transform(device);
    transform.translate(2 * bounds.width + (width - bounds.width) / 2, (height - bounds.height) / 2);
    transform.scale(-1, 1);
    gc.setTransform(transform);

    // draw the original image
    gc.drawImage(image, 0, 0);
View Full Code Here


    // scale image
    transform.scale(scaleSpinnerX.getSelection() / 100f, scaleSpinnerY.getSelection() / 100f);

    // rotate on center of image
    Rectangle rect = image.getBounds();
    transform.translate(rect.width / 2, rect.height / 2);
    transform.rotate(rotateSpinner.getSelection());
    transform.translate(-rect.width / 2, -rect.height / 2);

    if (invertButton.getSelection())
      transform.invert();
View Full Code Here

    // rotate on center of image
    Rectangle rect = image.getBounds();
    transform.translate(rect.width / 2, rect.height / 2);
    transform.rotate(rotateSpinner.getSelection());
    transform.translate(-rect.width / 2, -rect.height / 2);

    if (invertButton.getSelection())
      transform.invert();

    gc.setTransform(transform);
View Full Code Here

    // draw petals for the spiral
    Transform transform;
    int n = petalSpinner.getSelection();
    for (int i = 0; i < n; i++) {
      transform = new Transform(device);
      transform.translate(width / 2, height / 2);
      transform.rotate(-(angle + 360 / n * i));
      gc.setTransform(transform);
      gc.drawArc(0, 0, width / 3, height / 6, 0, 180);
      transform.dispose();
    }
View Full Code Here

    gc.setAntialias(SWT.ON);
    gc.setAlpha(alphaSpinner.getSelection());

    // rotate on center
    Transform transform = new Transform(device);
    transform.translate(width / 2, height / 2);
    transform.rotate(-angle);
    transform.translate(-width / 2, -height / 2);
    gc.setTransform(transform);
    transform.dispose();
View Full Code Here

    // rotate on center
    Transform transform = new Transform(device);
    transform.translate(width / 2, height / 2);
    transform.rotate(-angle);
    transform.translate(-width / 2, -height / 2);
    gc.setTransform(transform);
    transform.dispose();

    // choose the smallest between height and width
    int diameter = height < width ? height : width;
View Full Code Here

      // draw the number
      gc.drawString(new Integer(nextNumber).toString(), (width - textWidth) / 2, (height - textHeight) / 2, true);

      // draw the rotating arm
      Transform transform = new Transform(device);
      transform.translate(width / 2, height / 2);
      transform.rotate(angle);
      gc.setTransform(transform);
      gc.setForeground(device.getSystemColor(SWT.COLOR_RED));
      gc.drawLine(0, 0, diameter / 2, 0);
      transform.dispose();
View Full Code Here

    // ----- top of letter t -----
    topTXPos = 11 * width / 16;
    topTYPos = (height - 150) / 2;

    transform = new Transform(device);
    transform.translate(topTXPos, topTYPos);
    gc.setTransform(transform);
    transform.dispose();

    gc.setForeground(device.getSystemColor(SWT.COLOR_YELLOW));
    gc.drawString(GraphicsExample.getResourceString("Cubic"), 25, -50, true);
View Full Code Here

    // ----- vertical bar of letter t -----
    botTXPos = 12 * width / 16;
    botTYPos = (height - 150) / 2;

    transform = new Transform(device);
    transform.translate(botTXPos, botTYPos);
    gc.setTransform(transform);
    transform.dispose();

    gc.setForeground(device.getSystemColor(SWT.COLOR_RED));
    gc.drawString(GraphicsExample.getResourceString("Cubic"), 0, 175, true);
View Full Code Here

    Transform transform;

    // ace of clubs
    transform = new Transform(device);
    transform.translate((int) movClubX, (int) movClubY);
    transform.scale(scaleWidth, scaleWidth);

    // rotate on center of image
    Rectangle rect = ace_club.getBounds();
    transform.translate(rect.width / 2, rect.height / 2);
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.