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

Home » Public Forums » archive » How to create a transparent shadow on the PostScript device?
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
How to create a transparent shadow on the PostScript device? [message #67575] Mon, 10 August 2009 05:28 Go to next message
duxiyu@gmail.com is currently offline  duxiyu@gmail.com
Messages: 88
Registered: March 2007
Member
Hi, all.

There is a method to create a transparent polygen in David's website.
http://www.dfanning.com/code_tips/transpoly.html

But it seems that it does not work on the PS device.
Is there anyone who can give me a simple example of creating a
transparent shadow on the PS device?


Best regards,
jdu
Re: How to create a transparent shadow on the PostScript device? [message #67708 is a reply to message #67575] Tue, 11 August 2009 06:59 Go to previous message
duxiyu@gmail.com is currently offline  duxiyu@gmail.com
Messages: 88
Registered: March 2007
Member
Thanks a lot.
This is a good and simple method.

jdu

On Aug 11, 2:52 pm, Phil Elson <philipel...@googlemail.com> wrote:
> David's page is quite clear that this is designed to work with a plot
> that has already been created: "I cannot draw the polygon first and
> then redraw the plot using OPlot because I do have have access to the
> IDL source code".
>
> If you have access to the data then why not simply put a polyfill
> behind the plot?
>
> set_plot, 'x'
> device, decomposed=0
> loadct, 3
> plot, indgen(10), /nodata, color=0, background=255
> polyfill, [0,10,10,0], [4,4,6,6], /data, COLOR=125
> plot, indgen(10), /noerase, color=0, background=255
>
> OR the similarly in the PS device
>
> set_plot, 'ps'
> device, file="test.ps"
> plot, indgen(10), /nodata
> polyfill, [0,10,10,0], [4,4,6,6], /data, color=125
> plot, indgen(10), /noerase
> device, /close
Re: How to create a transparent shadow on the PostScript device? [message #67709 is a reply to message #67575] Tue, 11 August 2009 05:52 Go to previous message
philipelson is currently offline  philipelson
Messages: 9
Registered: March 2009
Junior Member
David's page is quite clear that this is designed to work with a plot
that has already been created: "I cannot draw the polygon first and
then redraw the plot using OPlot because I do have have access to the
IDL source code".

If you have access to the data then why not simply put a polyfill
behind the plot?

set_plot, 'x'
device, decomposed=0
loadct, 3
plot, indgen(10), /nodata, color=0, background=255
polyfill, [0,10,10,0], [4,4,6,6], /data, COLOR=125
plot, indgen(10), /noerase, color=0, background=255


OR the similarly in the PS device

set_plot, 'ps'
device, file="test.ps"
plot, indgen(10), /nodata
polyfill, [0,10,10,0], [4,4,6,6], /data, color=125
plot, indgen(10), /noerase
device, /close
Re: How to create a transparent shadow on the PostScript device? [message #67710 is a reply to message #67575] Tue, 11 August 2009 04:44 Go to previous message
duxiyu@gmail.com is currently offline  duxiyu@gmail.com
Messages: 88
Registered: March 2007
Member
I am sorry that I still do not know how to do that.
Could you give me an example?
The example in your website is as follow, and I just want to get the
same figure in PS device.


PRO Transparent_Polygon

WINDOWSIZE=400

; Create some data.
signal = LoadData(1) - 15
time = Findgen(N_Elements(signal)) * 6.0 / N_Elements(signal)

; Create some windows.
Window, Title='Data Window', XSIZE=WINDOWSIZE, YSIZE=WINDOWSIZE, $
/FREE, XPOS=0, YPOS=0
dataWin = !D.Window
Window, Title='Polygon Window', XSIZE=WINDOWSIZE, YSIZE=WINDOWSIZE,
$
/FREE, XPOS=WINDOWSIZE+10, YPOS=0
polyWin = !D.Window

; Draw plot in data window.
WSet, dataWin
Plot, time, signal, BACKGROUND=FSC_Color('ivory'), $
COLOR=FSC_Color('navy'), $
/NODATA, XTitle='Time', YTitle='Signal Strength'
OPLOT, time, signal, THICK=2, COLOR=FSC_Color('cornflower blue')
OPLOT, time, signal, PSYM=2, COLOR=FSC_Color('olive')

; Take a snapshot.
background = TVREAD(TRUE=3)

; Copy data window and draw a polygon in the polygon window.
WSet, polyWin
DEVICE, COPY=[0, 0, WINDOWSIZE, WINDOWSIZE, 0, 0, dataWin]
POLYFILL, [ 0, 6, 6, 0, 0], $
[-5, -5, 5, 5, -5], /DATA, $
COLOR=FSC_COLOR('deep pink')

; Take a snapshot of this window, then delete it.
foreground = TVREAD(TRUE=3)

; Use a 25% transparent alpha.
alpha = 0.25
Window, Title='Transparent Polygon Window', XSIZE=WINDOWSIZE,
YSIZE=WINDOWSIZE, $
XPOS=2*WINDOWSIZE+20, YPOS=0, /FREE
TV, (foreground * alpha) + (1 - alpha) * background, TRUE=3

END


On Aug 10, 4:45 pm, Craig Markwardt <craig.markwa...@gmail.com> wrote:
> On Aug 10, 8:28 am, "dux...@gmail.com" <dux...@gmail.com> wrote:
>
>> Hi, all.
>
>> There is a method to create a transparent polygen in David's website.http://www.dfanning.com/code_tips/transpoly.html
>
>> But it seems that it does not work on the PS device.
>> Is there anyone who can give me a simple example of creating a
>> transparent shadow on the PS device?
>
> David's technique requires that your program can interact with the
> output device, which does not happen for postscript output.
>
> Postscript does not have specific transparency options.  You would
> basically need to render your full scene on the screen, or in a Z
> buffer, and then print the resulting pixmap.
>
> Craig
Re: How to create a transparent shadow on the PostScript device? [message #67717 is a reply to message #67575] Mon, 10 August 2009 07:45 Go to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
On Aug 10, 8:28 am, "dux...@gmail.com" <dux...@gmail.com> wrote:
> Hi, all.
>
> There is a method to create a transparent polygen in David's website.http://www.dfanning.com/code_tips/transpoly.html
>
> But it seems that it does not work on the PS device.
> Is there anyone who can give me a simple example of creating a
> transparent shadow on the PS device?

David's technique requires that your program can interact with the
output device, which does not happen for postscript output.

Postscript does not have specific transparency options. You would
basically need to render your full scene on the screen, or in a Z
buffer, and then print the resulting pixmap.

Craig
Re: How to create a transparent shadow on the PostScript device? [message #67718 is a reply to message #67575] Mon, 10 August 2009 07:04 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
duxiyu@gmail.com writes:

> There is a method to create a transparent polygen in David's website.
> http://www.dfanning.com/code_tips/transpoly.html
>
> But it seems that it does not work on the PS device.
> Is there anyone who can give me a simple example of creating a
> transparent shadow on the PS device?

Well, you understand this article describes a hack, right?

But, that said, there is no reason it wouldn't also work
in PostScript. Of course, the problem is that we are
working in screen resolution, rather than PostScript
resolution. If you have plenty of memory, you could try
upping the resolution (maybe in the Z-graphics buffer),
or (and I think this is what I would try) just work
with the "image" inside the axes by using the parameters
to TVRead to take just the portion of the plot inside
the axes. Then, after transferring that to the PostScript
file as an image, add axes to the image using true PostScript
resolution.

Depending, of course, on what is inside the area of
the image you want to work with, this may or may not
give you an acceptable solution.

Cheers,

David



--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: how to create a evf?
Next Topic: values changed after using print

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

Current Time: Wed Oct 08 20:02:02 PDT 2025

Total time taken to generate the page: 0.07526 seconds