Search in sources :

Example 16 with Point2D

use of java.awt.geom.Point2D in project jdk8u_jdk by JetBrains.

the class MlibOpsTest method createSrcImage.

private static BufferedImage createSrcImage() {
    BufferedImage img = createImage();
    Graphics2D g = img.createGraphics();
    Color[] colors = { Color.red, Color.green, Color.blue };
    float[] dist = { 0.0f, 0.5f, 1.0f };
    Point2D center = new Point2D.Float(0.5f * w, 0.5f * h);
    RadialGradientPaint p = new RadialGradientPaint(center, 0.5f * w, dist, colors);
    g.setPaint(p);
    g.fillRect(0, 0, w, h);
    g.dispose();
    return img;
}
Also used : Point2D(java.awt.geom.Point2D) Color(java.awt.Color) RadialGradientPaint(java.awt.RadialGradientPaint) BufferedImage(java.awt.image.BufferedImage) Graphics2D(java.awt.Graphics2D)

Example 17 with Point2D

use of java.awt.geom.Point2D in project jdk8u_jdk by JetBrains.

the class WritingInterruptionTest method createTestImage.

private static BufferedImage createTestImage() {
    int w = 1024;
    int h = 768;
    BufferedImage img = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
    Graphics2D g = img.createGraphics();
    Color[] colors = { Color.red, Color.green, Color.blue };
    float[] dist = { 0.0f, 0.5f, 1.0f };
    Point2D center = new Point2D.Float(0.5f * w, 0.5f * h);
    RadialGradientPaint p = new RadialGradientPaint(center, 0.5f * w, dist, colors);
    g.setPaint(p);
    g.fillRect(0, 0, w, h);
    g.dispose();
    return img;
}
Also used : Point2D(java.awt.geom.Point2D) Color(java.awt.Color) RadialGradientPaint(java.awt.RadialGradientPaint) RadialGradientPaint(java.awt.RadialGradientPaint) BufferedImage(java.awt.image.BufferedImage) Graphics2D(java.awt.Graphics2D)

Example 18 with Point2D

use of java.awt.geom.Point2D in project jdk8u_jdk by JetBrains.

the class Path2DCopyConstructor method testGetCurrentPoint.

static void testGetCurrentPoint(Path2D pathA, Path2D pathB) {
    final Point2D ptA = pathA.getCurrentPoint();
    final Point2D ptB = pathA.getCurrentPoint();
    if (((ptA == null) && (ptB != null)) || ((ptA != null) && !ptA.equals(ptB))) {
        throw new IllegalStateException("getCurrentPoint() are not equals [" + ptA + "|" + ptB + "] !");
    }
    log("testGetCurrentPoint: passed.");
}
Also used : Point2D(java.awt.geom.Point2D)

Example 19 with Point2D

use of java.awt.geom.Point2D in project jdk8u_jdk by JetBrains.

the class RadialGradientPrintingTest method doPaint.

public void doPaint(Graphics2D g2d) {
    g2d.translate(DIM * 0.2, DIM * 0.2);
    Shape s = new Rectangle2D.Float(0, 0, DIM * 2, DIM * 2);
    // RadialGradientPaint
    Point2D centre = new Point2D.Float(DIM / 2.0f, DIM / 2.0f);
    float radius = DIM / 2.0f;
    Point2D focus = new Point2D.Float(DIM / 3.0f, DIM / 3.0f);
    float[] stops = { 0.0f, 1.0f };
    Color[] colors = { Color.red, Color.white };
    RadialGradientPaint rgp = new RadialGradientPaint(centre, radius, focus, stops, colors, RadialGradientPaint.CycleMethod.NO_CYCLE);
    g2d.setPaint(rgp);
    g2d.fill(s);
    g2d.translate(DIM * 2.2, 0);
    Color[] colors1 = { Color.red, Color.blue, Color.green };
    float[] stops1 = { 0.0f, 0.5f, 1.0f };
    RadialGradientPaint rgp1 = new RadialGradientPaint(centre, radius, focus, stops1, colors1, RadialGradientPaint.CycleMethod.REFLECT);
    g2d.setPaint(rgp1);
    g2d.fill(s);
    g2d.translate(-DIM * 2.2, DIM * 2.2);
    Color[] colors2 = { Color.red, Color.blue, Color.green, Color.white };
    float[] stops2 = { 0.0f, 0.3f, 0.6f, 1.0f };
    RadialGradientPaint rgp2 = new RadialGradientPaint(centre, radius, focus, stops2, colors2, RadialGradientPaint.CycleMethod.REPEAT);
    g2d.setPaint(rgp2);
    g2d.fill(s);
}
Also used : Shape(java.awt.Shape) Point2D(java.awt.geom.Point2D) Color(java.awt.Color) RadialGradientPaint(java.awt.RadialGradientPaint)

