Path: utzoo!mnetor!uunet!husc6!huma1!fry From: fry@huma1.HARVARD.EDU (David Fry) Newsgroups: comp.sys.mac Subject: Re: PICT's in LSC Message-ID: <3504@husc6.harvard.edu> Date: 9 Dec 87 15:34:49 GMT References: <2592@cbdkc1.ATT.COM> Sender: news@husc6.harvard.edu Reply-To: fry@huma1.UUCP (David Fry) Organization: Harvard Math Department Lines: 56 Keywords: Stress! Frustration! In article <2592@cbdkc1.ATT.COM> joe@cbdkc1.UUCP (Joseph !. Judge) writes: >I have a picture in MacPaint, I want to show as the Title Screen in a window >for an application/game (to be posted when done). > >OK here's what I do: >------------------------------------------------------------------------------ >- put the selection box around the area (about 1/2 the screen size). > actual coordinates are: top 25, left 03, bottom 225, right 508 >- Copy it out, pull down apple menu to scrapbook, paste the picture > in it. >- go to ResEdit, paste the Picture in my built application. >- Info on it, set it to rsrc # 256 >- I also make a WIND, rsrc# 256 also,:top 25, left 03, bottom 225, right 508 >------------------------------------------------------------------------------ > >(Don't flame, this code is from (hazy, anger filled) memory: ) >I try two things in C: >1) > MyWindPtr = GetNewWindow(256); > MyPicHdl = (PicHandle)GetPicture(256); > SetWindowPic(MyWindowPtr, MyPicHdl); /* tried & operator on these */ > ShowWindow(MyWindPtr); /* something like this */ I haven't given it too much thought, but here goes: When doing window updating in this fashion, QuickDraw will only draw your picture upon *updates*. You said this is a startup screen so undoubtably MyWindPtr is the only window on the screen. If your window is displayed at the time of GetNewWindow(), it has no reason to do an update when you call ShowWindow(). Go back to the WIND resource in ResEdit and set its visible bit to FALSE. Maybe it will work then. >and >2) > MyPicHdl = (PicHandle)GetPicture(256); > SomeRect = (**MyPicHdl).picFrame; > MyWindPtr = NewWindow(&w_rec, &SomeRect, blah, blah); > DrawPicture(&SomeRect, MyPicHdl); /* something like this */ First, you should set the port before drawing, just to make sure, with the call SetPort(MyWindPtr). Also, the rect SomeRect is not guaranteed to have a topleft corner of (0,0) so it may be off the edge of your window. Before DrawPicture(MyPicHdl,&SomeRect) (note the syntax), say OffsetRect(&SomeRect,-SomeRect.left,-SomeRect.top). For both of these techniques it is handy to call DetachResource(MyPicHdl) right after reading it from disk so that the Handle points to a picture, and not a resource. I hope this solves the problem. David Fry fry@huma1.harvard.EDU Department of Mathematics fry@harvma1.bitnet Harvard University ...!harvard!huma1!fry Cambridge, MA 02138