home *** CD-ROM | disk | FTP | other *** search
/ QBasic & Borland Pascal & C / Delphi5.iso / C / Samples / CSAPE32.ARJ / SOURCE / OWLSCR / DIGPMCLI.C < prev    next >
Encoding:
C/C++ Source or Header  |  1990-03-29  |  1.6 KB  |  61 lines

  1. /*
  2.     digpmcli.c
  3.  
  4.     % RAM driver stuff
  5.  
  6.     10/4/88 Ted  Extracted from pcramdra.c
  7.  
  8.     OWL-DIG 1.2
  9.     Copyright (c) 1988, by Oakland Group, Inc.
  10.     ALL RIGHTS RESERVED.
  11.  
  12.     Revision History:
  13.     -----------------
  14.      1/10/89 ted    Removed redundant disp clip.
  15.      2/10/89 ted    Renamed from pcramcpy for sharing
  16.  
  17.      3/28/90 jmd    ansi-fied
  18. */
  19.  
  20. #include "oakhead.h"
  21. #include "disppriv.h"
  22. #include "digutil.h"
  23. /* -------------------------------------------------------------------------- */
  24.  
  25. boolean DIGPRIV copypm_clip(ptd_struct *ptd, pmap_type pixmap, opbox *pmboxp, opbox *scrboxp, opcoord *pmxp, opcoord *pmyp)
  26. /*
  27.     Do all the clipping for copying a pixmap region to or from the display.
  28.     Returns TRUE if some box is common to display and pixmap that can be copied.
  29. */
  30. {
  31.     win_type win;
  32.     opcoord pmorgx, pmorgy;
  33.  
  34.     win = ptd->win;
  35.  
  36. /* Set up box in  screen coordinates */
  37.     opbox_copy(scrboxp, ptd->relboxp);
  38.     opbox_trans(scrboxp, win_GetXmin(win), win_GetYmin(win));
  39.  
  40. /* Construct vector from vid box origin to pixmap box origin */
  41.     pmorgx = pmboxp->xmin - scrboxp->xmin;
  42.     pmorgy = pmboxp->ymin - scrboxp->ymin;
  43.  
  44. /* Put scrbox to position in pmap, now clip it to pmap and pmboxp */
  45.     opbox_trans(scrboxp, pmorgx, pmorgy);
  46.     if (!pmap_clipbox(pixmap, scrboxp)) {
  47.         return(FALSE);    /* bomb if no pmap in box */
  48.     }
  49.     if (!opbox_clipbox(pmboxp, scrboxp)) {
  50.         return(FALSE);    /* bomb if empty pmbox */
  51.     }
  52.     *pmxp = scrboxp->xmin;
  53.     *pmyp = scrboxp->ymin;
  54.  
  55. /* Now return triple clipped scrbox to its old site in display */
  56.     opbox_trans(scrboxp, -pmorgx, -pmorgy);
  57.     return(TRUE);
  58. }
  59. /* -------------------------------------------------------------------------- */
  60.  
  61.