Howdy: I have started experimenting with QD.pl and the toolbox routines. My goal is a program that will draw a graph on the screen and save it to disk as a PICT file. I can do the former with the Toolbox calls and the latter with QD, but not vice versa. One of the most serious limitations to my understanding is how one goes back and forth between handles and scalars (used by QuickDraw) and MacPerl (which doesn't use raw memory reverences, AFAIK). Second question: could someone point me to sample code which sends a PICT to the printer in the "normal" Mac way? I'd like to have the option of printing the graph. Last question: when programs exit abnormally, windows I create don't get deallocated, and the only way I have found to get rid of them is to quit MacPerl. Is there a better way? Thanks in advance for the help! -David Steffen- Example program: ---===--- #!perl use Mac::Events; use Mac::Windows; use Mac::QuickDraw; use Mac::Fonts; require "qd.pl"; $bounds = new Rect 3, 41, 553, 591; $win = new MacWindow $bounds, "Testing Quickdraw", 1, documentProc, 1; # Create a PICT using QD &qd'SetRect(*myRect,0,0,500,500); # Define a 500 pixel square &qd'OpenPicture($myRect); # Begin defining the picture &qd'ClipRect($myRect); # Always a good idea &qd'SetRect(*myRect,0,0,200,200); # New rectangle &qd'PaintRect($myRect); # Fill rectangle with that color $data = &qd'ClosePicture; # Close picture and retrieve data # Save to disk to make sure it's OK open OUTFILE, ">testpict" || die "Can't open output file: $!\n"; print OUTFILE $data; close OUTFILE; # Remove the 512 bytes at the start & make into PictHandle $temp = substr($data, 512); $myPict = PicHandle->new( $data ); # Make a pict using Quickdraw Routines $portR = new Rect 10, 10, 60, 60; $tRect = new Rect 0, 0, 500, 500; $myPict2 = OpenPicture( $tRect ); FrameOval($portR); ClosePicture; # Now see what we've got $win->sethook("redraw", \&DrawScreen); #drawing routine WaitNextEvent while $win->window; #event handler, until click in close box dispose $win; # Look at it another way $x = $myPict->picFrame(); $y = $x->bottom(); $a = $myPict2->picFrame(); $b = $a->bottom(); print "-$y-$b-\n"; # Output: -0-500- # Screen Update sub DrawScreen { SetPort($win->window); #set port to windows port DrawPicture($myPict, $tRect); # Doesn't Happen DrawPicture($myPict2, $tRect); # Happens } ---===--- David Steffen, Ph.D. President, Biomedical Computing, Inc. <http://www.biomedcomp.com/> Phone: (713) 610-9770 FAX: (713) 610-9769 E-mail: steffen@biomedcomp.com ***** Want to unsubscribe from this list? ***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch