position.getCategoryAnchor()); TextBlock block = tick.getLabel(); block.draw(g2, (float) anchorPoint.getX(), (float) anchorPoint.getY(), position.getLabelAnchor(), (float) anchorPoint.getX(), (float) anchorPoint.getY(), position.getAngle()); Shape bounds = block.calculateBounds(g2, (float) anchorPoint.getX(), (float) anchorPoint.getY(), position.getLabelAnchor(), (float) anchorPoint.getX(),
TextBlock notesBlock = TextUtilities.createTextBlock( someLongString, plainFont, g2.getPaint()); notesBlock.setLineAlignment(HorizontalAlignment.LEFT); notesBlock.draw(g2, indent, y, TextBlockAnchor.TOP_LEFT);
/** * Draws the text block at a specific location. * * @param g2 the graphics device. * @param x the x-coordinate for the anchor point. * @param y the y-coordinate for the anchor point. * @param anchor the anchor point. */ public void draw(final Graphics2D g2, final float x, final float y, final TextBlockAnchor anchor) { draw(g2, x, y, anchor, 0.0f, 0.0f, 0.0); }
final float x, final float y, final RectangleAnchor anchor) { final Size2D d1 = this.textBlock.calculateDimensions(g2); final double w = this.interiorGap.extendWidth(d1.getWidth()); final double h = this.interiorGap.extendHeight(d1.getHeight()); this.textBlock.draw(g2, (float) (xx + this.interiorGap.calculateLeftInset(w)), (float) (yy + this.interiorGap.calculateTopInset(h)),
final TextMeasurer measurer) { final TextBlock result = new TextBlock(); final BreakIterator iterator = BreakIterator.getLineInstance(); iterator.setText(text); measurer); if (next == BreakIterator.DONE) { result.addLine(text.substring(current), font, paint); return result; result.addLine(text.substring(current, next), font, paint); lines++; current = next; final TextLine lastLine = result.getLastLine(); final TextFragment lastFragment = lastLine.getLastTextFragment(); final String oldStr = lastFragment.getText();
final double angle) { final Size2D d = calculateDimensions(g2); final float[] offsets = calculateOffsets( anchor, d.getWidth(), d.getHeight() );
/** * Returns the height of the text box. * * @param g2 the graphics device. * * @return The height (in Java2D units). */ public double getHeight(final Graphics2D g2) { final Size2D d = this.textBlock.calculateDimensions(g2); return this.interiorGap.extendHeight(d.getHeight()); }
TextLine line = new TextLine(s, this.sublabelFont, this.sublabelPaint); label.addLine(line); TextLine line = label.getLastLine(); if (line != null) { line.addFragment(new TextFragment(" " + s,
this.paint, maxWidth, this.maximumLinesToDisplay, new G2TextMeasurer(g2)); this.content.setLineAlignment(this.textAlignment); Size2D contentSize = this.content.calculateDimensions(g2); if (this.expandToFitSpace) { return new Size2D(maxWidth, contentSize.getHeight()); this.paint, maxWidth, this.maximumLinesToDisplay, new G2TextMeasurer(g2)); this.content.setLineAlignment(this.textAlignment); Size2D contentSize = this.content.calculateDimensions(g2);
/** * Returns a hash code for this object. * * @return A hash code. */ public int hashCode() { int result = 41; result = 37 * result + this.category.hashCode(); result = 37 * result + this.label.hashCode(); result = 37 * result + this.labelAnchor.hashCode(); return result; } }
/** * Adds a line of text that will be displayed using the specified font. * * @param text the text. * @param font the font. * @param paint the paint. */ public void addLine(final String text, final Font font, final Paint paint) { addLine(new TextLine(text, font, paint)); }
TextBlock t1 = new TextBlock(); t1.TextWrapping = TextWrapping.Wrap; t1.Text = "this is test "; TextBlock t2 = new TextBlock(); t2.TextWrapping = TextWrapping.Wrap; t2.Text = " this is test."; Image img = new Image(); img.Height = img.Height = 20; img.Stretch = System.Windows.Media.Stretch.Uniform; img.Source = new BitmapImage(new Uri("icon.png", UriKind.Relative)); sp.Children.Add(t1); sp.Children.Add(img); sp.Children.Add(t2);
/** * Draws the text block at a specific location. * * @param g2 the graphics device. * @param x the x-coordinate for the anchor point. * @param y the y-coordinate for the anchor point. * @param anchor the anchor point. */ public void draw(final Graphics2D g2, final float x, final float y, final TextBlockAnchor anchor) { draw(g2, x, y, anchor, 0.0f, 0.0f, 0.0); }
final float x, final float y, final RectangleAnchor anchor) { final Size2D d1 = this.textBlock.calculateDimensions(g2); final double w = this.interiorGap.extendWidth(d1.getWidth()); final double h = this.interiorGap.extendHeight(d1.getHeight()); this.textBlock.draw(g2, (float) (xx + this.interiorGap.calculateLeftInset(w)), (float) (yy + this.interiorGap.calculateTopInset(h)),
Paint paint, float maxWidth, int maxLines, TextMeasurer measurer) { TextBlock result = new TextBlock(); BreakIterator iterator = BreakIterator.getLineInstance(); iterator.setText(text); measurer); if (next == BreakIterator.DONE) { result.addLine(text.substring(current), font, paint); return result; } else if (next == current) { result.addLine(text.substring(current, next), font, paint); lines++; current = next; TextLine lastLine = result.getLastLine(); TextFragment lastFragment = lastLine.getLastTextFragment(); String oldStr = lastFragment.getText();
final double angle) { final Size2D d = calculateDimensions(g2); final float[] offsets = calculateOffsets( anchor, d.getWidth(), d.getHeight() );
/** * Returns the height of the text box. * * @param g2 the graphics device. * * @return The height (in Java2D units). */ public double getHeight(final Graphics2D g2) { final Size2D d = this.textBlock.calculateDimensions(g2); return this.interiorGap.extendHeight(d.getHeight()); }
this.paint, maxWidth, this.maximumLinesToDisplay, new G2TextMeasurer(g2)); this.content.setLineAlignment(this.textAlignment); Size2D contentSize = this.content.calculateDimensions(g2); if (this.expandToFitSpace) { return new Size2D(maxWidth, contentSize.getHeight()); this.paint, maxWidth, this.maximumLinesToDisplay, new G2TextMeasurer(g2)); this.content.setLineAlignment(this.textAlignment); Size2D contentSize = this.content.calculateDimensions(g2);
/** * Returns a hash code for this object. * * @return A hash code. */ public int hashCode() { int result; long temp; result = (this.outlinePaint != null ? this.outlinePaint.hashCode() : 0); result = 29 * result + (this.outlineStroke != null ? this.outlineStroke.hashCode() : 0); result = 29 * result + (this.interiorGap != null ? this.interiorGap.hashCode() : 0); result = 29 * result + (this.backgroundPaint != null ? this.backgroundPaint.hashCode() : 0); result = 29 * result + (this.shadowPaint != null ? this.shadowPaint.hashCode() : 0); temp = this.shadowXOffset != +0.0d ? Double.doubleToLongBits(this.shadowXOffset) : 0L; result = 29 * result + (int) (temp ^ (temp >>> 32)); temp = this.shadowYOffset != +0.0d ? Double.doubleToLongBits(this.shadowYOffset) : 0L; result = 29 * result + (int) (temp ^ (temp >>> 32)); result = 29 * result + (this.textBlock != null ? this.textBlock.hashCode() : 0); return result; }