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;
}
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;
}
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.");
}
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);
}
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));
}
}
}
}
}
Aggregations