下面列出了javafx.scene.shape.Rectangle#getY ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
public Sprite(Entity e,int actualSize,double playSpeed,Image spriteSheet,List<Rectangle> specifications,double width, double height,int scale, boolean leftToRight){
super();
this.actualSize = actualSize;
this.playSpeed = playSpeed;
this.numberOfFrames=specifications.size();
this.width = width;
this.height = height;
this.scale = scale;
resersePlay = leftToRight;
this.entityReference=e;
hasValidSpriteImages=true;
spriteImages=new Image[specifications.size()];
for (int i = 0; i < specifications.size(); i++) {
Rectangle specification = specifications.get(i);
int x=(int)specification.getX();
int y=(int)specification.getY();
int w=(int)specification.getWidth();
int h=(int)specification.getHeight();
//To DO Check dimensions provided are not going out of spritesheet dimensions\
spriteImages[i]=ImageUtils.crop(spriteSheet, x, y, w, h);
}
}
public static final Point[] smoothSparkLine(final List<Double> DATA_LIST, final double MIN_VALUE, final double MAX_VALUE, final Rectangle GRAPH_BOUNDS, final int NO_OF_DATAPOINTS) {
int size = DATA_LIST.size();
Point[] points = new Point[size];
double low = Statistics.getMin(DATA_LIST);
double high = Statistics.getMax(DATA_LIST);
if (Helper.equals(low, high)) {
low = MIN_VALUE;
high = MAX_VALUE;
}
double range = high - low;
double minX = GRAPH_BOUNDS.getX();
double maxX = minX + GRAPH_BOUNDS.getWidth();
double minY = GRAPH_BOUNDS.getY();
double maxY = minY + GRAPH_BOUNDS.getHeight();
double stepX = GRAPH_BOUNDS.getWidth() / (NO_OF_DATAPOINTS - 1);
double stepY = GRAPH_BOUNDS.getHeight() / range;
for (int i = 0 ; i < size ; i++) {
points[i] = new Point(minX + i * stepX, maxY - Math.abs(low - DATA_LIST.get(i)) * stepY);
}
return Helper.subdividePoints(points, 16);
}
public ImagePattern getImagePattern(final Rectangle BOUNDS) {
double x = BOUNDS.getX();
double y = BOUNDS.getY();
double width = BOUNDS.getWidth();
double height = BOUNDS.getHeight();
centerX = width * 0.5;
centerY = height * 0.5;
return new ImagePattern(getImage(width, height), x, y, width, height, false);
}
public ImagePattern getImagePattern(final Rectangle BOUNDS) {
double x = BOUNDS.getX();
double y = BOUNDS.getY();
double width = BOUNDS.getWidth();
double height = BOUNDS.getHeight();
centerX = width * 0.5;
centerY = height * 0.5;
return new ImagePattern(getImage(width, height), x, y, width, height, false);
}
public ImagePattern getImagePattern(final Rectangle BOUNDS) {
double x = BOUNDS.getX();
double y = BOUNDS.getY();
double width = BOUNDS.getWidth();
double height = BOUNDS.getHeight();
centerX = width * 0.5;
centerY = height * 0.5;
return new ImagePattern(getImage(width, height), x, y, width, height, false);
}
/** Returns true if one rectangle is inside the other */
public boolean contains(Rectangle r1, Rectangle r2) {
return
r2.getY() + r2.getHeight() <= r1.getY() + r1.getHeight() &&
r2.getX() + r2.getWidth() <= r1.getX() + r1.getWidth() &&
r2.getX() > r1.getX() && r2.getY() > r1.getY();
}
/**
* Converts the given JavaFX {@link Rectangle} to a
* {@link org.eclipse.gef.geometry.planar.RoundedRectangle}.
*
* @param rect
* The JavaFX {@link Rectangle} to convert.
* @return The newly created
* {@link org.eclipse.gef.geometry.planar.RoundedRectangle} that
* describes the given {@link Rectangle}.
*/
public static org.eclipse.gef.geometry.planar.RoundedRectangle toRoundedRectangle(
Rectangle rect) {
return new org.eclipse.gef.geometry.planar.RoundedRectangle(
rect.getX(), rect.getY(), rect.getWidth(), rect.getHeight(),
rect.getArcWidth(), rect.getArcHeight());
}
/**
* Converts the given JavaFX {@link Rectangle} to a
* {@link org.eclipse.gef.geometry.planar.Rectangle}. Note, that the
* arc-width and arc-height of the given {@link Rectangle} will not be
* preserved in the resulting geometry.
*
* @param rect
* The JavaFX {@link Rectangle} to convert.
* @return The newly created
* {@link org.eclipse.gef.geometry.planar.Rectangle} that describes
* the given {@link Rectangle} (without its arc-width and
* arc-height).
*/
public static org.eclipse.gef.geometry.planar.Rectangle toRectangle(
Rectangle rect) {
return new org.eclipse.gef.geometry.planar.Rectangle(rect.getX(),
rect.getY(), rect.getWidth(), rect.getHeight());
}