Example 20 with Point2D

use of java.awt.geom.Point2D in project GNS by MobilityFirst.

the class EC2Runner method populateIDTableForRunset.

private static void populateIDTableForRunset(String name) {
    AWSCredentials credentials = null;
    try {
        //
        credentials = new PropertiesCredentials(new File(CREDENTIALSFILE));
    } catch (IOException e) {
        System.out.println("Problem contacting EC2 instances: " + e);
    }
    //Create Amazon Client object
    AmazonEC2 ec2 = new AmazonEC2Client(credentials);
    for (RegionRecord region : RegionRecord.values()) {
        AWSEC2.setRegion(ec2, region);
        System.out.println("Retrieving instance information in " + region.name() + "...");
        for (Instance instance : AWSEC2.getInstances(ec2)) {
            if (!instance.getState().getName().equals(InstanceStateRecord.TERMINATED.getName())) {
                String idString = getTagValue(instance, "id");
                if (idString != null && name.equals(getTagValue(instance, "runset"))) {
                    String id = new String(idString);
                    String hostname = instance.getPublicDnsName();
                    String ip = getHostIPSafe(hostname);
                    // and take a guess at the location (lat, long) of this host
                    Point2D location = GEOLocator.lookupIPLocation(ip);
                    hostTable.put(id, new HostInfo(id, hostname, location));
                }
            }
        }
    }
}
Also used : AmazonEC2Client(com.amazonaws.services.ec2.AmazonEC2Client) Instance(com.amazonaws.services.ec2.model.Instance) Point2D(java.awt.geom.Point2D) PropertiesCredentials(com.amazonaws.auth.PropertiesCredentials) IOException(java.io.IOException) AmazonEC2(com.amazonaws.services.ec2.AmazonEC2) AWSCredentials(com.amazonaws.auth.AWSCredentials) File(java.io.File) RegionRecord(edu.umass.cs.aws.support.RegionRecord)

Aggregations

Point2D (java.awt.geom.Point2D)159 Rectangle2D (java.awt.geom.Rectangle2D)18 Color (java.awt.Color)12 RadialGradientPaint (java.awt.RadialGradientPaint)10 AffineTransform (java.awt.geom.AffineTransform)10 Line2D (java.awt.geom.Line2D)9 Paint (java.awt.Paint)8 Graphics2D (java.awt.Graphics2D)7 BufferedImage (java.awt.image.BufferedImage)7 Element (org.jdom2.Element)6 BasicStroke (java.awt.BasicStroke)5 IOException (java.io.IOException)5 LinearGradientPaint (java.awt.LinearGradientPaint)4 Point (java.awt.Point)4 Rectangle (java.awt.Rectangle)4 NodeRef (dr.evolution.tree.NodeRef)3 RenderableBlock (edu.mit.blocks.renderable.RenderableBlock)3 Arc2D (java.awt.geom.Arc2D)3 Test (org.junit.Test)3 AWSCredentials (com.amazonaws.auth.AWSCredentials)2