[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Opening PICT files with MacPerl



>Using the script in MPPE around p. 207 (1.Drawing.3.pl on the CD-ROM),
>change lines 39-40 to:

Gotcha.  Did this, and it works nicely.  Thanks.  Added a dialog so I 
didn't have to hand-code the pathname.  Oh, and my PICT file needs no 
offset, so I changed that too.

#!perl -w

require 'GUSI.ph';
use Mac::Windows;
use Mac::QuickDraw;
use Mac::Events;
my($style, $title, $win, $winr);

$f = MacPerl::Choose(GUSI::AF_FILE(), 0, "");

$style = floatProc();
$title = 'HAL 9000';
$winr = Rect->new(50, 50, 170, 400);
$win = MacWindow->new(
    $winr, $title, 1, $style, 1
    );
$win->sethook('redraw' => \&draw_it);

while ($win->window()) {
  WaitNextEvent();
  }
  
END {
 $win->dispose() if (defined($win));
 }
 
sub draw_it {
my($p, $r);
#  $p = GetPicture(128); (not used)
  {
    local $/;  # slurp mode /
    open(PICT, $f) or die $!;
    $p = PicHandle->new(substr(<PICT>, 512));
		$r = $p->picFrame();
    DrawPicture($p, OffsetRect($r,
        ($r->left()), ($r->top())
        ));
  }
}

# Fungal Parataxonomy                   Mycology Information (Mycoinfo)
# Webmaster, Staff Writer      **The World's First Mycology E-Journal**   
# <mailto:webmaster@mycoinfo.com>            <http://www.mycoinfo.com/> 
# "A couple of guys trying to do something great..."



***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch