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

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,"\","test14");

  width  = 500;
  height = 500;

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

  %let n = 20;

  array px[&n];
  array py[&n];

  n = &n;

  r1 = width/2 * .95;
  r2 = width/2 * .35;

  do i = 1 to n;
    f = (i-1) / n;
    theta = 2 * constant('PI') * f;

    if mod (i,2) = 1
      then r = r1;
      else r = r2;

    px[i] = r * cos (theta) + width/2;
    py[i] = r * sin (theta) + height/2;
  end;

  %setClipPolygon (px, py);

  %setColor (3333aax);
  %fillRect (100,100,width-200,height-200);

  %setColorHSB (.5,.8,.8);
  %setFontSize(28);
  %setFontStyle(1);
  %drawString ('Polygonal clip is in effect - Pretty Cool', 40,260);

  %clearRect (0,0,width,100);

  %canvas_saveAs (gsf, gsftype, savedAs);

  %canvas_delete();

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