Re: METAFILE + TVLCT [message #43267] |
Mon, 28 March 2005 09:18 |
Karl Schultz
Messages: 341 Registered: October 1999
|
Senior Member |
|
|
On Fri, 25 Mar 2005 13:59:50 -0800, Ed Hyer wrote:
> I got started using the 255-color color tables IDL provides, which are
> useful immediately for quick plotting. After a while, I got greedy and
> started using TVLCT when I needed another color that wasn't in the
> color table I was using. Now I am creating my graphics as METAFILES and
> have found this trick doesn't seem to work. I initialize the device as
> follows:
>> set_plot,'METAFILE'
>> device,file=outfile
>> device,xsize=xsize/30,ysize=ysize/30
>> device,/index
>> device,true=0
> Then, I use TVLCT to give me colors I need, such as adding a gray for
> NODATA to my usual ROYGBIV colors:
>> loadct,39
>> tvlct,[100,100,100],1
> This works beautifully on the WIN display device, but does not change
> the colors at all in the METAFILE.
> Is there another workaround for this?
This is a bug. I'll fix it for next release.
One workaround is to always load the color table starting at the beginning.
So if you wanted to change only index 10, you'd have to get entries 0-9
and then set 0-10. Or get the entire table, make your changes, and then
set the whole thing again.
Karl
|
|
|
Re: METAFILE + TVLCT [message #43268 is a reply to message #43267] |
Mon, 28 March 2005 08:45  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
David Fanning writes:
> In this case, it is necessary to load the color table
> *before* you SET_PLOT to the device. This action then copies
> the current colors into the device color tables, and you
> have to pretty much be content with what you've got. (Personally,
> I think RSI is trying to teach us an important life lesson
> here, but your mileage may vary.)
Of course, you can put the METAFILE device in True_Color
mode and specify all your colors as 24-bit values (this
is what I would do). In that case, FSC_COLOR will help
you write portable code.
http://www.dfanning.com/programs/fsc_color.pro
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|
Re: METAFILE + TVLCT [message #43269 is a reply to message #43268] |
Mon, 28 March 2005 08:33  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Ed Hyer writes:
> I got started using the 255-color color tables IDL provides, which are
> useful immediately for quick plotting. After a while, I got greedy and
> started using TVLCT when I needed another color that wasn't in the
> color table I was using. Now I am creating my graphics as METAFILES and
> have found this trick doesn't seem to work. I initialize the device as
> follows:
>> set_plot,'METAFILE'
>> device,file=outfile
>> device,xsize=xsize/30,ysize=ysize/30
>> device,/index
>> device,true=0
> Then, I use TVLCT to give me colors I need, such as adding a gray for
> NODATA to my usual ROYGBIV colors:
>> loadct,39
>> tvlct,[100,100,100],1
> This works beautifully on the WIN display device, but does not change
> the colors at all in the METAFILE.
> Is there another workaround for this?
Now that I know what the METAFILE graphics device is, maybe I
can offer a suggestion. Several graphics devices, apparently,
do not allow you to load colors once you have made them
the current graphics device. (The PRINTER device is the
most notorious of these.) Knowing Windows as intimately as
I do, I could believe the METAFILE device might also be one
of these.
In this case, it is necessary to load the color table
*before* you SET_PLOT to the device. This action then copies
the current colors into the device color tables, and you
have to pretty much be content with what you've got. (Personally,
I think RSI is trying to teach us an important life lesson
here, but your mileage may vary.)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|
Re: METAFILE + TVLCT [message #43270 is a reply to message #43269] |
Mon, 28 March 2005 08:25  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Karl Schultz writes:
> You might be thinking of the the CGM (Computer Graphics Metafile) driver.
> CGM is pretty old. The METAFILE device was added to IDL in IDL 5.4 and
> supports sending output to a Windows Metafile.
Oh, right. Well, is it broken? :-)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|
Re: METAFILE + TVLCT [message #43271 is a reply to message #43270] |
Mon, 28 March 2005 08:09  |
Karl Schultz
Messages: 341 Registered: October 1999
|
Senior Member |
|
|
On Fri, 25 Mar 2005 15:36:45 -0700, David Fanning wrote:
> Ed Hyer writes:
>
>> I got started using the 255-color color tables IDL provides, which are
>> useful immediately for quick plotting. After a while, I got greedy and
>> started using TVLCT when I needed another color that wasn't in the
>> color table I was using. Now I am creating my graphics as METAFILES and
>> have found this trick doesn't seem to work. I initialize the device as
>> follows:
>>> set_plot,'METAFILE'
>>> device,file=outfile
>>> device,xsize=xsize/30,ysize=ysize/30
>>> device,/index
>>> device,true=0
>> Then, I use TVLCT to give me colors I need, such as adding a gray for
>> NODATA to my usual ROYGBIV colors:
>>> loadct,39
>>> tvlct,[100,100,100],1
>> This works beautifully on the WIN display device, but does not change
>> the colors at all in the METAFILE.
>> Is there another workaround for this?
>
> METAFILE!? Isn't that circa 1976 or something?
> I'd mention this to RSI. They are interested in old
> technology. :-)
>
You might be thinking of the the CGM (Computer Graphics Metafile) driver.
CGM is pretty old. The METAFILE device was added to IDL in IDL 5.4 and
supports sending output to a Windows Metafile.
Karl
|
|
|
Re: METAFILE + TVLCT [message #43286 is a reply to message #43271] |
Fri, 25 March 2005 16:04  |
R.Bauer
Messages: 1424 Registered: November 1998
|
Senior Member |
|
|
Ed Hyer wrote:
> I got started using the 255-color color tables IDL provides, which are
> useful immediately for quick plotting. After a while, I got greedy and
> started using TVLCT when I needed another color that wasn't in the
> color table I was using. Now I am creating my graphics as METAFILES and
> have found this trick doesn't seem to work. I initialize the device as
> follows:
>> set_plot,'METAFILE'
>> device,file=outfile
>> device,xsize=xsize/30,ysize=ysize/30
>> device,/index
>> device,true=0
> Then, I use TVLCT to give me colors I need, such as adding a gray for
> NODATA to my usual ROYGBIV colors:
>> loadct,39
>> tvlct,[100,100,100],1
> This works beautifully on the WIN display device, but does not change
> the colors at all in the METAFILE.
> Is there another workaround for this?
Dear Ed,
what is the reason to use 'METAFILE'? Why not using Postscript?
Reimar
--
Forschungszentrum Juelich
email: R.Bauer@fz-juelich.de
http://www.fz-juelich.de/icg/icg-i/
============================================================ ======
a IDL library at ForschungsZentrum Juelich
http://www.fz-juelich.de/icg/icg-i/idl_icglib/idl_lib_intro. html
|
|
|
Re: METAFILE + TVLCT [message #43292 is a reply to message #43286] |
Fri, 25 March 2005 14:36  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Ed Hyer writes:
> I got started using the 255-color color tables IDL provides, which are
> useful immediately for quick plotting. After a while, I got greedy and
> started using TVLCT when I needed another color that wasn't in the
> color table I was using. Now I am creating my graphics as METAFILES and
> have found this trick doesn't seem to work. I initialize the device as
> follows:
>> set_plot,'METAFILE'
>> device,file=outfile
>> device,xsize=xsize/30,ysize=ysize/30
>> device,/index
>> device,true=0
> Then, I use TVLCT to give me colors I need, such as adding a gray for
> NODATA to my usual ROYGBIV colors:
>> loadct,39
>> tvlct,[100,100,100],1
> This works beautifully on the WIN display device, but does not change
> the colors at all in the METAFILE.
> Is there another workaround for this?
METAFILE!? Isn't that circa 1976 or something?
I'd mention this to RSI. They are interested in old
technology. :-)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|