Package org.eclipse.swt.graphics

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


    /*
     * 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;
View Full Code Here


      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);
View Full Code Here

        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);
View Full Code Here

            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);
View Full Code Here

     * @param y  the translation along the y-axis.
     */
    public void translate(int x, int y) {
        Transform swtTransform = new Transform(this.gc.getDevice());
        this.gc.getTransform(swtTransform);
        swtTransform.translate(x, y);
        this.gc.setTransform(swtTransform);
        swtTransform.dispose();
    }

    /**
 
View Full Code Here

                            // printer
                            printerTransform
                                    .scale(scaleFactor.x, scaleFactor.y);

                            // Adjust for margins
                            printerTransform.translate(printerClientArea.x
                                    / scaleFactor.x, printerClientArea.y
                                    / scaleFactor.y);

                            // Grid will not automatically print the pages at
                            // the left margin.
View Full Code Here

                            // the left margin.
                            // Example: page 1 will print at x = 0, page 2 at x
                            // = 100, page 3 at x = 300
                            // Adjust to print from the left page margin. i.e x
                            // = 0
                            printerTransform.translate(-1 * printBounds.x, -1
                                    * printBounds.y);
                            gc.setTransform(printerTransform);

                            printLayer(gc, printBounds);

View Full Code Here

                                + -rectangle.y
                                + CellStyleUtil.getHorizontalAlignmentPadding(
                                        cellStyle, rectangle, contentHeight)
                                + spacing;

                        transform.translate(xOffset, yOffset);
                    } else {
                        transform.rotate(90f);

                        int horizontalPadding = CellStyleUtil
                                .getHorizontalAlignmentPadding(cellStyle,
View Full Code Here

                                + CellStyleUtil.getVerticalAlignmentPadding(
                                        cellStyle, rectangle, contentWidth);
                        int yOffset = -contentHeight - rectangle.y
                                - rectangle.x - horizontalPadding + spacing;

                        transform.translate(xOffset, yOffset);
                    }

                    gc.setTransform(transform);

                    gc.drawText(text, rectangle.x, rectangle.y,
View Full Code Here

                                    + CellStyleUtil
                                            .getHorizontalAlignmentPadding(
                                                    cellStyle, rectangle,
                                                    contentHeight) + spacing;

                            transform.translate(xOffset, yOffset);
                        } else {
                            transform.rotate(90f);

                            int horizontalPadding = CellStyleUtil
                                    .getHorizontalAlignmentPadding(cellStyle,
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.