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

Home » Public Forums » archive » Re: write_gif problem: Garbled Image
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
Re: write_gif problem: Garbled Image [message #15847] Tue, 15 June 1999 00:00
Chris McCarthy is currently offline  Chris McCarthy
Messages: 4
Registered: March 1995
Junior Member
Hi,

I seem to have solved my problem. I was
switching to a different workspace on my desktop
(I have 6 workspaces on my FVWM desktop). Apperently
this is not allowed, ie the window must be on the
presently displayed screen to be tvrd()'d. Perhaps
that should have been obvious, but it is a bummer
because I like to switch to another workspace while
this lenghthy progam completes, now I will just
have to wait for it, or try to fit additional
work onto this desktop.

Regards,
Chris McCarthy



Chris McCarthy wrote:
>
> Hi Folks,
>
> I'm making .gifs of my data using write_gif
> after grabing the display using tvrd() (data are
> displayed using the "display.pro", similar to "tv",
> then annotated)
>
> With a single program I generate 8 images, and occasionally
> one of the .gifs comes out 80% garbled. Top 20% is
> ok. I get the error message:
>
> % TVRD: Unable to create X windows Window completely
> off screen, nothing read.
>
> Here's an examples:
>
> Normal Image:
> http://www.astro.ucla.edu/~chris/gif/HD110463K.ON7.gif
>
> Garbled Image:
> http://www.astro.ucla.edu/~chris/gif/HD110463K.ON6.gif
>
> In all cases I am watching the displayed images and they
> look fine. Seems that tvrd() is having a problem with them
> but why? Any ideas would be great. Thanks a lot
>
> Chris McCarthy
> UCLA Astronomy
Re: write_gif problem: Garbled Image [message #15849 is a reply to message #15847] Tue, 15 June 1999 00:00 Go to previous message
David Foster is currently offline  David Foster
Messages: 341
Registered: January 1996
Senior Member
Chris McCarthy wrote:
>
> Hi Folks,
>
> I'm making .gifs of my data using write_gif
> after grabing the display using tvrd() (data are
> displayed using the "display.pro", similar to "tv",
> then annotated)
>
> With a single program I generate 8 images, and occasionally
> one of the .gifs comes out 80% garbled. Top 20% is
> ok. I get the error message:
>
> % TVRD: Unable to create X windows Window completely
> off screen, nothing read.

<http references to example images snipped>

>
> In all cases I am watching the displayed images and they
> look fine. Seems that tvrd() is having a problem with them
> but why? Any ideas would be great. Thanks a lot
>
> Chris McCarthy
> UCLA Astronomy

Chris -

TVRD has problems reading a scrollable draw widget, and can have
problems reading a window if it is iconified or obscured, at least
under X windows. I believe David Fanning has an article on this
at his website: www.dfanning.com .

You might try an approach I've used in a SAFE_TVRD(), which creates
a new pixmap window, uses DISPLAY, COPY=[] to copy the window into
the pixmap, and then uses TVRD() to read from the pixmap. Seems to
work in all situations. If there is a more straightforward approach
to this problem I'd love to see it. Here's the code:

;------- Cut here -------------------------------------------------
; SAFE_TVRD.PRO 6-11-97 DSFoster
;
; This function is a safer version of IDL's TVRD() function. First,
; there was a bug related to the reading from a scrollable draw. Also,
; the TVRD() function uses an X routine that has problems if the
; window is obscured or iconified. This routine uses the DEVICE, COPY=
; command to first copy the window contents to a new window pixmap,
; and then reads from this pixmap into the array.
;
; Modifications
;
; 6-11-97 DSF Check validity of draw widget.

FUNCTION safe_tvrd, draw_widget, xsize, ysize

on_error, 2

if (widget_info(draw_widget, /valid_id) eq 0) then begin
return, -1
endif else if (widget_info(draw_widget, /name) ne 'DRAW') then begin
return, -1
endif else begin
old_window = !d.window
window, xsize=xsize, ysize=ysize, /free, /pixmap ; Create new
window

widget_control, draw_widget, get_value=window
device, copy=[0,0, xsize,ysize, 0,0, window] ; Copy into new
window

image = tvrd() ; Read into array
wdelete, !d.window
if (old_window ne -1) then wset, old_window
return, image
endelse

END
;--------- Cut here -------------------------------------------------

Dave Foster
--

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
David S. Foster Univ. of California, San Diego
Programmer/Analyst Brain Image Analysis Laboratory
foster@bial1.ucsd.edu Department of Psychiatry
(619) 622-5892 8950 Via La Jolla Drive, Suite 2240
La Jolla, CA 92037
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Automatic Structure Definition
Next Topic: Re: Releasing dll's

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

Current Time: Wed Oct 08 11:35:24 PDT 2025

Total time taken to generate the page: 0.00697 seconds