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

Re: [MacPerl] Drawing in a Color Window with MacPerl



Philippe Rochambeau writes:

>Questions:
>
>1) What is the equivalent of PaintOval(myWindow^.portRect) in MacPerl (i.e.,
>How do you get a pointer to the portRect in MacPerl)?
>
>2) How can I make my own colors using 3 RGB values, instead of using constants
>such as blueColor, whiteColor, etc?
>
>3) How can I make my circle last (it currently disappears almost immediately)?
>
>4) How do you manage window events in MacPerl when not using MacWindow?
>
>Any help would be appreciated.
>
>

This should answer most of your questions:

===================================
#!perl

use Mac::Events;
use Mac::Windows;
use Mac::QuickDraw;
use Mac::Fonts;

$color = pack (S3, 13107, 13107, 65535); #kind of blue

$love = new Pattern q{
			        .XX.XX..
			        X..X..X.
			        X.....X.
			        .X...X..
			        ..X.X...
			        ...X....
			        ........
			        ........
};

$portR = new Rect 0, 0, 100, 100;
$bounds = new Rect 40, 50, 150, 150;
$win = new MacWindow $bounds, "Hello World!", 1, documentProc, 1;
$win->sethook("redraw", \&DrawOval); #drawing routine


WaitNextEvent while $win->window; #event handler, until click in close box

dispose $win;

sub DrawOval {
	SetPort($win->window); #set port to windows port
	ForeColor($color);
	PenPat($love);
	PaintOval($portR);
}
===================================

Hope that helps.
Michael

-
Michael Ziege
Sallenbachstr. 11
8055 ZŸrich
Switzerland
tel. 	+41 1 463 8278 (priv.)
	+41 1 381 3757 (buis.)
e-mail. ziege@ito.umnw.ethz.ch



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