home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / sys / mac / oop / macapp3 / 311 < prev    next >
Encoding:
Internet Message Format  |  1992-12-29  |  2.7 KB

  1. Path: sparky!uunet!olivea!apple!applelink.apple.com
  2. From: PARKS.W@AppleLink.Apple.COM (Parks, William,APD)
  3. Newsgroups: comp.sys.mac.oop.macapp3
  4. Subject: DrawString in OffScreen
  5. Message-ID: <725616306.5937393@AppleLink.Apple.COM>
  6. Date: 29 Dec 92 07:49:00 GMT
  7. Sender: daemon@Apple.COM
  8. Organization: AppleLink Gateway
  9. Lines: 93
  10.  
  11. Hello
  12.  
  13.     I am trying to draw a resource picture, and have been having trouble with
  14. DrawString("this text").
  15.  
  16.     I am using a offScreen GraphPortfor the initial drawing. Then I CopyBits
  17. from one OffScreen graphPort to another with a open Picture. The line drawing
  18. is transferred but not the DrawString calls. The picture with line drawing but
  19. without the strings is saved.
  20.  
  21.     Both OffScreen Ports have the same size rects.
  22.  
  23.     Any ideas???
  24.  
  25.  
  26.    GetPort(savePort);
  27.    SetRect(theRect, 0, 4, 208, 248);
  28.    this->ViewToQDRect(theRect, theQDRect);
  29.    if(CreateOffscreenBitMap(&offscreen,&theQDRect))
  30.    {
  31.    SetPort(offscreen);
  32.  
  33.    PenSize(3,3);
  34.  
  35.    MoveTo(0,5);
  36.    LineTo(205,5);
  37.    MoveTo(0,244);
  38.    LineTo(205,244);
  39.  
  40.    MoveTo(0,5);
  41.    LineTo(0,244);
  42.  
  43.    MoveTo(205,5);
  44.    LineTo(205,244);
  45.  
  46.    PenSize(1,1);
  47.  
  48.    TextFace(bold);
  49.    TextFont(3);
  50.    TextSize(9);
  51.  
  52.    MoveTo(14,18);
  53.    DrawString("This is it here");
  54.    //DrawString(fRTDocument->fWCellName[0]);   //Segs
  55.    MoveTo(100,18);
  56.    DrawString("0");//Percent
  57.    MoveTo(115,18);
  58.    DrawString("%");
  59.    MoveTo(0,21);
  60.    LineTo(207,21);
  61.  
  62.    if(CreateOffscreenBitMap(&offscreen2,&theQDRect))
  63.    {
  64.    //BMWindPic = NULL;
  65.    BMWindPic = NULL;
  66.    oldState = HGetState((Handle)BMWindPic);
  67.    HNoPurge((Handle)BMWindPic);
  68.    SetPort(offscreen2);
  69.    BMWindPic = OpenPicture(theQDRect);
  70.    CopyBits( offscreen->portBits, offscreen2->portBits, offscreen->portRect,
  71. offscreen2->portRect, srcCopy, nil);
  72.    ClosePicture();
  73.    }
  74.    DestroyOffscreenBitMap(offscreen);
  75.    DestroyOffscreenBitMap(offscreen2);
  76.  
  77.    SetPort(savePort);
  78.  
  79.    //resPictName = "PictResFile";
  80.    curResFileNum = CurResFile();
  81.    UseResFile(curResFileNum);
  82.  
  83.    //Removes Old Resource Picture (The RT Chart Pict)
  84.    tempPicHandle = GetPicture(kRTChartAppPict);
  85.    FailNILResource((Handle)tempPicHandle); // was FailResError();
  86.    oldTempState = HGetState((Handle)tempPicHandle);
  87.    HNoPurge((Handle)tempPicHandle);//Locks handle
  88.    RmveResource((Handle)tempPicHandle);
  89.    HSetState((Handle)tempPicHandle, oldTempState); //UnLocks handle
  90.    UpdateResFile(curResFileNum);
  91.  
  92.    //Writes New Resource Picture
  93.    BMWindP = Handle(BMWindPic);
  94.    AddResource(BMWindP, 'PICT', kRTChartAppPict, "screenPic");
  95.    ChangedResource(BMWindP);
  96.    WriteResource(BMWindP);
  97.    UpdateResFile(curResFileNum);
  98.  
  99.    HSetState((Handle)BMWindPic, oldState);
  100.  
  101. Thanks,
  102.   Bill Parks
  103.  
  104.