/** * Returns the width of the rendered text. This is the width that should be used when computing * alignment for text in this block. */ public float textWidth() { return bounds.width() - bounds.x(); }
/** * Returns the width of the rendered text. This is the width that should be used when computing * alignment for text in this block. */ public float textWidth() { return bounds.width() - bounds.x(); }
/** * Returns the width of the rendered text. This is the width that should be used when computing * alignment for text in this block. */ public float textWidth() { return bounds.width() - bounds.x(); }
protected TextLayout (String text, TextFormat format, IRectangle bounds, float height) { this.text = text; this.format = format; this.bounds = bounds; // if the x position is positive, we need to include extra space in our full-width for it this.size = new Dimension(Math.max(bounds.x(), 0) + bounds.width(), height); }
protected TextLayout (String text, TextFormat format, IRectangle bounds, float height) { this.text = text; this.format = format; this.bounds = bounds; // if the x position is positive, we need to include extra space in our full-width for it this.size = new Dimension(Math.max(bounds.x(), 0) + bounds.width(), height); }
/** * Expands the bounds of this rectangle to contain the supplied rectangle. */ public void add (IRectangle r) { float x1 = Math.min(x, r.x()); float x2 = Math.max(x + width, r.x() + r.width()); float y1 = Math.min(y, r.y()); float y2 = Math.max(y + height, r.y() + r.height()); setBounds(x1, y1, x2 - x1, y2 - y1); }
Iterator (IRectangle r, Transform at) { this.x = r.x(); this.y = r.y(); this.width = r.width(); this.height = r.height(); this.t = at; if (width < 0f || height < 0f) { index = 6; } }
/** * Constructs a rectangle with bounds equal to the supplied rectangle. */ public Rectangle (IRectangle r) { setBounds(r.x(), r.y(), r.width(), r.height()); }
/** * Sets the bounds of this rectangle to those of the supplied rectangle. */ public void setBounds (IRectangle r) { setBounds(r.x(), r.y(), r.width(), r.height()); }
/** * Gets a Region instance bounded by the given dimensions as defined as percentages of this * GestureRegionDirector's defined bounds. Null may be returned if suitable bounds are not found * or a conflicting Region was already defined on this GestureRegionDirector. */ public GestureDirector getPercentRegion (IRectangle bounds) { return getRegion(bounds.x(), bounds.y(), bounds.width(), bounds.height()); }
/** * Returns an instance that can be used to render a sub-region of this texture. */ public Tile tile (IRectangle region) { return tile(region.x(), region.y(), region.width(), region.height()); }
/** * Constructs a rectangle with bounds equal to the supplied rectangle. */ public Rectangle (IRectangle r) { setBounds(r.x(), r.y(), r.width(), r.height()); }
/** * Sets the location, size, angular extents, and closure type of this arc to the specified * values. */ public void setArc (IRectangle rect, float start, float extent, int type) { setArc(rect.x(), rect.y(), rect.width(), rect.height(), start, extent, type); }
/** * Sets the bounds of this rectangle to those of the supplied rectangle. */ public void setBounds (IRectangle r) { setBounds(r.x(), r.y(), r.width(), r.height()); }
@Override // from interface IShape public boolean intersects (IRectangle rect) { return intersects(rect.x(), rect.y(), rect.width(), rect.height()); }
@Override // from interface IShape public boolean intersects (IRectangle r) { return intersects(r.x(), r.y(), r.width(), r.height()); }
@Override // from interface IShape public boolean intersects (IRectangle r) { return intersects(r.x(), r.y(), r.width(), r.height()); }
/** * Strokes {@code lines} into {@code canvas} at the specified coordinates, using the specified * alignment. */ public void stroke(Canvas canvas, Align align, float x, float y) { float sy = y + bounds.y(); for (TextLayout line : lines) { float sx = x + bounds.x() + align.getX(line.size.width(), textWidth()); canvas.strokeText(line, sx, sy); sy += line.ascent() + line.descent() + line.leading(); } }
/** * Fills {@code lines} into {@code canvas} at the specified coordinates, using the specified * alignment. */ public void fill(Canvas canvas, Align align, float x, float y) { float sy = y + bounds.y(); for (TextLayout line : lines) { float sx = x + bounds.x() + align.getX(line.width(), textWidth()); canvas.fillText(line, sx, sy); sy += line.ascent() + line.descent() + line.leading(); } }
/** * Fills {@code lines} into {@code canvas} at the specified coordinates, using the specified * alignment. */ public void fill(Canvas canvas, Align align, float x, float y) { float sy = y + bounds.y(); for (TextLayout line : lines) { float sx = x + bounds.x() + align.getX(line.size.width(), textWidth()); canvas.fillText(line, sx, sy); sy += line.ascent() + line.descent() + line.leading(); } }