home *** CD-ROM | disk | FTP | other *** search
/ The Fatted Calf / The Fatted Calf.iso / Applications / Audio-DSP / NU / Source / BGWindow.m < prev    next >
Encoding:
Text File  |  1992-12-19  |  1.9 KB  |  78 lines

  1. #import "BGWindow.h"
  2. #import <dpsclient/wraps.h>
  3. #import <math.h>
  4.  
  5. /**
  6.  ** a BGwindow understands the composite operators, lockFocus,
  7.  ** and it knows how to erase itself.  Its designated
  8.  ** initializer is frame: aRect...it will make a
  9.  ** retained window.  
  10.  **/
  11.  
  12. @implementation BGWindow: Window
  13.  
  14. - erase ;
  15. { [contentView lockFocus] ;
  16.   PSsetgray(1.0) ;
  17.   PSsetalpha(1.0) ; // just in case...
  18.   PSrectfill(0.0,0.0,frame.size.width,frame.size.height) ;
  19.   PSsetgray(0.0) ;
  20.   [contentView unlockFocus] ;
  21.   return self ;
  22. }
  23.  
  24.  
  25. - erase: (NXRect *) aRect ;
  26. { [contentView lockFocus] ;
  27.   PSsetgray(1.0) ;
  28.   PSsetalpha(1.0) ; // just in case...
  29.   PSrectfill(aRect->origin.x,aRect->origin.y,
  30.       aRect->size.width,aRect->size.height) ;
  31.   PSsetgray(0.0) ;
  32.   [contentView unlockFocus] ;
  33.   return self ;
  34. }
  35.  
  36. - composite: (int) op fromRect: (const NXRect *) aRect toPoint: (const NXPoint *) aPnt ;
  37. { // composite aRect in my coords to currently focused view
  38.   PScomposite(rint(aRect->origin.x),rint(aRect->origin.y),
  39.    aRect->size.width,aRect->size.height,
  40.    [self gState], rint(aPnt->x), rint(aPnt->y), op) ;
  41.   return self ;
  42. }
  43.  
  44. - composite: (int) op toPoint: (const NXPoint *) aPnt ;
  45. { // composite my entire frame to aPnt of currently focused view
  46.   PScomposite(0.0,0.0,frame.size.width,frame.size.height,
  47.    [self gState], rint(aPnt->x), rint(aPnt->y), op) ;
  48.   return self ;
  49. }
  50.  
  51. - composite: (int) op ;
  52. { // composite to 0,0
  53.   PScomposite(0.0,0.0,frame.size.width,frame.size.height,
  54.    [self gState], 0.0, 0.0, op) ;
  55.   return self ;
  56. }
  57.  
  58. - frame: (NXRect *) aFrame ;
  59. { [self 
  60.      initContent: aFrame
  61.      style: NX_PLAINSTYLE
  62.      backing: NX_RETAINED
  63.      buttonMask: 0
  64.      defer: NO] ;
  65.   [self setDynamicDepthLimit: NO] ;
  66.   [self setDepthLimit: NX_TwelveBitRGBDepth] ;
  67.   return self ;
  68. }
  69.  
  70. - (BOOL) lockFocus ;
  71. { return [contentView lockFocus] ;
  72. }
  73.  
  74. - unlockFocus ;
  75. { return [contentView unlockFocus] ;
  76. }
  77.  
  78. @end