[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Setting colors for Plotting to PRINTER



Aaron Birenboim writes:

> After reviewing Dr. Fanning's code, it appears to me that
> the following should work for a color plot on all non-screen devices
>     (or at least the ones where !D.NCOLORS EQ 256)  :
> 
> TVLCT,255,0,0,22
> PLOT,indgen(9),COLOR=22
> 
> To produce a red plot.
> Is this correct????

Yes, for all 8-bit displays.
 
> --- However, my PS device (at least) still appears black.
>         that may be a seperate issue to look into later.

A common mistake is to forget to set the
COLOR keyword when you configure the PostScript
device. You must also set the BITS_PER_PIXEL 
keyword to 8. (There are the defaults, by the
way, with PSConfig, which is one of the reasons
I always use it to configure the PostScript device.)
 
> All that aside....
> There is a special case for 'PRINTER' where fsc_color.pro
> seems to NOT do the TVLCT call.
> How is it that for 'PRINTER' a color gets loaded into index 22....
> when the TVLCT call appears to be skipped?

If there is, I can't seem to find it. :-(
 
> This is kind of hard for me to test, since I do not have
> a color printer on my development system.
> 
> How would the color 22 get set to red for:
> 
> SET_PLOT,'PRINTER'
> c = fsc_color('red',22)
> ; i think c would be 22 here
> PLOT,indgen(9),COLOR=c
> 
> Is there any place in the IDL documentation that covers
> how to set PLOT colors on non-screen devices?
> Is the PRINTER device somehow different from other
> non-screen devices?

The PRINTER device (depending upon which printer you
are using, of course) is weird. All kinds of strange
things go on with it. For example, I've had little
luck loading colors while inside the PRINTER device.
I almost always have to load colors outside the device,
and copy them into the PRINTER:

   Set_Plot, 'PRINTER', /Copy

And then there is a bug in the PRINTER device such
that if you load a single color (e.g. red, in your
example) while in the PRINTER device, the background
shows up in that color. This no matter *what* index
you load the color in. (This doesn't happen on all
printers, thank goodness.)

So, to make your PRINTER example work, I think
you might want to try this:

 c = fsc_color('red',22)
 SET_PLOT,'PRINTER'm /Copy
 PLOT,indgen(9),COLOR=c

Cheers,

David

-- 
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155