ftp.nice.ch/pub/next/developer/objc/threads/TWindow.N.bs.tar.gz#/TWindow/DesquamateViewPart.m

This is DesquamateViewPart.m in view mode; [Download] [Up]

#import "DesquamateViewPart.h"
#import <appkit/NXImage.h>
#import <appkit/Window.h>
#import <appkit/Panel.h>                // for NXRunAlertPanel()
#import <dpsclient/wraps.h>
#import <libc.h>
#import <math.h>

@implementation DesquamateView                
- commandKey
{
  bigMode = (bigMode ? NO : YES);
  return self;
}

- initFrame:(NXRect *)frameRect
{
  register int jkl;
  
  // about the 3 -- don''t ask, it looks good.
  x1=(float *)malloc(sizeof(float) * (NUMLINES +3));
  yc1=(float *)malloc(sizeof(float) * (NUMLINES +3));
  t1=(float *)malloc(sizeof(float) * (NUMLINES +3));
  t2=(float *)malloc(sizeof(float) * (NUMLINES +3));
  t3=(float *)malloc(sizeof(float) * (NUMLINES +3));

  [super initFrame:frameRect];

  for(jkl=0;jkl<NUMLINES;jkl++){
    x1[jkl]=midx;
    yc1[jkl]=midy;
  }
  // line per is the percentage back that erase steps
  lper=NUMLINES-5;
  scale_delta=0.001;
  return self;
}  

- oneStep
{
  float mx, my;
  
  pp=p; p=n;
  n=(n+1)%(NUMLINES-1);

  scale+=scale_delta;
  if((scale>=1) || (scale<=0)) scale_delta*=-1;

  PScurrentmouse(winNum, &mx, &my);
  if (bigMode){
    xi=((mx-midx)/urx)*150;
    yi=((my-midy)/ury)*150;
  } else {
    xis=((mx-midx)/urx)*3;
    yis=((my-midy)/ury)*3;
  }

  if((count++>500) && (((mx != oldx) && (my != oldy)) || (count>30000))){
    count=0;
    PSsetgray(0.0);
    NXRectFill(&bounds);
  }
  oldx=mx; oldy=my;


  t1[n]=t1[p]+0.2*(xi+xis); if(t1[n]>(2*M_PI)) t1[n]-=(2*M_PI);
  t2[n]=t2[p]+0.2*(yi+yis); if(t2[n]>(2*M_PI)) t2[n]-=(2*M_PI);
  t3[n]=t3[p]+0.01;   if(t3[n]>(2*M_PI)) t3[n]-=(2*M_PI);

  x1[n]=(cos(t1[n])*s1*scale) + (cos(t2[n])*s3) + midx;
  yc1[n]=(sin(t1[n])*s2) + (sin(t2[n])*s4*scale) + midy;

  PSsetrgbcolor((cos(t1[n])+1.0)/2.0,
                (cos(t2[n])+1.0)/2.0,
                (cos(t3[n])+1.0)/2.0);

  PSnewpath();
  PSmoveto(x1[pp], yc1[pp]);
  PSlineto(x1[p], yc1[p]);
  PSlineto(x1[n], yc1[n]);
  PSclosepath();
  PSfill();

  return self;
}

@end

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.