| Mask out background of xyouts annotations [message #1229] |
Tue, 22 June 1993 06:39 |
oet
Messages: 28 Registered: February 1993
|
Junior Member |
|
|
To plot weather station names over a map in IDL we should mask out the background
of the xyouts plot. I could not find a function which automatically masks
out the background behind a xyouts plot. So I wrote the short procedure below.
It does his work, but probably there may be a better way to do this.
Thanks for any input!
Thomas
--
|Thomas Oettli Internet: Thomas.Oettli@sma.ch |
|Swiss Meteorological Institute thomas.oettli@active.ch |
|Kraehbuehlstr. 58 CServe: 100015.3543@compuserve.com |
|8044 Zuerich |
;
;+
; NAME:
; MXYOUTS
;
; PURPOSE:
; Masks out background of xyouts plot
;
;
; CATEGORY:
; Plotting
;
;
; CALLING SEQUENCE:
; mxyouts, x, y, <string>, MASK_COLOR=MASK_COLOR, COLOR=COLOR, FONT=FONT
;
;
; KEYWORD PARAMETERS:
;
; MASK_COLOR background color of xyouts plot, default is 0
; COLOR color of xyouts plot, default is !d.n_colors -1
;
;
; RESTRICTIONS:
;
; Currently only supports device coordinates for x and y
; Problems with some fonts, just a first hack ....
;
;
; SEE ALSO:
;
; xyouts, polyfill, GRAPHIC_KEYWORDS, device
;
; MODIFICATION HISTORY:
; Written by: Thomas.Oettli@sma.ch 11-june-1993
;
;
;-
PRO mxyouts, x0, y0, str, MASK_COLOR=MASK_COLOR, COLOR=COLOR, FONT=FONT
fn=FONT
DEVICE, FONT=fn
if ( NOT(KEYWORD_SET(MASK_COLOR)) ) then MASK_COLOR=0
if ( NOT(KEYWORD_SET(COLOR)) ) then COLOR=!d.n_colors-1
x_size=( strlen(str) * !D.X_CH_SIZE )
y_size=!D.Y_CH_SIZE-4
x1=x0 + x_size
y1=y0 + y_size
polyfill, [ [x0,y0],[x0,y1],[x1,y1],[x1,y0] ], /DEVICE, COLOR=MASK_COLOR
xyouts, x0,y0, str, /DEVICE, FONT=fn
END
|
|
|
|