macro 'Change Sampling Pitch...'; {Generates a grayscale step function within the current selection.} var width,height,nSteps,StepSize,i,j,k,l,x,y:integer; value:real; begin SaveState; GetPicSize(width, height); StepSize:=GetNumber('Cell Size [pixels square]',16); Duplicate('Sampling'); nSteps:=width div StepSize; x:=0; y:=0; for i:=0 to nSteps-1 do begin y:=i*StepSize; for j:=0 to nSteps-1 do begin x:=j*StepSize; value:=0; for k:=y to y+StepSize-1 do begin for l:=x to x+StepSize-1 do begin value:=value+GetPixel(l,k); end; end; value:=value/(StepSize*StepSize); MakeRoi(x,y,StepSize,StepSize); SetForeground(round(value)); fill; end; end; KillRoi; RestoreState; end;