#import "p2.h"

@implementation p2
- clip: (NXCoord) x: (NXCoord) y 
{ 
  if(upx < 0.0)
    PSmoveto(x-upx,y);
  else
    PSmoveto(x,y);
  PSrlineto(overx,0);
  PSrlineto(upx-overx,upy);
  PSclosepath();
  PSclip();
  return self;
}

- makeLatticeUnitAt: (NXPoint *) point fromImage: srcimg 
{
  id imgrep;
  NXPoint pt;
  
  pt.x = - point->x ;
  pt.y = - point->y ;
  imgrep = [srcimg bestRepresentation];
  PSgsave();
  [self clip:0.0:0.0];
  [imgrep drawAt: &pt];
  PSgrestore();
  PSgsave();
  PSrotate(180);
  // ??????!!!!!
  if(upx < 0)
    PStranslate(upx,-upy);
  else
    PStranslate(-upx,-upy);
  [self clip:0.0:0.0];
  [imgrep drawAt: &pt];
  PSgrestore();
  return self;
}
@end
