home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!olivea!apple!applelink.apple.com
- From: PARKS.W@AppleLink.Apple.COM (Parks, William,APD)
- Newsgroups: comp.sys.mac.oop.macapp3
- Subject: DrawString in OffScreen
- Message-ID: <725616306.5937393@AppleLink.Apple.COM>
- Date: 29 Dec 92 07:49:00 GMT
- Sender: daemon@Apple.COM
- Organization: AppleLink Gateway
- Lines: 93
-
- Hello
-
- I am trying to draw a resource picture, and have been having trouble with
- DrawString("this text").
-
- I am using a offScreen GraphPortfor the initial drawing. Then I CopyBits
- from one OffScreen graphPort to another with a open Picture. The line drawing
- is transferred but not the DrawString calls. The picture with line drawing but
- without the strings is saved.
-
- Both OffScreen Ports have the same size rects.
-
- Any ideas???
-
-
- GetPort(savePort);
- SetRect(theRect, 0, 4, 208, 248);
- this->ViewToQDRect(theRect, theQDRect);
- if(CreateOffscreenBitMap(&offscreen,&theQDRect))
- {
- SetPort(offscreen);
-
- PenSize(3,3);
-
- MoveTo(0,5);
- LineTo(205,5);
- MoveTo(0,244);
- LineTo(205,244);
-
- MoveTo(0,5);
- LineTo(0,244);
-
- MoveTo(205,5);
- LineTo(205,244);
-
- PenSize(1,1);
-
- TextFace(bold);
- TextFont(3);
- TextSize(9);
-
- MoveTo(14,18);
- DrawString("This is it here");
- //DrawString(fRTDocument->fWCellName[0]); //Segs
- MoveTo(100,18);
- DrawString("0");//Percent
- MoveTo(115,18);
- DrawString("%");
- MoveTo(0,21);
- LineTo(207,21);
-
- if(CreateOffscreenBitMap(&offscreen2,&theQDRect))
- {
- //BMWindPic = NULL;
- BMWindPic = NULL;
- oldState = HGetState((Handle)BMWindPic);
- HNoPurge((Handle)BMWindPic);
- SetPort(offscreen2);
- BMWindPic = OpenPicture(theQDRect);
- CopyBits( offscreen->portBits, offscreen2->portBits, offscreen->portRect,
- offscreen2->portRect, srcCopy, nil);
- ClosePicture();
- }
- DestroyOffscreenBitMap(offscreen);
- DestroyOffscreenBitMap(offscreen2);
-
- SetPort(savePort);
-
- //resPictName = "PictResFile";
- curResFileNum = CurResFile();
- UseResFile(curResFileNum);
-
- //Removes Old Resource Picture (The RT Chart Pict)
- tempPicHandle = GetPicture(kRTChartAppPict);
- FailNILResource((Handle)tempPicHandle); // was FailResError();
- oldTempState = HGetState((Handle)tempPicHandle);
- HNoPurge((Handle)tempPicHandle);//Locks handle
- RmveResource((Handle)tempPicHandle);
- HSetState((Handle)tempPicHandle, oldTempState); //UnLocks handle
- UpdateResFile(curResFileNum);
-
- //Writes New Resource Picture
- BMWindP = Handle(BMWindPic);
- AddResource(BMWindP, 'PICT', kRTChartAppPict, "screenPic");
- ChangedResource(BMWindP);
- WriteResource(BMWindP);
- UpdateResFile(curResFileNum);
-
- HSetState((Handle)BMWindPic, oldState);
-
- Thanks,
- Bill Parks
-
-