[comp.sys.mac.programmer] Offscreen Bitmap help needed...!

es1o+@andrew.cmu.edu (Eric Mitchell Snider) (10/09/90)

	I'm trying to create an offscreen bitmap (In Pascal) and draw a large
PICT into it.  I've done this before and everything works properly.  I
copybits things from the offscreen bitmap to the screen to do drawing,
etc.  Anyway, now I'd like to have an offscreen bitmap that is larger
than the size of my window.  It seems that my PICT is getting clipped
(?) to the size of the window.  When I do a Copybits from offscreen to
the screen everything comes out ok except for when I copy from a part of
the PICT that wouldn't have fit in the window.  (Maybe the PICT is
getting clipped to the visrgn of the window?)
	I must be doing something wrong.  I was wondering if someone could send
me some Pascal source code to generate an offscreen bitmap the correct
way.  An explanation of why it might have been clipping the PICT (or
whatever causes the problem) would be good too.

			Eric

es1o@andrew.cmu.edu

smoke@well.sf.ca.us (Nicholas Jackiw) (10/10/90)

In article <Ub4AO6m00Vp1M7AUUL@andrew.cmu.edu> es1o+@andrew.cmu.edu (Eric Mitchell Snider) writes:
>
>Anyway, now I'd like to have an offscreen bitmap that is larger
>than the size of my window.  It seems that my PICT is getting clipped
>(?) to the size of the window.  When I do a Copybits from offscreen to
>the screen everything comes out ok except for when I copy from a part of
>the PICT that wouldn't have fit in the window.  (Maybe the PICT is
>getting clipped to the visrgn of the window?)

Right.  I assume you allocate your offscreen drawing stuff as a bitmap,
and then, to draw it, do a SetPortBits(myOffBits).  Note the meaning
of this call--it changes the bits to which drawings in the current
port are imaged.  You haven't changed the port, however, so all of
the port-specific attributes, such as the visRgn, clipRgn, pen mode/
face/size/origin, etc., are applied to offscreen drawing.  In your
case, you probably don't want any of these attributes.  The thing to do
then is to create a separate GrafPort to refer to your (separate) offscreen
bits.Alternately, you can stash the current port's parameters some place
and swap in your own drawing attributes temporarily.  The former method
may take up a bit more memory, but it affords you the ease of coding
SetPort(offWorld); draw; SetPort(myWindow); draw; and so on.

You might also want to look into the 32-bit Quickdraw gWorld calls. More
arcana to master, and they make you dependent on 32BCQD, but you stand
to gain tremendous performance advantages from Quickdraw accelerators.





-- 
                              --- * ---
Nicholas Jackiw                Smoke@well.sf.ca.us | Jackiw@cs.swarthmore.edu
Key Curriculum Press, Inc.     Applelink: D3970    | (415) 548-2304
                              --- * ---

pepke@gw.scri.fsu.edu (Eric Pepke) (10/10/90)

From the One-Liners:

Always set the VisRgn and ClipRgn of offscreen ports.

Eric Pepke                                    INTERNET: pepke@gw.scri.fsu.edu
Supercomputer Computations Research Institute MFENET:   pepke@fsu
Florida State University                      SPAN:     scri::pepke
Tallahassee, FL 32306-4052                    BITNET:   pepke@fsu

Disclaimer: My employers seldom even LISTEN to my opinions.
Meta-disclaimer: Any society that needs disclaimers has too many lawyers.