jDSGI - Java2D DATA Step Graphics Interface
  Back - Next   [ 1 of 27 ]
image  
by Richard A. DeVenezia, Copyright 2004  HOME
/*
 * Richard A. DeVenezia
 * June 1, 2004
 *
 * jDSGI test 1
 *
 * adapted from http://today.java.net/pub/a/today/2004/04/22/images.html
 *
 */

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

  width  = 500;
  height = 500;

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

  array arcs [4] 8 _temporary_ (30,60,90,180);
  array clrs [4] 8 _temporary_ (00ff00x, 99ff99x, 0bbffbbx, 0ddffddx);

  degrees = 0;
  do i = 1 to dim(arcs);
    %setColor(clrs[i]);
    %fillArc(2,2,width-5,height-5,degrees,arcs[i]);

    degrees + arcs[i];

    %getColor(argb);
    if argb < 0 then argb = 2**32 + argb;
    a_ = brshift (band (0ff000000x, argb), 24);
    r_ = brshift (band (000ff0000x, argb), 16);
    g_ = brshift (band (00000ff00x, argb),  8);
    b_ = brshift (band (0000000ffx, argb),  0);
    put (a_ r_ g_ b_) (=hex2.) clrs[i]= hex8.;
  end;

  %setColor(clrs[1]);
  %drawOval(2,2,width-5,height-5);

put gsf=;

  %canvas_saveAs (gsf, gsftype, savedAs);

  %canvas_delete();

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