Example usage for java.awt.geom AffineTransform setToScale

List of usage examples for java.awt.geom AffineTransform setToScale

Introduction

In this page you can find the example usage for java.awt.geom AffineTransform setToScale.

Prototype

public void setToScale(double sx, double sy) 

Source Link

Document

Sets this transform to a scaling transformation.

Usage

From source file:de.mendelson.comm.as2.AS2.java

/**Method to start the server on from the command line*/
public static void main(String args[]) {

    // TODO remove
    cleanup();//from  w w w .  j ava2 s .  com

    String language = null;
    boolean startHTTP = true;
    boolean allowAllClients = false;
    int optind;
    for (optind = 0; optind < args.length; optind++) {
        if (args[optind].toLowerCase().equals("-lang")) {
            language = args[++optind];
        } else if (args[optind].toLowerCase().equals("-nohttpserver")) {
            startHTTP = false;
        } else if (args[optind].toLowerCase().equals("-allowallclients")) {
            allowAllClients = true;
        } else if (args[optind].toLowerCase().equals("-?")) {
            AS2.printUsage();
            System.exit(1);
        } else if (args[optind].toLowerCase().equals("-h")) {
            AS2.printUsage();
            System.exit(1);
        } else if (args[optind].toLowerCase().equals("-help")) {
            AS2.printUsage();
            System.exit(1);
        }
    }
    //load language from preferences
    if (language == null) {
        PreferencesAS2 preferences = new PreferencesAS2();
        language = preferences.get(PreferencesAS2.LANGUAGE);
    }
    if (language != null) {
        if (language.toLowerCase().equals("en")) {
            Locale.setDefault(Locale.ENGLISH);
        } else if (language.toLowerCase().equals("de")) {
            Locale.setDefault(Locale.GERMAN);
        } else if (language.toLowerCase().equals("fr")) {
            Locale.setDefault(Locale.FRENCH);
        } else {
            AS2.printUsage();
            System.out.println();
            System.out.println("Language " + language + " is not supported.");
            System.exit(1);
        }
    }
    Splash splash = new Splash("/de/mendelson/comm/as2/client/Splash.jpg");
    AffineTransform transform = new AffineTransform();
    splash.setTextAntiAliasing(false);
    transform.setToScale(1.0, 1.0);
    splash.addDisplayString(new Font("Verdana", Font.BOLD, 11), 7, 262, AS2ServerVersion.getFullProductName(),
            new Color(0x65, 0xB1, 0x80), transform);
    splash.setVisible(true);
    splash.toFront();
    //start server
    try {
        //register the database drivers for the VM
        Class.forName("org.hsqldb.jdbcDriver");
        //initialize the security provider
        BCCryptoHelper helper = new BCCryptoHelper();
        helper.initialize();
        AS2Server as2Server = new AS2Server(startHTTP, allowAllClients);
        AS2Agent agent = new AS2Agent(as2Server);
    } catch (UpgradeRequiredException e) {
        //an upgrade to HSQLDB 2.x is required, delete the lock file
        Logger.getLogger(AS2Server.SERVER_LOGGER_NAME).warning(e.getMessage());
        JOptionPane.showMessageDialog(null, e.getClass().getName() + ": " + e.getMessage());
        AS2Server.deleteLockFile();
        System.exit(1);
    } catch (Throwable e) {
        if (splash != null) {
            splash.destroy();
        }
        JOptionPane.showMessageDialog(null, e.getMessage());
        System.exit(1);
    }
    //start client
    AS2Gui gui = new AS2Gui(splash, "localhost");
    gui.setVisible(true);
    splash.destroy();
    splash.dispose();
}

From source file:Main.java

public void paint(Graphics g) {
    Shape shape = new Rectangle2D.Float(100, 50, 80, 80);

    Graphics2D g2 = (Graphics2D) g;

    AffineTransform at = new AffineTransform();
    at.setToScale(Math.PI / 6, Math.PI / 6);

    g2.setTransform(at);// w w  w  .j a v  a2  s . c  o m
    g2.draw(shape);

}

From source file:org.uva.itast.blended.omr.pages.PageImage.java

/**
 * @param data.getImage()//from  w w w . java2 s. co  m
 */
public void resetAlignmentInfo() {
    AffineTransform tr = new AffineTransform();

    double horizRatio = getHorizontalResolution();
    double vertRatio = getVerticalResolution();

    // Do not assume square pixels
    tr.setToScale(horizRatio, vertRatio);
    setAlignmentInfo(tr);
}

From source file:org.uva.itast.blended.omr.pages.PageImage.java

public Point toPixelsPoint(double x, double y) {
    AffineTransform alignment = getAllignmentInfo();
    alignment.setToScale(getPreferredHorizontalResolution(), getPreferredVerticalResolution());

    Point2D coord = new Point2D.Double(x, y);
    Point coordTransformed = new Point();
    alignment.transform(coord, coordTransformed);

    return coordTransformed;
}