acmfiu@serss0.fiu.edu (ACMFIU) (05/14/91)
i have an on-screen window but would like to create an off-screen grafport that would contain the contents of the window. it's no problem for me to create and maintain the off-screen grafport but what i want is to store the pointer to this grafport in some "safe" area in a windows grafport so that when i need to copy the data from off-screen to on-screen i can have the off-screen grafport readily available (i.e. i don't want to create a global for the off-screen grafport and i can do it locally by _GetPort and then getting the pointer to my off-screen grafport out of that data structure). i need to do this for some faster screen writes. i took a look at the window data structure and i could store the grafport pointer in wRefCon. however, i can find this entry in a GrafPort, which is different, to my anyway, than a window data structure you pass to NewWindow. oh yeah, if there's another 4-byte location free in the window grafport i'd like to know about that too. albert chin
dlyons@Apple.COM (David A. Lyons) (05/14/91)
In article <3567@kluge.fiu.edu> acmfiu@serss0.fiu.edu (ACMFIU) writes: >[...] >i took a look at the window data structure and i could store the grafport >pointer in wRefCon. however, i can find this entry in a GrafPort, which is >different, to my anyway, than a window data structure you pass to NewWindow. > >oh yeah, if there's another 4-byte location free in the window grafport >i'd like to know about that too. > >albert chin Sure, the refcon is a perfectly good place to keep information that goes with each window--this way you can have an unlimited number of windows and always have access to the right data when you need it. You point out that a grafport pointer is not the same as a window pointer. That's true. But you can think of a window as an *extension* of a grafport. A grafport is the first thing in a window, and there's more stuff beyond that. So: Every window pointer is also a grafport pointer, but only *some* grafport pointers are window pointers. In your window update routine, for example, you can call GetPort to find out what window you're updating. The port at that point is guaranteed to be a window pointer, so you're perfectly free to call GetWRefCon on it to get at your data. (And, finally, there is no extra space in the grafport structure.) -- David A. Lyons, Apple Computer, Inc. | DAL Systems Apple II System Software Engineer | P.O. Box 875 America Online: Dave Lyons | Cupertino, CA 95015-0875 GEnie:DAVE.LYONS CompuServe:72177,3233 Internet:dlyons@apple.com My opinions are my own, not Apple's.