本文整理匯總了Java中java.awt.geom.Ellipse2D.setFrame方法的典型用法代碼示例。如果您正苦於以下問題:Java Ellipse2D.setFrame方法的具體用法?Java Ellipse2D.setFrame怎麽用?Java Ellipse2D.setFrame使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.awt.geom.Ellipse2D
的用法示例。
在下文中一共展示了Ellipse2D.setFrame方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: runTest
import java.awt.geom.Ellipse2D; //導入方法依賴的package包/類
public void runTest(Object ctx, int numReps) {
FillEllipse2Ds.Context cctx = (FillEllipse2Ds.Context) ctx;
int size = cctx.size;
int x = cctx.initX;
int y = cctx.initY;
Ellipse2D ellipse = cctx.ellipse;
Graphics2D g2d = (Graphics2D) cctx.graphics;
g2d.translate(cctx.orgX, cctx.orgY);
Color rCArray[] = cctx.colorlist;
int ci = cctx.colorindex;
do {
if (rCArray != null) {
g2d.setColor(rCArray[ci++ & NUM_RANDOMCOLORMASK]);
}
ellipse.setFrame(x, y, size, size);
g2d.fill(ellipse);
if ((x -= 3) < 0) x += cctx.maxX;
if ((y -= 1) < 0) y += cctx.maxY;
} while (--numReps > 0);
cctx.colorindex = ci;
g2d.translate(-cctx.orgX, -cctx.orgY);
}
示例2: getWaferEdge
import java.awt.geom.Ellipse2D; //導入方法依賴的package包/類
/**
* Calculates the location of the waferedge.
*
* @param plotArea the plot area.
*
* @return The wafer edge.
*/
private Ellipse2D getWaferEdge(Rectangle2D plotArea) {
Ellipse2D edge = new Ellipse2D.Double();
double diameter = plotArea.getWidth();
double upperLeftX = plotArea.getX();
double upperLeftY = plotArea.getY();
//get major dimension
if (plotArea.getWidth() != plotArea.getHeight()) {
double major = 0d;
double minor = 0d;
if (plotArea.getWidth() > plotArea.getHeight()) {
major = plotArea.getWidth();
minor = plotArea.getHeight();
}
else {
major = plotArea.getHeight();
minor = plotArea.getWidth();
}
//ellipse diameter is the minor dimension
diameter = minor;
//set upperLeft point
if (plotArea.getWidth() == minor) { // x is minor
upperLeftY = plotArea.getY() + (major - minor) / 2;
}
else { // y is minor
upperLeftX = plotArea.getX() + (major - minor) / 2;
}
}
edge.setFrame(upperLeftX, upperLeftY, diameter, diameter);
return edge;
}
示例3: getWaferEdge
import java.awt.geom.Ellipse2D; //導入方法依賴的package包/類
/**
* Calculates the location of the waferedge.
*
* @param plotArea the plot area.
*
* @return The wafer edge.
*/
protected Ellipse2D getWaferEdge(Rectangle2D plotArea) {
Ellipse2D edge = new Ellipse2D.Double();
double diameter = plotArea.getWidth();
double upperLeftX = plotArea.getX();
double upperLeftY = plotArea.getY();
//get major dimension
if (plotArea.getWidth() != plotArea.getHeight()) {
double major = 0d;
double minor = 0d;
if (plotArea.getWidth() > plotArea.getHeight()) {
major = plotArea.getWidth();
minor = plotArea.getHeight();
}
else {
major = plotArea.getHeight();
minor = plotArea.getWidth();
}
//ellipse diameter is the minor dimension
diameter = minor;
//set upperLeft point
if (plotArea.getWidth() == minor) { // x is minor
upperLeftY = plotArea.getY() + (major - minor) / 2;
}
else { // y is minor
upperLeftX = plotArea.getX() + (major - minor) / 2;
}
}
edge.setFrame(upperLeftX, upperLeftY, diameter, diameter);
return edge;
}