Re: Filled Background when drawing a string
Posted by
Johannes Weissmann on
Jun 13, 2011; 2:06pm
URL: http://imagej.273.s1.nabble.com/Filled-Background-when-drawing-a-string-tp3684237p3684239.html
On 13.06.2011 15:58, Johannes Schindelin wrote:
> Hi Johannes,
>
> On Mon, 13 Jun 2011, Johannes Weissmann wrote:
>
>> I was wondering if there is a possiblility to set a background color
>> when drawing a string using the functions of an image processor.
>> Currently I am using a line like
>>
>> ip.drawString(string);
>>
>> I have to update the text several times and tried to avoid creating a
>> TextRoi all the time. Does anyone know a quick solution or do I have to
>> use TextROIs?
>
> If you are already using Javascript or Java (as suggested by the snippet),
> you could draw the string with (x +- 1, y +-1) and in the background color
> to simulate an outline prior to drawing the string in the foreground
> color.
>
> If that is not what you meant, you can get the bounding box of a text ROI,
> possibly extend it, and fill it before drawing the string.
>
> In both cases, I would recommend making this functionality a method. Then
> it is not _that_ bad if you have to do it a couple of times.
>
> Ciao,
> Johannes
Hi Johannes,
thanks, I guess I'll have to switch to TextROIs. I wanted to avoid
creating TextROIs getting the bounding box because I have lots of
strings per picture and thought that it might slow the plugin down.
ciao Johannes
--
Johannes Weissmann
Nedre Ferstadveg 26 | 7023 Trondheim
mail:
[hidden email]
fon: +47 45 124 191
"The truth, as always, will be far stranger." [Sir Arthur C. Clarke]