home *** CD-ROM | disk | FTP | other *** search
/ Education Sampler 1992 [NeXTSTEP] / Education_1992_Sampler.iso / Programming / Source / tess / tess-1.0 / pg.m < prev    next >
Encoding:
Text File  |  1992-06-30  |  907 b   |  53 lines

  1. #import "aGroup-inter.h"
  2. #import "aGroup.h"
  3. #import "pg.h"
  4.  
  5. @implementation pg
  6. - defaultConfig
  7. {
  8.   [self noAngleSetup];
  9.   return self;
  10. }
  11.  
  12. - clip: (NXCoord) x: (NXCoord) y 
  13.   PSmoveto(x,y);
  14.   PSrectclip(0,0,genw,genh);
  15.   return self;
  16. }
  17.  
  18. - resizeGenerator
  19. {
  20.   genh = latticesize.height = bounds.size.height;
  21.   genw = bounds.size.width;
  22.   latticesize.width = 2 * genw;
  23.   upx = 0;
  24.   upy = latticesize.height;
  25.   overx = latticesize.width;
  26.   gravy = upy/2;
  27.   gravx = upx/2;
  28.   return self;
  29. }
  30.  
  31. - makeLatticeUnitAt: (NXPoint *) point fromImage: srcimg 
  32. {
  33.   id imgrep;
  34.   NXPoint pt;
  35.   
  36.   pt.x = - point->x ;
  37.   pt.y = - point->y ;
  38.   imgrep = [srcimg bestRepresentation];
  39.   PSgsave();
  40.   [self clip:0.0:0.0];
  41.   [imgrep drawAt: &pt];
  42.   PSgrestore();
  43.   PSgsave();
  44.   reflect(0.0);
  45.   PStranslate(bounds.size.width,-bounds.size.height);
  46.   [self clip:0.0:0.0];
  47.   [imgrep drawAt: &pt];
  48.   PSgrestore();
  49.   return self;
  50. }
  51. @end
  52.