[comp.sys.mac.programmer] Qick Draw & Scroll-Bar

oster@well.sf.ca.us (David Phillip Oster) (04/11/90)

In article <103@ledip.UUCP> emadona@ledip.UUCP (Enrico) writes:
_>We have a drawing that is greater than the content 
_>region of a window with scroll-bar.  The drowing consist of a sequence
_>of designs of the same shape, but with different width (ex. different
_>rectangle ).

_>We would like to:  
_>       - store the design of all of the structure en
_>         some area of memory
picHand = OpenPicture(&contentRect);
... your quickdraw commands here
ClosePicture();
_>       - send such area of memory so that Quick Draw
_>         could show the part of the drawing correspon-
_>         ding to the current location of the scroll-bar
rView = (**picHand).picFrame;
DrawPicture(picHand, &rView);
_>Questions:
_>       - is if posible that the relation scroll bar-view
_>         of the window be managed by Quck Draw?
_>         If so, how could we do if?
SetOrigin(GetCtlValue(hScroll), GetCtlValue(vScroll));
rView = (**picHand).picFrame;
DrawPicture(picHand, &rView);
/* or your drawing commands directly */
SetOrigin(0, 0);	/* always reset this or the scroll bar won't work */
_>       - if it is not, would itbe the only solution that
_>         our application have to draw the part of the sequence 
_>         of shaper corresponding to a movement of scroll bar?
Actually, you want to handle the scroll bar by remembering the current value,
then, whenever the user moves it, do a ScrollRect with the difference
between the current and the new values, then set your ClipRgn to be
the region computed by ScrollRect, and call the above drawing code. That
way, only the newly visible part will be drawn, which will speed things up
significantly.  (I can never remember if you have to offset the ClipRgn
when you use SetOrigin(), I always have to try it once to get it right.)
_>Molina - Ferrari
_>L.E.D.
_>Universidad Catolica de Asuncion
_>Paraguay
_>EMail ..!uunet!ledip!lferrari
-- 
-- David Phillip Oster - Note new address. Old one has gone Bye Bye.
-- oster@well.sf.ca.us = {backbone}!well!oster