comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: annotated text without using graphics device in IDL?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: annotated text without using graphics device in IDL? [message #35058] Wed, 07 May 2003 11:11 Go to previous message
Liam E. Gumley is currently offline  Liam E. Gumley
Messages: 378
Registered: January 2000
Senior Member
"Howard Taylor" <howard.taylor@jhuapl.edu> wrote in message
news:b9bfce$b5j$1@houston.jhuapl.edu...
> I'd like to annotate an image without having to first draw the text on the
> active graphics display and then read the image back. This undesirable
> method might look like:
>
> a=indgen(256,256)
> tv,a
> xyouts,100,100,'this text',/device
> b=tvrd()
>
>
> Instead, I'd like an approach that doesnt rely on the graphics device at
> all. It might be called in this way:
>
> a=findgen(256,256)
> b = imgtext( a, 100,100,'this text' )
>
> As a result, b is an image whose contents have been altered to include the
> text.
>
> Anybody seen this sort of thing for IDL?

I don't think you can avoid having some sort of graphics device selected.

However you can use the Z-buffer graphics device which exists only in
memory, and does not require a graphics window:

ncol = 256
nrow = 256
a = dist(ncol, nrow)
entry_device = !d.name
set_plot, 'Z'
device, set_resolution=[ncol, nrow], set_colors=256, z_buffering=0
tv, bytscl(a)
xyouts,100,100, 'this text', /device
b = tvrd()
set_plot, entry_device

Note that the image was byte scaled since the Z-buffer is an 8-bit device.
Finally, you might get different character sizes in the Z-buffer compared to
a normal graphics window. To make sure the character sizes match, set the
character size explicitly in either case using a command like

device, set_character_size=[10, 12] ; width 10 pixels, height 12 pixels

Cheers,
Liam.
Practical IDL Programming
http://www.gumley.com/
[Message index]
 
Read Message
Read Message
Previous Topic: annotated text without using graphics device in IDL?
Next Topic: decoding the JPEG format

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Tue Dec 02 22:16:47 PST 2025

Total time taken to generate the page: 0.00204 seconds