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

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