updateBounds(g); double mag = getMagnification(); int xi = (int)Math.round(getXBase()); int yi = (int)Math.round(getYBase()); double widthd = bounds!=null?bounds.width:width; Graphics2D g2d = (Graphics2D)g; updateBounds(g); int sx = nonScalable?xi:screenXD(getXBase()); int sy = nonScalable?yi:screenYD(getYBase()); int sw = nonScalable?widthi:(int)(getMagnification()*widthd);
/** Renders the text on the image. */ public void drawPixels(ImageProcessor ip) { ip.setFont(instanceFont); ip.setAntialiasedText(antialiased); FontMetrics metrics = ip.getFontMetrics(); int fontHeight = metrics.getHeight(); int descent = metrics.getDescent(); int i = 0; int yy = 0; int xi = (int)Math.round(getXBase()); int yi = (int)Math.round(getYBase()); while (i<MAX_LINES && theText[i]!=null) { switch (justification) { case LEFT: ip.drawString(theText[i], xi, yi+yy+fontHeight); break; case CENTER: int tw = metrics.stringWidth(theText[i]); ip.drawString(theText[i], xi+(width-tw)/2, yi+yy+fontHeight); break; case RIGHT: tw = metrics.stringWidth(theText[i]); ip.drawString(theText[i], xi+width-tw, yi+yy+fontHeight); break; } i++; yy += fontHeight; } }
updateBounds(g); double mag = getMagnification(); int xi = (int)Math.round(getXBase()); int yi = (int)Math.round(getYBase()); double widthd = bounds!=null?bounds.width:width; Graphics2D g2d = (Graphics2D)g; updateBounds(g); int sx = nonScalable?xi:screenXD(getXBase()); int sy = nonScalable?yi:screenYD(getYBase()); int sw = nonScalable?widthi:(int)(getMagnification()*widthd);
/** Renders the text on the image. */ public void drawPixels(ImageProcessor ip) { ip.setFont(instanceFont); ip.setAntialiasedText(antialiased); FontMetrics metrics = ip.getFontMetrics(); int fontHeight = metrics.getHeight(); int descent = metrics.getDescent(); int i = 0; int yy = 0; int xi = (int)Math.round(getXBase()); int yi = (int)Math.round(getYBase()); while (i<MAX_LINES && theText[i]!=null) { switch (justification) { case LEFT: ip.drawString(theText[i], xi, yi+yy+fontHeight); break; case CENTER: int tw = metrics.stringWidth(theText[i]); ip.drawString(theText[i], xi+(width-tw)/2, yi+yy+fontHeight); break; case RIGHT: tw = metrics.stringWidth(theText[i]); ip.drawString(theText[i], xi+width-tw, yi+yy+fontHeight); break; } i++; yy += fontHeight; } }
/** Draws the text on the screen, clipped to the ROI. */ public void draw(Graphics g) { if (IJ.debugMode) IJ.log("draw: "+theText[0]+" "+width+","+height); if (Interpreter.isBatchMode() && ic!=null && ic.getDisplayList()!=null) return; if (newFont || width==1) updateBounds(g); Color c = getStrokeColor(); setStrokeColor(getColor()); super.draw(g); // draw the rectangle setStrokeColor(c); double mag = getMagnification(); int sx = screenXD(getXBase()); int sy = screenYD(getYBase()); int swidth = (int)((bounds!=null?bounds.width:width)*mag); int sheight = (int)((bounds!=null?bounds.height:height)*mag); Rectangle r = null; if (angle!=0.0) drawText(g); else { r = g.getClipBounds(); g.setClip(sx, sy, swidth, sheight); drawText(g); if (r!=null) g.setClip(r.x, r.y, r.width, r.height); } }
/** Draws the text on the screen, clipped to the ROI. */ public void draw(Graphics g) { if (IJ.debugMode) IJ.log("draw: "+theText[0]+" "+width+","+height); if (Interpreter.isBatchMode() && ic!=null && ic.getDisplayList()!=null) return; if (newFont || width==1) updateBounds(g); Color c = getStrokeColor(); setStrokeColor(getColor()); super.draw(g); // draw the rectangle setStrokeColor(c); double mag = getMagnification(); int sx = screenXD(getXBase()); int sy = screenYD(getYBase()); int swidth = (int)((bounds!=null?bounds.width:width)*mag); int sheight = (int)((bounds!=null?bounds.height:height)*mag); Rectangle r = null; if (angle!=0.0) drawText(g); else { r = g.getClipBounds(); g.setClip(sx, sy, swidth, sheight); drawText(g); if (r!=null) g.setClip(r.x, r.y, r.width, r.height); } }