Thread View: comp.sys.mac.oop.macapp3
1 messages
1 total messages
Started by Parks, William,APD
Tue, 29 Dec 1992 07:49
DrawString in OffScreen
Author: Parks, William,APD
Date: Tue, 29 Dec 1992 07:49
Date: Tue, 29 Dec 1992 07:49
93 lines
2819 bytes
2819 bytes
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
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads