#import "aGroup-inter.h"
#import "aGroup.h"
#import "p4g.h"

@implementation p4g
- clip: (float) x : (float) y
{
  PSmoveto(x,y);
  PSrlineto(bounds.size.width,0);
  PSrlineto(-bounds.size.width,bounds.size.height);
  PSclosepath();
  PSclip();
  return self;
}
- makeLatticeUnitAt: (NXPoint *) point fromImage: srcimg 
{
  id imgrep;
  NXPoint pt;
  int i;
  
  pt.x = - point->x ;
  pt.y = - point->y ;

  imgrep = [srcimg bestRepresentation];
  for(i=0;i<4;i++){
    PSgsave(); // lower left
       PSrotate(90*i);
       PSgsave();
         [self clip:0.0:0.0];[imgrep drawAt: &pt];
       PSgrestore();
       PSgsave();
         reflect(135);
         PStranslate(bounds.size.width,bounds.size.height);
         [self clip:0.0:0.0];[imgrep drawAt: &pt];
       PSgrestore();
    PSgrestore();
  }
  return self;
}
@end
