} else roi2 = new TextRoi(r.x, r.y, r.width, r.height, new String(text), font); roi2.setStrokeColor(roi.getStrokeColor()); roi2.setFillColor(roi.getFillColor()); roi2.setName(getRoiName());
public TextRoi(int x, int y, ImagePlus imp) { super(x, y, imp); ImageCanvas ic = imp.getCanvas(); double mag = getMagnification(); if (mag>1.0) mag = 1.0; if (size<(12/mag)) size = (int)(12/mag); if (firstTime) { theText[0] = line1; theText[1] = line2; theText[2] = line3; firstTime = false; } else theText[0] = line1a; if (previousRoi!=null && (previousRoi instanceof TextRoi)) { firstMouseUp = false; previousRoi = null; } instanceFont = new Font(name, style, size); justification = globalJustification; setStrokeColor(Toolbar.getForegroundColor()); if (WindowManager.getWindow("Fonts")!=null) { setFillColor(defaultFillColor); setAngle(defaultAngle); } }
public TextRoi(int x, int y, ImagePlus imp) { super(x, y, imp); ImageCanvas ic = imp.getCanvas(); double mag = getMagnification(); if (mag>1.0) mag = 1.0; if (size<(12/mag)) size = (int)(12/mag); if (firstTime) { theText[0] = line1; theText[1] = line2; theText[2] = line3; firstTime = false; } else theText[0] = line1a; if (previousRoi!=null && (previousRoi instanceof TextRoi)) { firstMouseUp = false; previousRoi = null; } instanceFont = new Font(name, style, size); justification = globalJustification; setStrokeColor(Toolbar.getForegroundColor()); if (WindowManager.getWindow("Fonts")!=null) { setFillColor(defaultFillColor); setAngle(defaultAngle); } }
} else roi2 = new TextRoi(r.x, r.y, r.width, r.height, new String(text), font); roi2.setStrokeColor(roi.getStrokeColor()); roi2.setFillColor(roi.getFillColor()); roi2.setName(getRoiName());
if (overlay!=null) { TextRoi label = new TextRoi(todisplay, x + 5, yLabel + fontHeight/2, font); label.setStrokeColor(c); overlay.add(label, CALIBRATION_BAR);
if (overlay!=null) { TextRoi label = new TextRoi(todisplay, x + 5, yLabel + fontHeight/2, font); label.setStrokeColor(c); overlay.add(label, CALIBRATION_BAR);
protected void handleMouseUp(int screenX, int screenY) { super.handleMouseUp(screenX, screenY); if (width<5 && height<5 && imp!=null && previousRoi==null) { int ox = ic!=null?ic.offScreenX(screenX):screenX; int oy = ic!=null?ic.offScreenY(screenY):screenY; TextRoi roi = new TextRoi(ox, oy, line1a); roi.setStrokeColor(Toolbar.getForegroundColor()); roi.firstChar = true; imp.setRoi(roi); return; } else if (firstMouseUp) { updateBounds(null); updateText(); firstMouseUp = false; } if (width<5 || height<5) imp.deleteRoi(); }
protected void handleMouseUp(int screenX, int screenY) { super.handleMouseUp(screenX, screenY); if (width<5 && height<5 && imp!=null && previousRoi==null) { int ox = ic!=null?ic.offScreenX(screenX):screenX; int oy = ic!=null?ic.offScreenY(screenY):screenY; TextRoi roi = new TextRoi(ox, oy, line1a); roi.setStrokeColor(Toolbar.getForegroundColor()); roi.firstChar = true; imp.setRoi(roi); return; } else if (firstMouseUp) { updateBounds(null); updateText(); firstMouseUp = false; } if (width<5 || height<5) imp.deleteRoi(); }
/** 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); } }
if (!hideText) { TextRoi text = new TextRoi(x+xoffset, y+barHeightInPixels, label, font); text.setStrokeColor(color); overlay.add(text, SCALE_BAR);
if (!hideText) { TextRoi text = new TextRoi(x+xoffset, y+barHeightInPixels, label, font); text.setStrokeColor(color); overlay.add(text, SCALE_BAR);
text = IJ.pad(i,4); TextRoi roi = new TextRoi(5, yloc-28, text, font); roi.setStrokeColor(Color.white); if (hyperstack || c>1) roi.setPosition(channel, slice, frame); font = new Font("SansSerif", Font.PLAIN, imp.getWidth()>399?14:12); roi = new TextRoi(25, yloc, msg, font); roi.setStrokeColor(Color.white); roi.setPosition(0, 1, 1); overlay.add(roi);
text = IJ.pad(i,4); TextRoi roi = new TextRoi(5, yloc-28, text, font); roi.setStrokeColor(Color.white); if (hyperstack || c>1) roi.setPosition(channel, slice, frame); font = new Font("SansSerif", Font.PLAIN, imp.getWidth()>399?14:12); roi = new TextRoi(25, yloc, msg, font); roi.setStrokeColor(Color.white); roi.setPosition(0, 1, 1); overlay.add(roi);