Java Code Examples for java.awt.geom.Rectangle2D#setRect()
The following examples show how to use
java.awt.geom.Rectangle2D#setRect() .
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: StandardXYItemRendererTest.java From buffer_bci with GNU General Public License v3.0 | 6 votes |
/** * Confirm that cloning works. */ @Test public void testCloning() throws CloneNotSupportedException { StandardXYItemRenderer r1 = new StandardXYItemRenderer(); Rectangle2D rect1 = new Rectangle2D.Double(1.0, 2.0, 3.0, 4.0); r1.setLegendLine(rect1); StandardXYItemRenderer r2 = (StandardXYItemRenderer) r1.clone(); assertTrue(r1 != r2); assertTrue(r1.getClass() == r2.getClass()); assertTrue(r1.equals(r2)); // check independence rect1.setRect(4.0, 3.0, 2.0, 1.0); assertFalse(r1.equals(r2)); r2.setLegendLine(new Rectangle2D.Double(4.0, 3.0, 2.0, 1.0)); assertTrue(r1.equals(r2)); r1.setSeriesShapesFilled(1, Boolean.TRUE); assertFalse(r1.equals(r2)); r2.setSeriesShapesFilled(1, Boolean.TRUE); assertTrue(r1.equals(r2)); }
Example 2
Source File: TextLayout.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
/** * Returns the bounds of this <code>TextLayout</code>. * The bounds are in standard coordinates. * <p>Due to rasterization effects, this bounds might not enclose all of the * pixels rendered by the TextLayout.</p> * It might not coincide exactly with the ascent, descent, * origin or advance of the <code>TextLayout</code>. * @return a {@link Rectangle2D} that is the bounds of this * <code>TextLayout</code>. */ public Rectangle2D getBounds() { ensureCache(); if (boundsRect == null) { Rectangle2D vb = textLine.getVisualBounds(); if (dx != 0 || dy != 0) { vb.setRect(vb.getX() - dx, vb.getY() - dy, vb.getWidth(), vb.getHeight()); } boundsRect = vb; } Rectangle2D bounds = new Rectangle2D.Float(); bounds.setRect(boundsRect); return bounds; }
Example 3
Source File: ScalingDrawable.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 6 votes |
/** * Draws the object. * * @param g2 * the graphics device. * @param area * the area inside which the object should be drawn. */ public void draw( final Graphics2D g2, final Rectangle2D area ) { final Object drawable = getBackend(); if ( drawable == null ) { return; } if ( drawable instanceof ReportDrawable ) { final ReportDrawable reportDrawable = (ReportDrawable) drawable; reportDrawable.setConfiguration( getConfiguration() ); reportDrawable.setResourceBundleFactory( getResourceBundleFactory() ); reportDrawable.setStyleSheet( getStyleSheet() ); } final Graphics2D derived = (Graphics2D) g2.create(); derived.scale( scaleX, scaleY ); final Rectangle2D scaledArea = (Rectangle2D) area.clone(); scaledArea.setRect( scaledArea.getX() * scaleX, scaledArea.getY() * scaleY, scaledArea.getWidth() * scaleX, scaledArea.getHeight() * scaleY ); super.draw( derived, scaledArea ); derived.dispose(); }
Example 4
Source File: StandardGlyphVector.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
public GlyphMetrics getGlyphMetrics(int ix) { if (ix < 0 || ix >= glyphs.length) { throw new IndexOutOfBoundsException("ix = " + ix); } Rectangle2D vb = getGlyphVisualBounds(ix).getBounds2D(); Point2D pt = getGlyphPosition(ix); vb.setRect(vb.getMinX() - pt.getX(), vb.getMinY() - pt.getY(), vb.getWidth(), vb.getHeight()); Point2D.Float adv = getGlyphStrike(ix).strike.getGlyphMetrics(glyphs[ix]); GlyphMetrics gm = new GlyphMetrics(true, adv.x, adv.y, vb, GlyphMetrics.STANDARD); return gm; }
Example 5
Source File: LegendItemCollectionTest.java From buffer_bci with GNU General Public License v3.0 | 6 votes |
/** * Confirm that cloning works. */ @Test public void testCloning() throws CloneNotSupportedException { LegendItemCollection c1 = new LegendItemCollection(); LegendItem item1 = new LegendItem("Item 1"); c1.add(item1); LegendItemCollection c2 = (LegendItemCollection) c1.clone(); assertNotSame(c1, c2); assertSame(c1.getClass(), c2.getClass()); assertEquals(c1, c2); Rectangle2D item1Shape = (Rectangle2D) item1.getShape(); item1Shape.setRect(1.0, 2.0, 3.0, 4.0); assertFalse(c1.equals(c2)); }
Example 6
Source File: GlyphPainter2.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
public Shape modelToView(GlyphView v, int pos, Position.Bias bias, Shape a) throws BadLocationException { int offs = pos - v.getStartOffset(); Rectangle2D alloc = a.getBounds2D(); TextHitInfo hit = (bias == Position.Bias.Forward) ? TextHitInfo.afterOffset(offs) : TextHitInfo.beforeOffset(offs); float[] locs = layout.getCaretInfo(hit); // vertical at the baseline, should use slope and check if glyphs // are being rendered vertically. alloc.setRect(alloc.getX() + locs[0], alloc.getY(), 1, alloc.getHeight()); return alloc; }
Example 7
Source File: TextLine.java From jdk1.8-source-analysis with Apache License 2.0 | 5 votes |
public Rectangle2D getCharBounds(int logicalIndex) { if (logicalIndex < 0) { throw new IllegalArgumentException("Negative logicalIndex."); } int tlcStart = 0; for (int i=0; i < fComponents.length; i++) { int tlcLimit = tlcStart + fComponents[i].getNumCharacters(); if (tlcLimit > logicalIndex) { TextLineComponent tlc = fComponents[i]; int indexInTlc = logicalIndex - tlcStart; Rectangle2D chBounds = tlc.getCharVisualBounds(indexInTlc); int vi = getComponentVisualIndex(i); chBounds.setRect(chBounds.getX() + locs[vi * 2], chBounds.getY() + locs[vi * 2 + 1], chBounds.getWidth(), chBounds.getHeight()); return chBounds; } else { tlcStart = tlcLimit; } } throw new IllegalArgumentException("logicalIndex too large."); }
Example 8
Source File: StandardGlyphVector.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
Rectangle2D getGlyphOutlineBounds(int glyphID, float x, float y) { Rectangle2D result = null; if (sgv.invdtx == null) { result = new Rectangle2D.Float(); result.setRect(strike.getGlyphOutlineBounds(glyphID)); // don't mutate cached rect } else { if (sgv.invdtx.getShearX() == 0 && sgv.invdtx.getShearY() == 0) { final Rectangle2D.Float rect = strike.getGlyphOutlineBounds(glyphID); result = new Rectangle2D.Float( (float)(rect.x*sgv.invdtx.getScaleX() + sgv.invdtx.getTranslateX()), (float)(rect.y*sgv.invdtx.getScaleY() + sgv.invdtx.getTranslateY()), (float)(rect.width*sgv.invdtx.getScaleX()), (float)(rect.height*sgv.invdtx.getScaleY())); } else { GeneralPath gp = strike.getGlyphOutline(glyphID, 0, 0); gp.transform(sgv.invdtx); result = gp.getBounds2D(); } } /* Since x is the logical advance of the glyph to this point. * Because of the way that Rectangle.union is specified, this * means that subsequent unioning of a rect including that * will be affected, even if the glyph is empty. So skip such * cases. This alone isn't a complete solution since x==0 * may also not be what is wanted. The code that does the * unioning also needs to be aware to ignore empty glyphs. */ if (!result.isEmpty()) { result.setRect(result.getMinX() + x + dx, result.getMinY() + y + dy, result.getWidth(), result.getHeight()); } return result; }
Example 9
Source File: GlyphPainter2.java From jdk1.8-source-analysis with Apache License 2.0 | 5 votes |
public Shape modelToView(GlyphView v, int pos, Position.Bias bias, Shape a) throws BadLocationException { int offs = pos - v.getStartOffset(); Rectangle2D alloc = a.getBounds2D(); TextHitInfo hit = (bias == Position.Bias.Forward) ? TextHitInfo.afterOffset(offs) : TextHitInfo.beforeOffset(offs); float[] locs = layout.getCaretInfo(hit); // vertical at the baseline, should use slope and check if glyphs // are being rendered vertically. alloc.setRect(alloc.getX() + locs[0], alloc.getY(), 1, alloc.getHeight()); return alloc; }
Example 10
Source File: GlyphPainter2.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
public Shape modelToView(GlyphView v, int pos, Position.Bias bias, Shape a) throws BadLocationException { int offs = pos - v.getStartOffset(); Rectangle2D alloc = a.getBounds2D(); TextHitInfo hit = (bias == Position.Bias.Forward) ? TextHitInfo.afterOffset(offs) : TextHitInfo.beforeOffset(offs); float[] locs = layout.getCaretInfo(hit); // vertical at the baseline, should use slope and check if glyphs // are being rendered vertically. alloc.setRect(alloc.getX() + locs[0], alloc.getY(), 1, alloc.getHeight()); return alloc; }
Example 11
Source File: MultiplePiePlotTest.java From openstock with GNU General Public License v3.0 | 5 votes |
/** * Some basic checks for the clone() method. */ @Test public void testCloning() throws CloneNotSupportedException { MultiplePiePlot p1 = new MultiplePiePlot(); Rectangle2D rect = new Rectangle2D.Double(1.0, 2.0, 3.0, 4.0); p1.setLegendItemShape(rect); MultiplePiePlot p2 = (MultiplePiePlot) p1.clone(); assertTrue(p1 != p2); assertTrue(p1.getClass() == p2.getClass()); assertTrue(p1.equals(p2)); // check independence rect.setRect(2.0, 3.0, 4.0, 5.0); assertFalse(p1.equals(p2)); }
Example 12
Source File: AxisSpace.java From ECG-Viewer with GNU General Public License v2.0 | 5 votes |
/** * Expands an area by the amount of space represented by this object. * * @param area the area to expand. * @param result an optional carrier for the result. * * @return The result. */ public Rectangle2D expand(Rectangle2D area, Rectangle2D result) { if (result == null) { result = new Rectangle2D.Double(); } result.setRect( area.getX() - this.left, area.getY() - this.top, area.getWidth() + this.left + this.right, area.getHeight() + this.top + this.bottom ); return result; }
Example 13
Source File: ExtendedTextSourceLabel.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
public Rectangle2D getCharVisualBounds(int index, float x, float y) { Rectangle2D bounds = decorator.getCharVisualBounds(this, index); if (x != 0 || y != 0) { bounds.setRect(bounds.getX()+x, bounds.getY()+y, bounds.getWidth(), bounds.getHeight()); } return bounds; }
Example 14
Source File: ExtendedTextSourceLabel.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
public Rectangle2D getCharVisualBounds(int index, float x, float y) { Rectangle2D bounds = decorator.getCharVisualBounds(this, index); if (x != 0 || y != 0) { bounds.setRect(bounds.getX()+x, bounds.getY()+y, bounds.getWidth(), bounds.getHeight()); } return bounds; }
Example 15
Source File: TextLine.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * Return the union of the visual bounds of all the components. * This incorporates the path. It does not include logical * bounds (used by carets). */ public Rectangle2D getVisualBounds() { Rectangle2D result = null; for (int i = 0, n = 0; i < fComponents.length; i++, n += 2) { TextLineComponent tlc = fComponents[getComponentLogicalIndex(i)]; Rectangle2D r = tlc.getVisualBounds(); Point2D.Float pt = new Point2D.Float(locs[n], locs[n+1]); if (lp == null) { r.setRect(r.getMinX() + pt.x, r.getMinY() + pt.y, r.getWidth(), r.getHeight()); } else { lp.pathToPoint(pt, false, pt); AffineTransform at = tlc.getBaselineTransform(); if (at != null) { AffineTransform tx = AffineTransform.getTranslateInstance (pt.x - at.getTranslateX(), pt.y - at.getTranslateY()); tx.concatenate(at); r = tx.createTransformedShape(r).getBounds2D(); } else { r.setRect(r.getMinX() + pt.x, r.getMinY() + pt.y, r.getWidth(), r.getHeight()); } } if (result == null) { result = r; } else { result.add(r); } } if (result == null) { result = new Rectangle2D.Float(Float.MAX_VALUE, Float.MAX_VALUE, Float.MIN_VALUE, Float.MIN_VALUE); } return result; }
Example 16
Source File: TextUtils.java From buffer_bci with GNU General Public License v3.0 | 4 votes |
/** * A utility method that calculates the anchor offsets for a string. * Normally, the (x, y) coordinate for drawing text is a point on the * baseline at the left of the text string. If you add these offsets to * (x, y) and draw the string, then the anchor point should coincide with * the (x, y) point. * * @param g2 the graphics device (not <code>null</code>). * @param text the text. * @param anchor the anchor point. * @param textBounds the text bounds (if not <code>null</code>, this * object will be updated by this method to match the * string bounds). * * @return The offsets. */ private static float[] deriveTextBoundsAnchorOffsets(Graphics2D g2, String text, TextAnchor anchor, Rectangle2D textBounds) { float[] result = new float[3]; FontRenderContext frc = g2.getFontRenderContext(); Font f = g2.getFont(); FontMetrics fm = g2.getFontMetrics(f); Rectangle2D bounds = getTextBounds(text, fm); LineMetrics metrics = f.getLineMetrics(text, frc); float ascent = metrics.getAscent(); result[2] = -ascent; float halfAscent = ascent / 2.0f; float descent = metrics.getDescent(); float leading = metrics.getLeading(); float xAdj = 0.0f; float yAdj = 0.0f; if (anchor.isHorizontalCenter()) { xAdj = (float) -bounds.getWidth() / 2.0f; } else if (anchor.isRight()) { xAdj = (float) -bounds.getWidth(); } if (anchor.isTop()) { yAdj = -descent - leading + (float) bounds.getHeight(); } else if (anchor.isHalfAscent()) { yAdj = halfAscent; } else if (anchor.isHorizontalCenter()) { yAdj = -descent - leading + (float) (bounds.getHeight() / 2.0); } else if (anchor.isBaseline()) { yAdj = 0.0f; } else if (anchor.isBottom()) { yAdj = -metrics.getDescent() - metrics.getLeading(); } if (textBounds != null) { textBounds.setRect(bounds); } result[0] = xAdj; result[1] = yAdj; return result; }
Example 17
Source File: TextUtilities.java From astor with GNU General Public License v2.0 | 4 votes |
/** * A utility method that calculates the anchor offsets for a string. * Normally, the (x, y) coordinate for drawing text is a point on the * baseline at the left of the text string. If you add these offsets to * (x, y) and draw the string, then the anchor point should coincide with * the (x, y) point. * * @param g2 the graphics device (not <code>null</code>). * @param text the text. * @param anchor the anchor point. * @param textBounds the text bounds (if not <code>null</code>, this * object will be updated by this method to match the * string bounds). * * @return The offsets. */ private static float[] deriveTextBoundsAnchorOffsets(Graphics2D g2, String text, TextAnchor anchor, Rectangle2D textBounds) { float[] result = new float[3]; FontRenderContext frc = g2.getFontRenderContext(); Font f = g2.getFont(); FontMetrics fm = g2.getFontMetrics(f); Rectangle2D bounds = TextUtilities.getTextBounds(text, g2, fm); LineMetrics metrics = f.getLineMetrics(text, frc); float ascent = metrics.getAscent(); result[2] = -ascent; float halfAscent = ascent / 2.0f; float descent = metrics.getDescent(); float leading = metrics.getLeading(); float xAdj = 0.0f; float yAdj = 0.0f; if (anchor == TextAnchor.TOP_CENTER || anchor == TextAnchor.CENTER || anchor == TextAnchor.BOTTOM_CENTER || anchor == TextAnchor.BASELINE_CENTER || anchor == TextAnchor.HALF_ASCENT_CENTER) { xAdj = (float) -bounds.getWidth() / 2.0f; } else if (anchor == TextAnchor.TOP_RIGHT || anchor == TextAnchor.CENTER_RIGHT || anchor == TextAnchor.BOTTOM_RIGHT || anchor == TextAnchor.BASELINE_RIGHT || anchor == TextAnchor.HALF_ASCENT_RIGHT) { xAdj = (float) -bounds.getWidth(); } if (anchor == TextAnchor.TOP_LEFT || anchor == TextAnchor.TOP_CENTER || anchor == TextAnchor.TOP_RIGHT) { yAdj = -descent - leading + (float) bounds.getHeight(); } else if (anchor == TextAnchor.HALF_ASCENT_LEFT || anchor == TextAnchor.HALF_ASCENT_CENTER || anchor == TextAnchor.HALF_ASCENT_RIGHT) { yAdj = halfAscent; } else if (anchor == TextAnchor.CENTER_LEFT || anchor == TextAnchor.CENTER || anchor == TextAnchor.CENTER_RIGHT) { yAdj = -descent - leading + (float) (bounds.getHeight() / 2.0); } else if (anchor == TextAnchor.BASELINE_LEFT || anchor == TextAnchor.BASELINE_CENTER || anchor == TextAnchor.BASELINE_RIGHT) { yAdj = 0.0f; } else if (anchor == TextAnchor.BOTTOM_LEFT || anchor == TextAnchor.BOTTOM_CENTER || anchor == TextAnchor.BOTTOM_RIGHT) { yAdj = -metrics.getDescent() - metrics.getLeading(); } if (textBounds != null) { textBounds.setRect(bounds); } result[0] = xAdj; result[1] = yAdj; return result; }
Example 18
Source File: XYTitleAnnotation.java From ccu-historian with GNU General Public License v3.0 | 4 votes |
/** * Draws the annotation. This method is called by the drawing code in the * {@link XYPlot} class, you don't normally need to call this method * directly. * * @param g2 the graphics device. * @param plot the plot. * @param dataArea the data area. * @param domainAxis the domain axis. * @param rangeAxis the range axis. * @param rendererIndex the renderer index. * @param info if supplied, this info object will be populated with * entity information. */ @Override public void draw(Graphics2D g2, XYPlot plot, Rectangle2D dataArea, ValueAxis domainAxis, ValueAxis rangeAxis, int rendererIndex, PlotRenderingInfo info) { PlotOrientation orientation = plot.getOrientation(); AxisLocation domainAxisLocation = plot.getDomainAxisLocation(); AxisLocation rangeAxisLocation = plot.getRangeAxisLocation(); RectangleEdge domainEdge = Plot.resolveDomainAxisLocation( domainAxisLocation, orientation); RectangleEdge rangeEdge = Plot.resolveRangeAxisLocation( rangeAxisLocation, orientation); Range xRange = domainAxis.getRange(); Range yRange = rangeAxis.getRange(); double anchorX, anchorY; if (this.coordinateType == XYCoordinateType.RELATIVE) { anchorX = xRange.getLowerBound() + (this.x * xRange.getLength()); anchorY = yRange.getLowerBound() + (this.y * yRange.getLength()); } else { anchorX = domainAxis.valueToJava2D(this.x, dataArea, domainEdge); anchorY = rangeAxis.valueToJava2D(this.y, dataArea, rangeEdge); } float j2DX = (float) domainAxis.valueToJava2D(anchorX, dataArea, domainEdge); float j2DY = (float) rangeAxis.valueToJava2D(anchorY, dataArea, rangeEdge); float xx = 0.0f; float yy = 0.0f; if (orientation == PlotOrientation.HORIZONTAL) { xx = j2DY; yy = j2DX; } else if (orientation == PlotOrientation.VERTICAL) { xx = j2DX; yy = j2DY; } double maxW = dataArea.getWidth(); double maxH = dataArea.getHeight(); if (this.coordinateType == XYCoordinateType.RELATIVE) { if (this.maxWidth > 0.0) { maxW = maxW * this.maxWidth; } if (this.maxHeight > 0.0) { maxH = maxH * this.maxHeight; } } if (this.coordinateType == XYCoordinateType.DATA) { maxW = this.maxWidth; maxH = this.maxHeight; } RectangleConstraint rc = new RectangleConstraint( new Range(0, maxW), new Range(0, maxH)); Size2D size = this.title.arrange(g2, rc); Rectangle2D titleRect = new Rectangle2D.Double(0, 0, size.width, size.height); Point2D anchorPoint = RectangleAnchor.coordinates(titleRect, this.anchor); xx = xx - (float) anchorPoint.getX(); yy = yy - (float) anchorPoint.getY(); titleRect.setRect(xx, yy, titleRect.getWidth(), titleRect.getHeight()); BlockParams p = new BlockParams(); if (info != null) { if (info.getOwner().getEntityCollection() != null) { p.setGenerateEntities(true); } } Object result = this.title.draw(g2, titleRect, p); if (info != null) { if (result instanceof EntityBlockResult) { EntityBlockResult ebr = (EntityBlockResult) result; info.getOwner().getEntityCollection().addAll( ebr.getEntityCollection()); } String toolTip = getToolTipText(); String url = getURL(); if (toolTip != null || url != null) { addEntity(info, new Rectangle2D.Float(xx, yy, (float) size.width, (float) size.height), rendererIndex, toolTip, url); } } }
Example 19
Source File: CombinedDomainCategoryPlot.java From opensim-gui with Apache License 2.0 | 4 votes |
/** * Draws the plot on a Java 2D graphics device (such as the screen or a * printer). Will perform all the placement calculations for each of the * sub-plots and then tell these to draw themselves. * * @param g2 the graphics device. * @param area the area within which the plot (including axis labels) * should be drawn. * @param anchor the anchor point (<code>null</code> permitted). * @param parentState the state from the parent plot, if there is one. * @param info collects information about the drawing (<code>null</code> * permitted). */ public void draw(Graphics2D g2, Rectangle2D area, Point2D anchor, PlotState parentState, PlotRenderingInfo info) { // set up info collection... if (info != null) { info.setPlotArea(area); } // adjust the drawing area for plot insets (if any)... RectangleInsets insets = getInsets(); area.setRect(area.getX() + insets.getLeft(), area.getY() + insets.getTop(), area.getWidth() - insets.getLeft() - insets.getRight(), area.getHeight() - insets.getTop() - insets.getBottom()); // calculate the data area... setFixedRangeAxisSpaceForSubplots(null); AxisSpace space = calculateAxisSpace(g2, area); Rectangle2D dataArea = space.shrink(area, null); // set the width and height of non-shared axis of all sub-plots setFixedRangeAxisSpaceForSubplots(space); // draw the shared axis CategoryAxis axis = getDomainAxis(); RectangleEdge domainEdge = getDomainAxisEdge(); double cursor = RectangleEdge.coordinate(dataArea, domainEdge); AxisState axisState = axis.draw(g2, cursor, area, dataArea, domainEdge, info); if (parentState == null) { parentState = new PlotState(); } parentState.getSharedAxisStates().put(axis, axisState); // draw all the subplots for (int i = 0; i < this.subplots.size(); i++) { CategoryPlot plot = (CategoryPlot) this.subplots.get(i); PlotRenderingInfo subplotInfo = null; if (info != null) { subplotInfo = new PlotRenderingInfo(info.getOwner()); info.addSubplotInfo(subplotInfo); } plot.draw(g2, this.subplotAreas[i], null, parentState, subplotInfo); } if (info != null) { info.setDataArea(dataArea); } }
Example 20
Source File: TextUtils.java From openstock with GNU General Public License v3.0 | 3 votes |
/** * Returns the bounds of an aligned string. * * @param text the string (<code>null</code> not permitted). * @param g2 the graphics target (<code>null</code> not permitted). * @param x the x-coordinate. * @param y the y-coordinate. * @param anchor the anchor point that will be aligned to * <code>(x, y)</code> (<code>null</code> not permitted). * * @return The text bounds (never <code>null</code>). * * @since 1.3 */ public static Rectangle2D calcAlignedStringBounds(String text, Graphics2D g2, float x, float y, TextAnchor anchor) { Rectangle2D textBounds = new Rectangle2D.Double(); float[] adjust = deriveTextBoundsAnchorOffsets(g2, text, anchor, textBounds); // adjust text bounds to match string position textBounds.setRect(x + adjust[0], y + adjust[1] + adjust[2], textBounds.getWidth(), textBounds.getHeight()); return textBounds; }