Renders the text on the image. Draws the text in the foreground color if ip.setColor(Color) has not been called. @see ij.process.ImageProcessor#setFont(Font) @see ij.process.ImageProcessor#setAntialiasedText(boolean) @see ij.process.ImageProcessor#setColor(Color)
(ImageProcessor ip)
| 218 | * @see ij.process.ImageProcessor#setColor(Color) |
| 219 | */ |
| 220 | public void drawPixels(ImageProcessor ip) { |
| 221 | if (!ip.fillValueSet()) |
| 222 | ip.setColor(Toolbar.getForegroundColor()); |
| 223 | ip.setFont(font); |
| 224 | ip.setAntialiasedText(getAntiAlias()); |
| 225 | FontMetrics metrics = ip.getFontMetrics(); |
| 226 | int fontHeight = metrics.getHeight(); |
| 227 | int descent = metrics.getDescent(); |
| 228 | int i = 0; |
| 229 | int yy = 0; |
| 230 | int xi = (int)Math.round(getXBase()); |
| 231 | int yi = (int)Math.round(getYBase()); |
| 232 | while (i<MAX_LINES && theText[i]!=null) { |
| 233 | switch (justification) { |
| 234 | case LEFT: |
| 235 | ip.drawString(theText[i], xi, yi+yy+fontHeight); |
| 236 | break; |
| 237 | case CENTER: |
| 238 | int tw = metrics.stringWidth(theText[i]); |
| 239 | ip.drawString(theText[i], xi+(this.width-tw)/2, yi+yy+fontHeight); |
| 240 | break; |
| 241 | case RIGHT: |
| 242 | tw = metrics.stringWidth(theText[i]); |
| 243 | ip.drawString(theText[i], xi+this.width-tw, yi+yy+fontHeight); |
| 244 | break; |
| 245 | } |
| 246 | i++; |
| 247 | yy += fontHeight; |
| 248 | } |
| 249 | } |
| 250 | |
| 251 | /** Draws the text on the screen, clipped to the ROI. */ |
| 252 | public void draw(Graphics g) { |
nothing calls this directly
no test coverage detected