public void setAntialiasedText(boolean antialiased) { record("setAntialiasedText", new Boolean(antialiased), boolean.class); proc.setAntialiasedText(antialiased); }
public void setAntialiasedText(boolean antialiased) { record("setAntialiasedText", new Boolean(antialiased), boolean.class); proc.setAntialiasedText(antialiased); }
private void label(ImageProcessor ip, String msg, Color color) { int size = getHeight()/20; if (size<9) size=9; Font font = new Font("Helvetica", Font.PLAIN, size); ip.setFont(font); ip.setAntialiasedText(true); ip.setColor(color); ip.drawString(msg, size, size*2); }
private void label(ImageProcessor ip, String msg, Color color) { int size = getHeight()/20; if (size<9) size=9; Font font = new Font("Helvetica", Font.PLAIN, size); ip.setFont(font); ip.setAntialiasedText(true); ip.setColor(color); ip.drawString(msg, size, size*2); }
ipText.fill(); ipText.setColor(Color.black); ipText.setAntialiasedText(true); ipText.drawString(s, tW/2-w/2, ipH/2+h/2); ipText.setInterpolate(true);
/** 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; } }
/** 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; } }
ImageProcessor ip = imp.getProcessor(); ip.setFont(new Font(font, fontType, fontSize)); ip.setAntialiasedText(true); String label = getLength(barWidth)+" "+getUnits(imp); int swidth = hideText?0:ip.getStringWidth(label);
/** Vertical text for y axis label */ void drawYLabel(String yLabel, int xRight, int yFrameTop, int frameHeight, Font scaledFont) { if (ip==null || yLabel.equals("")) return; ip.setFont(scaledFont); FontMetrics fm = ip.getFontMetrics(); int h = fm.getHeight(); //int w = ip.getStringWidth(yLabel) + sc(5); //int h = fm.getHeight()+sc(1); Rectangle rect = ip.getStringBounds(yLabel); ImageProcessor label = new ByteProcessor(rect.x+rect.width, Math.max(h, rect.height)); label.setAntialiasedText(pp.antialiasedText); if (invertedLut) label.invertLut(); label.setColor(Color.white); label.fill(); label.setColor(Color.black); label.setFont(scaledFont); label.drawString(yLabel, 0, Math.max(-rect.y, h)); //can't antialias if x<0 or y<h label = label.rotateLeft(); int y2 = yFrameTop + (frameHeight-label.getHeight())/2; if (y2 < 0) y2 = 0; int x2 = Math.max(xRight-label.getWidth()*4/3, 0); // distance 1/3 height if possible ip.insert(label, x2, y2); }
/** Vertical text for y axis label */ void drawYLabel(String yLabel, int xRight, int yFrameTop, int frameHeight, Font scaledFont) { if (ip==null || yLabel.equals("")) return; ip.setFont(scaledFont); FontMetrics fm = ip.getFontMetrics(); int h = fm.getHeight(); //int w = ip.getStringWidth(yLabel) + sc(5); //int h = fm.getHeight()+sc(1); Rectangle rect = ip.getStringBounds(yLabel); ImageProcessor label = new ByteProcessor(rect.x+rect.width, Math.max(h, rect.height)); label.setAntialiasedText(pp.antialiasedText); if (invertedLut) label.invertLut(); label.setColor(Color.white); label.fill(); label.setColor(Color.black); label.setFont(scaledFont); label.drawString(yLabel, 0, Math.max(-rect.y, h)); //can't antialias if x<0 or y<h label = label.rotateLeft(); int y2 = yFrameTop + (frameHeight-label.getHeight())/2; if (y2 < 0) y2 = 0; int x2 = Math.max(xRight-label.getWidth()*4/3, 0); // distance 1/3 height if possible ip.insert(label, x2, y2); }
public void clear(ImageProcessor ip) { if (instanceFont==null) ip.fill(); else { ip.setFont(instanceFont); ip.setAntialiasedText(antialiasedText); int i=0, width=0; while (i<MAX_LINES && theText[i]!=null) { int w = ip.getStringWidth(theText[i]); if (w>width) width = w; i++; } Rectangle r = ip.getRoi(); if (width>r.width) { r.width = width; ip.setRoi(r); } ip.fill(); } }
public void clear(ImageProcessor ip) { if (instanceFont==null) ip.fill(); else { ip.setFont(instanceFont); ip.setAntialiasedText(antialiasedText); int i=0, width=0; while (i<MAX_LINES && theText[i]!=null) { int w = ip.getStringWidth(theText[i]); if (w>width) width = w; i++; } Rectangle r = ip.getRoi(); if (width>r.width) { r.width = width; ip.setRoi(r); } ip.fill(); } }
void drawText(ImageProcessor ip, int x, int y) { ip.setFont(new Font("SansSerif",Font.PLAIN,12)); ip.setAntialiasedText(true); double hmin = histMin; double hmax = histMin+binSize*(histogram.length-1);
String font = serifFont?"Serif":"SanSerif"; ip.setFont(new Font(font, fontType, fontSize)); ip.setAntialiasedText(true); String label = getLength(barWidth) + " "+ units; int swidth = hideText?0:ip.getStringWidth(label);
ip.setAntialiasedText(pp.antialiasedText); frame = new Rectangle(leftMargin, topMargin, frameWidth+1, frameHeight+1); if (pp.frame.color2 != null) { //background color
ip.setAntialiasedText(pp.antialiasedText); frame = new Rectangle(leftMargin, topMargin, frameWidth+1, frameHeight+1); if (pp.frame.color2 != null) { //background color
void drawString() { interp.getLeftParen(); String str = getString(); interp.getComma(); int x = (int)(interp.getExpression()+0.5); interp.getComma(); int y = (int)(interp.getExpression()+0.5); Color background = null; if (interp.nextToken()==',') { interp.getComma(); background = getColor(); } interp.getRightParen(); ImageProcessor ip = getProcessor(); if (!colorSet) setForegroundColor(ip); setFont(ip); ip.setJustification(justification); ip.setAntialiasedText(antialiasedText); if (background!=null) ip.drawString(str, x, y, background); else ip.drawString(str, x, y); updateAndDraw(); }
void drawString() { interp.getLeftParen(); String str = getString(); interp.getComma(); int x = (int)(interp.getExpression()+0.5); interp.getComma(); int y = (int)(interp.getExpression()+0.5); Color background = null; if (interp.nextToken()==',') { interp.getComma(); background = getColor(); } interp.getRightParen(); ImageProcessor ip = getProcessor(); if (!colorSet) setForegroundColor(ip); setFont(ip); ip.setJustification(justification); ip.setAntialiasedText(antialiasedText); if (background!=null) ip.drawString(str, x, y, background); else ip.drawString(str, x, y); updateAndDraw(); }
void drawText(ImageProcessor ip, int x, int y) { ip.setFont(new Font("SansSerif",Font.PLAIN,12)); ip.setAntialiasedText(true); ip.drawString(IJ.d2s(0,0), x - 4, y); ip.drawString(IJ.d2s(255,0), x + HIST_WIDTH - getWidth(256, ip) + 10, y);
ip.drawLine( xCenter - 2, ip.getHeight() - 1 - maxY, xCenter, ip.getHeight() - 1 - maxY ); ip.setAntialiasedText( true ); ip.setFont( new Font( "Sans", Font.PLAIN, 14 ) );