Login  Register

Re: drawString help

Posted by Michael Schmid on Jul 07, 2011; 10:10am
URL: http://imagej.273.s1.nabble.com/Help-needed-with-DNA-band-size-calculation-tp3683989p3683991.html

Hi Andrew,

sorry, quite a late response; maybe you have found it in the  
meanwhile anyhow.

ImageStack.getProcessor creates a new ImageProcessor each time; any  
information written to the previous ImageProcessor gets lost with it.  
So you need:

      ImageProcessor ip = iplus2.getStack().getProcessor
(image.getCurrentSlice());

ant then ip.setFont, ip.setColor, ip.drawString.


Michael
________________________________________________________________

On 29 Jun 2011, at 13:34, Andrew French wrote:

> Hi everybody
>
> Anyone have any ideas why the following doesn't draw any text?
>
>         Font f = new Font("Helvetica", Font.PLAIN, 72);
>         iplus2.getStack().getProcessor(image.getCurrentSlice
> ()).setFont(f);
>         iplus2.getStack().getProcessor(image.getCurrentSlice
> ()).setColor(java.awt.Color.cyan);
>         iplus2.getStack().getProcessor(image.getCurrentSlice
> ()).drawString( "x", x+40, y);
>
>         iplus2.updateAndDraw();
>
> Switching the drawString() command for a putPixel(x, y, pixel)  
> command works fine...
>
> This is on a RGB image stack.
>
> Many thanks
> Andrew