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

Home » Public Forums » archive » Re: Mask out background of xyouts annotations
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Mask out background of xyouts annotations [message #1224] Wed, 23 June 1993 00:15
knipp is currently offline  knipp
Messages: 68
Registered: January 1993
Member
Hi

I've tried MXYOUTS but got problems with the font:
If I define font in a way such as font=0, the DEVICE, FONT= command
will fail.
If I define font like font='Helvetica-14' the XYOUTS-command will
fail.

Some time ago I had the same problem and my solution has been to use
XYOUTS several times in a loop with slight offsets to mask out and then again
in a different color to write text. I include the procedure below. A disadvantage
of my solution is that using software-fonts it may be rather slow.

Karl
__ ____ __
/ // _ \ / / Karlheinz Knipp Tel. 0511 - 762 4922
/ // /_/ // / Uni Hannover Fax. 0511 - 762 2483
/ // ____// / Institut fuer Photogrammetrie
/ // / / / Nienburger Str.1 email knipp@ipi.uni-hannover.de
/_//_/ /_/ FRG 3000 Hannover 1


;+
pro margin_xyouts, xp, yp, text, win_no=win_no, font=font, size=size, $
back=back, color=color, alignment=alignment

; writes text with margin
; ------------------------------------------------------------ ------------------
; START OF DESCRIPTION
;
; subroutine IPI, U Hannover 04'92, modified 10'92
; 06'93: modified for IDL
; 06'93: changed keywords fg, bg to
; color, back
;
; METHOD: writes text with margin
; uses XYOUTS, /DEVICE
; opt. FONT=0 or SIZE = ..
; FONT has a higher priority than SIZE
; [ def. ] : FONT = 0
;
; INPUT PARAMETER: xp, yp position of text in device-coordinates
; text text to be written
;
; OUTPUT PARAMETER: none
;
; KEYWORDS : win_no number of window to write in
; size charactersize for softwarefont
; font if true using hardwarefont [def.]
; back color-index for margin [def.: 0]
; color color-index for text [def.: !d.n_colors-1]
; alignment specifies horizontal alignment [def.: 0.d]
;
; EXAMPLE:
;
; window,0 & erase,127 & margin_xyouts,127,127,'DEMO_MARGIN_XYOUTS', size=2.0
;
; END OF DESCRIPTION
; ------------------------------------------------------------ ------------------
;-

; ------------------------------------------------------------ ------------------
; test input

if n_params() ne 3 then begin
print,"The number of parameters was wrong:",n_params()
doc_library,"margin_xyouts"
return
endif

if n_elements(back) eq 0 then back = 0
if n_elements(color) eq 0 then color = !d.n_colors-1

if n_elements(alignment) eq 0 then alig0 = 0.d $
else alig0 = double(alignment(0))


; ------------------------------------------------------------ ------------------
; set code for writing with soft - or hardwarefont

hard_font = 1
if n_elements(size) ne 0 and n_elements(font) eq 0 then hard_font = 0


; ------------------------------------------------------------ ------------------
; set window

if n_elements(win_no) eq 0 then win_no = !d.window
if win_no lt 0 then begin
print,'\007', 'window # : ', win_no
message, 'no window open OR window out of range ...', /info
return
endif

old_win = !d.window
wset, win_no


; ------------------------------------------------------------ ------------------
; write margin / text with hardfont

if hard_font then begin
for xl=-2,2,2 do begin
for yl=-1,1 do begin
xyouts, xp+xl, yp+yl, text, font=0, color=back, $
alignment=alig0, /device
endfor
endfor
xyouts, xp, yp, text, font=0, color=color, alignment=alig0,/device
endif $


; ------------------------------------------------------------ ------------------
; write margin / text with softfont

else begin
for xl=-1,1 do begin
for yl=-1,1 do begin
xyouts, xp+xl, yp+yl, text, size=size, color=back, $
alignment=alig0, /device
endfor
endfor
xyouts, xp, yp, text, size=size, color=color, alignment=alig0, /device
endelse


; ------------------------------------------------------------ ------------------
; reset window, return & end

wset, old_win

return
end
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Help: Ugly error messages in IDL under DEC OpenVMS 1.5
Next Topic: PV-WAVE Orientation of XYOUTS in Z Plane

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

Current Time: Wed Oct 08 15:54:24 PDT 2025

Total time taken to generate the page: 0.07051 seconds