[comp.sys.mac.programmer] Novice Questions:

kincaid@cg-atla.UUCP (Tom Kincaid ) (05/22/91)

In looking through the QuickDraw documentation in Inside Mac.
Volume I, there does not seem to be a plot point primitive.

If I wanted to draw a spline or a Bezier what would be considered
the best way to do this? A series of lineto's, should I manipulate
the grafport's bits directly? 

			Thanks,

				Tom Kincaid

d88-jwa@byse.nada.kth.se (Jon W{tte) (05/27/91)

In article <9768@cg-atla.UUCP> kincaid@cg-atla.UUCP (Tom Kincaid ) writes:

   From: kincaid@cg-atla.UUCP (Tom Kincaid )

   In looking through the QuickDraw documentation in Inside Mac.
   Volume I, there does not seem to be a plot point primitive.

The obvious, intuitive way of doing this is:

MoveTo ( x , y ) ;
Line ( 0 , 0 ) ;

Welcome to the wonderful world of mac programming !

   If I wanted to draw a spline or a Bezier what would be considered
   the best way to do this? A series of lineto's, should I manipulate
   the grafport's bits directly? 

Manipulating bits directly really isn't worth the botherm since you
have to take clipping, multiple screens, 32-bit access switching,
graphics accelerators and about 10,000 other things into account.

You could define your own BitMap and draw into that, and then
CopyBits onto the screen, for speed, or just MoveTo and Line for
convenience.

If you're new to the mac, you should get the UseNet Macintosh Programmer's
Guide, available from all respectable ftp sites.

--
						Jon W{tte
						h+@nada.kth.se
						- Power !

Christopher Tate <CXT105@psuvm.psu.edu> (05/27/91)

In article <D88-JWA.91May26212925@byse.nada.kth.se>, d88-jwa@byse.nada.kth.se
(Jon W{tte) says:
>
>The obvious, intuitive way of doing this is [drawing a single pixel]:
>
>MoveTo ( x , y ) ;
>Line ( 0 , 0 ) ;

Because of the way that Quickdraw handles drawing lines, the faster
way of doing this is to use Line(1, 0) or Line(0, 1) instead of
Line(0, 0).  Gotta love it....  :-)

-------
Christopher Tate                  | "Living in a fisheye lens, caught
                                  |  in the camera eye; I have no
cxt105@psuvm.psu.edu              |  heart to lie:  I can't pretend a
{...}!psuvax1!psuvm.bitnet!cxt105 |  stranger is a long-awaited friend."
cxt105@psuvm.bitnet               |              -- Rush, "Limelight"

andreww@uniwa.uwa.oz (Andrew John Williams) (05/27/91)

kincaid@cg-atla.UUCP (Tom Kincaid ) writes:

>In looking through the QuickDraw documentation in Inside Mac.
>Volume I, there does not seem to be a plot point primitive.

>If I wanted to draw a spline or a Bezier what would be considered
>the best way to do this? A series of lineto's, should I manipulate
>the grafport's bits directly? 

>			Thanks,

>				Tom Kincaid
For splines and Beziers and the like, you usually draw lines between
each point and the last - the curves look better`(no holes) and you can
almost always get away with much less calculation (you don't need as
many points). QuickDraw has no point plot for the very good reason that
you should never need it.

John West (stealing Andrew's account)
fish fish fish

chuck@brain.UUCP (Chuck Shotton) (05/27/91)

In article <1991May27.010201.17174@uniwa.uwa.oz>, andreww@uniwa.uwa.oz (Andrew John Williams) writes:
> many points). QuickDraw has no point plot for the very good reason that
> you should never need it.
> 
> John West (stealing Andrew's account)
> fish fish fish
> 

NOT TRUE. You can plot individual pixels on a Mac with the following 2 lines:

MoveTo(x,y);
Line(0,0);


-----------------------------------------------------------------------
Chuck Shotton                 Internet:   cshotton@girch1.med.uth.tmc.edu
"Your silly quote here."      UUCP:       ...!buster!brain

Lawson.English@p88.f15.n300.z1.fidonet.org (Lawson English) (05/29/91)

Christopher Tate writes in a message to All

>The obvious, intuitive way of doing this is [drawing a single pixel]:
>
>MoveTo ( x , y ) ;
>Line ( 0 , 0 ) ;
CT>  Because of the way that Quickdraw handles drawing lines, the 
CT> faster way of doing this is to use Line(1, 0) or Line(0, 1) instead 
CT> of Line(0, 0). Gotta love it.... :-)

Because of the Trap-dispatcher overhead, the best way would be to setup a rect
 
w/o SetRect and call PaintRect or FillRect (benchmark 'em for which is 
faster).
This avoids 1 system call. I've also seen CopyBits suggested.

Lawson 
 

 

--  
Uucp: ...{gatech,ames,rutgers}!ncar!asuvax!stjhmc!300!15.88!Lawson.English
Internet: Lawson.English@p88.f15.n300.z1.fidonet.org