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

  1. #import "aGroup-inter.h"
  2. #import "aGroup.h"
  3. #import "p4m.h"
  4.  
  5. @implementation p4m
  6. - clip: (float) x : (float) y
  7. {
  8.   PSmoveto(x,y);
  9.   PSrlineto(bounds.size.width,0);
  10.   PSrlineto(0,bounds.size.height);
  11.   PSclosepath();
  12.   PSclip();
  13.   return self;
  14. }
  15. - makeLatticeUnitAt: (NXPoint *) point fromImage: srcimg 
  16. {
  17.   id imgrep;
  18.   NXPoint pt;
  19.   int i;
  20.   
  21.   pt.x = - point->x ;
  22.   pt.y = - point->y ;
  23.  
  24.   imgrep = [srcimg bestRepresentation];
  25.   for(i=0;i<4;i++){
  26.     PSgsave(); // lower left
  27.        PSrotate(90*i);
  28.        PSgsave();
  29.          [self clip:0.0:0.0];[imgrep drawAt: &pt];
  30.        PSgrestore();
  31.        PSgsave();
  32.          reflect(45);
  33.          [self clip:0.0:0.0];[imgrep drawAt: &pt];
  34.        PSgrestore();
  35.     PSgrestore();
  36.   }
  37.   return self;
  38. }
  39. @end
  40.