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

[MacPerl-Toolbox] OffScreen QuickDraw



I have need of a GWorld for a script, and it isn't working. At first 
I tried the following:

use Mac::QDOffscreen;
...    # A bunch of other stuff
my $internalGWorld;
my $GWorldPixmap;
my $oldGWorld;
my $oldGDevice;
...    # More stuff
$internalGWorld = NewGWorld( 1, Rect->new( 0, 0, 300, 30 ) );
$GWorldPixmap = GetGWorldPixMap( $internalGWorld );
LockPixels( $GWorldPixmap );
( $oldGWorld, $oldGDevice ) = GetGWorld();
SetGWorld( $internalGWorld, GetGWorldDevice( $internalGWorld ) );

... and at that point, the script would stop with an error of
# port is not of type GrafPtr.

Now, I have programmed the Mac Toolbox before (in C++), and that call 
should be happy with things as they stand, but I'm willing to 
typecast if necessary. Sadly, though, if a mechanism for this exists, 
it is not indexed in the MacPerl book (nothing under typecast or 
cast, and MacPack doesn't do GrafPorts). So I went and looked at 
examples, like the MPFE script, which also uses GWorlds. After seeing 
how that worked, I replaced the last line with:

SetGWorld( $internalGWorld );

... and the script now gives an error of
# Usage: Mac::QDOffscreen::SetGWorld(port, gdh).

which of course indicates that this isn't how that should work. Can 
anyone tell me what's wrong here? I've already spent enough time on 
this project that almost any other programming or scripting language 
other than MacPerl would have been faster, but I want to learn the 
MacPerl toolbox modules for future use.

-John Franklin

==== Want to unsubscribe from this list?
==== Send mail with body "unsubscribe" to macperl-toolbox-request@macperl.org