jDSGI - Java2D DATA Step Graphics Interface
  Back - Next   [ 3 of 27 ]
image  
by Richard A. DeVenezia, Copyright 2004  HOME
/*
 * Richard A. DeVenezia
 * June 1, 2004
 *
 * jDSGI test 3
 */

data _null_;

  if symexist('goutpath') then goutpath=symget('goutpath'); else goutpath=pathname('WORK');
  if symexist ('gsftype') then gsftype=symget('gsftype'); else gsftype='png';

  gsf = cats(goutPath,"\","test3");

  width  = 500;
  height = 500;

  %canvas (_g, width, height, 0ffffffx)

  * 0,0 -> ul  :  1,1 -> lr;
  cx = 0.75;
  cy = 0.25;

  r = max (cx, cy, 1-cx, 1-cy);

  n = 500;

  do i = 0 to n;
    f = i / n ;

    w = 1 + 2 * r * (1-f) * width  ;
    h = 1 + 2 * r * (1-f) * height ;

    ulx = cx * width  - w/2 ;
    uly = cy * height - h/2 ;

    %setColorRGB ( 255 * (1-f) / 6
                 , 255 * f / 2.5
                 , 255 * f
                 );
    %fillRect (ulx,uly,w,h);
  end;

  %canvas_saveAs (gsf, gsftype, savedAs);

  %canvas_delete();

  if savedAs ne '' then call system ("start " || savedAs);
run ;