Java Code Examples for javafx.scene.shape.Rectangle#getY()

The following examples show how to use javafx.scene.shape.Rectangle#getY() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Sprite.java    From Aidos with GNU General Public License v3.0 6 votes vote down vote up
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);
    }
}
 
Example 2
Source File: Helper.java    From tilesfx with Apache License 2.0 6 votes vote down vote up
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);
}
 
Example 3
Source File: ConicalGradient.java    From tilesfx with Apache License 2.0 5 votes vote down vote up
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);
}
 
Example 4
Source File: ConicalGradient.java    From Medusa with Apache License 2.0 5 votes vote down vote up
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);
}
 
Example 5
Source File: ConicalGradient.java    From regulators with Apache License 2.0 5 votes vote down vote up
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);
}
 
Example 6
Source File: Exercise_14_23.java    From Intro-to-Java-Programming with MIT License 5 votes vote down vote up
/** 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();
}
 
Example 7
Source File: Shape2Geometry.java    From gef with Eclipse Public License 2.0 3 votes vote down vote up
/**
 * 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());
}
 
Example 8
Source File: Shape2Geometry.java    From gef with Eclipse Public License 2.0 2 votes vote down vote up
/**
 * 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());
}