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

  1. #import "aGroup-inter.h"
  2. #import "aGroup.h"
  3. #import "pmm.h"
  4.  
  5. @implementation pmm
  6.  
  7. - defaultConfig
  8. {
  9.   [self noAngleSetup];
  10.   return self;
  11. }
  12.  
  13. - clip: (float) x : (float) y
  14. {
  15.   PSmoveto(x,y);
  16.   PSrectclip(0,0,frame.size.width,frame.size.height);
  17. }
  18.  
  19. - resizeGenerator
  20. {
  21.   latticesize.height = 2.0* bounds.size.height;
  22.   latticesize.width = 2.0 * bounds.size.width;
  23.   upx = 0;
  24.   upy = latticesize.height;
  25.   overx = latticesize.width;
  26.   gravy = upy/2;
  27.   gravx = (upx+overx)/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(); // lower left
  40.   [self clip:0.0:0.0];[imgrep drawAt: &pt];
  41.   PSgrestore();
  42.   PSgsave(); // upper left
  43.   reflect(0.0);
  44.   PStranslate(0,-2*bounds.size.height);
  45.   [self clip:0.0:0.0]; [imgrep drawAt: &pt];
  46.   PSgrestore();
  47.   PSgsave(); // lower right
  48.   reflect(90);
  49.   PStranslate(2*bounds.size.width,0);
  50.   [self clip:0.0:0.0]; [imgrep drawAt: &pt];
  51.   PSgrestore();
  52.   PSgsave();// upper right
  53.   PSrotate(180);
  54.   PStranslate(2*bounds.size.width,-2*bounds.size.height);
  55.   [self clip:0.0:0.0]; [imgrep drawAt: &pt];
  56.   PSgrestore();
  57.   return self;
  58. }
  59.  
  60. - (BOOL) isRigidLattice { return YES; };
  61. @end
  62.