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

  1. #import "p6m.h"
  2.  
  3. @implementation p6m
  4. - resizeGenerator
  5. {
  6.   [super resizeGenerator];
  7.   // change upy to be correct
  8.   upy = 3 * bounds.size.height;
  9.   return self;
  10. }
  11. - clip: (NXCoord) x: (NXCoord) y 
  12.   PSnewpath();
  13.   PSmoveto(x,y);
  14.   PSrlineto(bounds.size.width,0);
  15.   PSrlineto(0,bounds.size.height);
  16.   PSclosepath();
  17.   PSclip();
  18.   return self;
  19. }
  20. - makeLatticeUnitAt: (NXPoint *) point fromImage: srcimg 
  21. {
  22.   id imgrep;
  23.   int i;
  24.   NXPoint pt;
  25.   
  26.   pt.x = - point->x ;
  27.   pt.y = - point->y ;
  28.   imgrep = [srcimg bestRepresentation];
  29.   for(i=0;i<6;i++){
  30.     PSgsave();
  31.     PSrotate(60*i);
  32.     PSgsave();
  33.     [self clip:0.0:0.0];
  34.     [imgrep drawAt: &pt];
  35.     PSgrestore();
  36.     reflect(30);
  37.     [self clip:0.0:0.0];
  38.     [imgrep drawAt: &pt];
  39.     PSgrestore();
  40.   }
  41.   return self;
  42. }
  43.  
  44. - sizeKludge: (float *) x : (float *) y
  45. {
  46.   float hyp;
  47.  
  48.   *x = [self equi: 2.0 * *y];
  49.   return self;
  50. }
  51. @end
  52.