Re: Another VM conundrum [message #37294 is a reply to message #37291] |
Thu, 11 December 2003 11:46  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
JD Smith writes:
> Having fixed my main-level XManager issues (thankfully fairly
> trivial), I now find myself with another problem. Typically, I
> recommend setting something like:
>
> device,DECOMPOSED=0,TRUE=16,RETAIN=2
>
> in your IDL startup file, where RETAIN=2 is good for most Linux
> machines (whose window managers don't provide decent backing store),
> DECOMPOSED=0 is immortalized on David's site, and TRUE=16 is just for
> good measure, for those X servers which *claim* to offer DirectColor
> but don't really (sadly, not few in the Linux world). However, I
> leave it up to the end user to find some combination of device
> incantations which work for them.
>
> That's fine for interactive usage, but with a runtime/VM application,
> the startup file is never consulted, so you need to perform these
> device incantations yourself in the code. Has anyone solved this
> problem in a platform-independent way? Would something like:
>
> device,DECOMPOSED=0,RETAIN=2
>
> always be safe, even for older 8-bit PSEUDOCOLOR machines? Or is
> there some method of interrogating DEVICE for info before making a
> final decision on RETAIN and color-model settings? What guidance from
> the IDL color gurus?
Oh, I *hate* to put those DEVICE commands into the code!
A pure nightmare when you are trying to write code that
works *everywhere*: Z-buffer, PostScript, on various and
sundry displays, etc. Here are a couple of tips (taken
from the TVIMAGE code, of course, which *does* run
everywhere).
; Which release of IDL is this?
thisRelease = Float(!Version.Release)
; Decomposed color off if device supports it.
CASE StrUpCase(!D.NAME) OF
'X': BEGIN
Device, Get_Visual_Depth=thisDepth
IF thisRelease GE 5.2 THEN $
Device, Get_Decomposed=thisDecomposed
Device, Decomposed=0
ENDCASE
'WIN': BEGIN
Device, Get_Visual_Depth=thisDepth
IF thisRelease GE 5.2 THEN $
Device, Get_Decomposed=thisDecomposed
Device, Decomposed=0
ENDCASE
'MAC': BEGIN
Device, Get_Visual_Depth=thisDepth
IF thisRelease GE 5.2 THEN $
Device, Get_Decomposed=thisDecomposed
Device, Decomposed=0
ENDCASE
ELSE: thisDepth = 8
ENDCASE
; Restore Decomposed state if necessary.
CASE StrUpCase(!D.NAME) OF
'X': BEGIN
IF thisRelease GE 5.2 THEN Device, Decomposed=thisDecomposed
ENDCASE
'WIN': BEGIN
IF thisRelease GE 5.2 THEN Device, Decomposed=thisDecomposed
ENDCASE
'MAC': BEGIN
IF thisRelease GE 5.2 THEN BEGIN
Device, Decomposed=thisDecomposed
Cheers,
David
--
David W. Fanning, Ph.D.
Fanning Software Consulting, Inc.
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|