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

Home » Public Forums » archive » Re: Quickly Erasing lines on direct graphics images
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: Quickly Erasing lines on direct graphics images [message #46249] Mon, 14 November 2005 05:11
Richard French is currently offline  Richard French
Messages: 173
Registered: December 2000
Senior Member
On 11/14/05 12:19 AM, in article MPG.1de1cc535af6334a9896ac@news.frii.com,
"David Fanning" <david@dfanning.com> wrote:

>
> OK, I haven't *tested* this one on a Macintosh, but
> I think it has a better chance of working than the
> last one I put over there. :-)

Yup, works on a Mac, and ->map does the job, too. Many thanks!
Dick


One small typo: error message for CopytoPixmap is misnamed:

PRO PIXMAP::CopytoPixmap, windex

IF N_Elements(windex) EQ 0 THEN windex = !D.Window

IF windex LT 0 THEN BEGIN

void = Dialog_Message('PIXMAP::COPYtoWINDOW: No graphics window
available to copy to pixmap.')

ENDIF

self -> SetWindow

Device, Copy=[0, 0, !D.X_Size, !D.Y_Size, 0, 0, windex]



END ; ------------------------------------------------------------ ------
Re: Quickly Erasing lines on direct graphics images [message #46255 is a reply to message #46249] Sun, 13 November 2005 21:19 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Richard G. French writes:

> David - I tried this, and nothing showed up in window 3 (which I had already
> created, using
> Window,3,xsize=300,ysize=400
>>
>> pixmap -> SetWindow
>> Plot, findgen(11) ; etc.
>>
>> To copy to a window, say window index number 3:
>>
>> pixmap -> CopyToWindow, 3

Wait! Macintosh, right!

Here is one thing I *have* learned in the past couple
of weeks. If you are going to write programs that run
on a Macintosh, you darn well better learn what RETAIN=2
means! In fact, if I were a Mac user, you can bet I would
have this command in my IDL startup file:

DEVICE, RETAIN=2

Otherwise, not much good software is going to run on that
damn machine.

That said, I, uh, put the wrong number on the RETAIN
keyword. Sorry. :-(

> In the version on the ftp site, I get:
> IDL> pixmap->map,1
> % Attempt to call undefined method: 'PIXMAP::MAP'.
> % Execution halted at: $MAIN$
> IDL>
>>
> Is there a newer version out there somewhere?

Sigh... Computers are a mystery to me, as they are
to most of my students. "Do you mean I have to *save*
the file before I transfer it over there via FTP!?"

OK, I haven't *tested* this one on a Macintosh, but
I think it has a better chance of working than the
last one I put over there. :-)

ftp://ftp.dfanning.com/pub/dfanning/outgoing/misc/pixmap__de fine.pro

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: Quickly Erasing lines on direct graphics images [message #46263 is a reply to message #46255] Sun, 13 November 2005 17:48 Go to previous message
Richard French is currently offline  Richard French
Messages: 173
Registered: December 2000
Senior Member
David - I tried this, and nothing showed up in window 3 (which I had already
created, using
Window,3,xsize=300,ysize=400
>
> pixmap -> SetWindow
> Plot, findgen(11) ; etc.
>
> To copy to a window, say window index number 3:
>
> pixmap -> CopyToWindow, 3
>
> If you wish to make the pixmap a different size (for
> example, in a resizeable graphics window application):
>
> pixmap -> Resize, newXsize, newYsize
>
> But, best of all, if you want to see what you actually
> have in the pixmap (i.e., so you can debug your program):
>
> pixmap -> Map, 1
>
> To hide it again:
>
> pixmap -> Map, 0

In the version on the ftp site, I get:
IDL> pixmap->map,1
% Attempt to call undefined method: 'PIXMAP::MAP'.
% Execution halted at: $MAIN$
IDL>
>


Is there a newer version out there somewhere?
Re: Quickly Erasing lines on direct graphics images [message #46264 is a reply to message #46263] Sun, 13 November 2005 17:37 Go to previous message
Richard French is currently offline  Richard French
Messages: 173
Registered: December 2000
Senior Member
David -
I'm beginning to see that I'd better finally bite the bullet and learn how
to use IDL Objects. When did you say your long-awaited book on this topic
will hit amazon.com?

Dick

PS thanks for the pixmap tips.
Re: Quickly Erasing lines on direct graphics images [message #46265 is a reply to message #46264] Sat, 12 November 2005 14:22 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Folks,

> Richard G. French writes:
>
>> I have a Direct Graphics question. How can I quickly erase lines that I have
>> drawn in displayed images?
>
> The standard way to do this kind of "quick erasing" is
> to use a pixmap and the "Device Copy" technique.

Participants in my class this week wrote a pixmap object
that proved extremely useful. I've made it available here:

ftp://ftp.dfanning.com/pub/dfanning/outgoing/misc/pixmap__de fine.pro

To create a pixmap with an X size of 300 and a Y size
of 400 pixels, you do this:

pixmap = Obj_New('pixmap', XSize=300, YSize=400)

Given that you have something in IDL graphics window
2 that you want to copy to a pixmap, you would do this:

pixmap -> CopyToPixmap, 2

Or, you can simply draw graphics in the pixmap:

pixmap -> SetWindow
Plot, findgen(11) ; etc.

To copy to a window, say window index number 3:

pixmap -> CopyToWindow, 3

If you wish to make the pixmap a different size (for
example, in a resizeable graphics window application):

pixmap -> Resize, newXsize, newYsize

But, best of all, if you want to see what you actually
have in the pixmap (i.e., so you can debug your program):

pixmap -> Map, 1

To hide it again:

pixmap -> Map, 0

Be sure to destroy it when you are done. If it is
mapped, you can destroy it with your mouse. If not,
you must do it like this:

Obj_Destroy, pixmap

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: Quickly Erasing lines on direct graphics images [message #46266 is a reply to message #46265] Sat, 12 November 2005 08:31 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Richard G. French writes:

> I have a Direct Graphics question. How can I quickly erase lines that I have
> drawn in displayed images?

The standard way to do this kind of "quick erasing" is
to use a pixmap and the "Device Copy" technique. This will
be at least a 100 times faster than redrawing your image.
Here is an article that describes the technique:

http://www.dfanning.com/widget_tips/rubberband_regular.html

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: subscripting arrays with dim > 1
Next Topic: make .dll share image file for CALL_EXTERNAL

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

Current Time: Wed Oct 08 13:48:16 PDT 2025

Total time taken to generate the page: 0.01217 seconds