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

Home » Public Forums » archive » Transparent overlay in postscript cgimage
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
Transparent overlay in postscript cgimage [message #92328] Wed, 18 November 2015 08:44 Go to next message
David Klassen is currently offline  David Klassen
Messages: 27
Registered: December 2004
Junior Member
So I'm tying to make a postscript output of a two-image overlay with color bar. The code I use to do this is:

ymult=1.15
cgdisplay,1080,540*ymult
cgimage,baimg,ct=0,position=[0,0,1,1/ymult],background=0
cgimage,bimg,transp=0,missing_index=0,ct=31,/brewer,$
alphafgposition=[0,0,1,1/ymult]
cgcolorbar,range=[0,0.5],format='(f0.4)',/top,ctindex=31,/br ewer,$
position=[0.10,0.90,0.95,0.93],xticks=8,color='white',$
title='Ice Cloud Optical Depth ('+textoidl(' \tau_{12.1 \mu m} ')+')'


where bimg is they bytescaled version of my data overlay and baimge is the bytescaled version of my background albedo map. On screen this looks beautiful! And can use cgsnapshot to make it into a png file but the pixelated fonts, for some reason, really annoy me.

When I do a cgps_open,'test.eps' and then do these commands, it doesn't work and says I need an alphabackgroundimage but if I do that, the background image fills the display. And alphabgposition also causes an error.

What am I doing wrong?
Re: Transparent overlay in postscript cgimage [message #92329 is a reply to message #92328] Wed, 18 November 2015 09:20 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
David Klassen writes:

>
> So I'm tying to make a postscript output of a two-image overlay with color bar. The code I use to do this is:
>
> ymult=1.15
> cgdisplay,1080,540*ymult
> cgimage,baimg,ct=0,position=[0,0,1,1/ymult],background=0
> cgimage,bimg,transp=0,missing_index=0,ct=31,/brewer,$
> alphafgposition=[0,0,1,1/ymult]
> cgcolorbar,range=[0,0.5],format='(f0.4)',/top,ctindex=31,/br ewer,$
> position=[0.10,0.90,0.95,0.93],xticks=8,color='white',$
> title='Ice Cloud Optical Depth ('+textoidl(' \tau_{12.1 \mu m} ')+')'
>
>
> where bimg is they bytescaled version of my data overlay and baimge is the bytescaled version of my background albedo map. On screen this looks beautiful! And can use cgsnapshot to make it into a png file but the pixelated fonts, for some reason, really annoy me.
>
> When I do a cgps_open,'test.eps' and then do these commands, it doesn't work and says I need an alphabackgroundimage but if I do that, the background image fills the display. And alphabgposition also causes an error.
>
> What am I doing wrong?

Probably getting things in the wrong order. :-)

I'd try something like this:

ymult=1.15
baimg = cgDemoData(7)
bimg = cgDemoData(5)
cgdisplay,1080,540*ymult, /pixmap
cgimage,baimg,ct=0,position=[0,0,1,1/ymult],background=0
bgimage = cgsnapshot()
wdelete
cgps_open, 'imagetest.ps'
cgdisplay,1080,540*ymult
cgimage,bimg,transp=0,missing_index=0,ct=31,/brewer,$
alphafgposition=[0,0,1,1/ymult], alphabackgroundimage = bgimage
cgcolorbar,range=[0,0.5],format='(f0.4)',/top,ctindex=31,/br ewer,$
position=[0.10,0.90,0.95,0.93],xticks=8,color='white',$
title='Ice Cloud Optical Depth ('+textoidl(' \tau_{12.1 \mu m} ')+')'
cgps_close
END

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Re: Transparent overlay in postscript cgimage [message #92330 is a reply to message #92329] Wed, 18 November 2015 11:22 Go to previous message
David Klassen is currently offline  David Klassen
Messages: 27
Registered: December 2004
Junior Member
Thank you!

After posting I did find your gallery and was looking there and found the idea of writing everything to the Z buffer then reading it back out to make the postscript image, but that was also giving me the ugly fonts.

I see the trick now; write the background image to a window and position it, then read out the full window for a new background that does fill the display area. Neat!

- Dave

On Wednesday, November 18, 2015 at 12:20:30 PM UTC-5, David Fanning wrote:
>
> Probably getting things in the wrong order. :-)
>
> I'd try something like this:
>
> ymult=1.15
> baimg = cgDemoData(7)
> bimg = cgDemoData(5)
> cgdisplay,1080,540*ymult, /pixmap
> cgimage,baimg,ct=0,position=[0,0,1,1/ymult],background=0
> bgimage = cgsnapshot()
> wdelete
> cgps_open, 'imagetest.ps'
> cgdisplay,1080,540*ymult
> cgimage,bimg,transp=0,missing_index=0,ct=31,/brewer,$
> alphafgposition=[0,0,1,1/ymult], alphabackgroundimage = bgimage
> cgcolorbar,range=[0,0.5],format='(f0.4)',/top,ctindex=31,/br ewer,$
> position=[0.10,0.90,0.95,0.93],xticks=8,color='white',$
> title='Ice Cloud Optical Depth ('+textoidl(' \tau_{12.1 \mu m} ')+')'
> cgps_close
> END
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
> Sepore ma de ni thue. ("Perhaps thou speakest truth.")
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Adding two strings together
Next Topic: running an application from the IDL virtual machine

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

Current Time: Wed Oct 08 11:45:31 PDT 2025

Total time taken to generate the page: 0.00425 seconds