import source from 1.3.40
[external/swig.git] / Examples / GIFPlot / Java / simple / runme.java
1
2 public class runme {
3
4   static {
5     try {
6         System.loadLibrary("simple");
7     } catch (UnsatisfiedLinkError e) {
8       System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
9       System.exit(1);
10     }
11   }
12
13   public static void main(String argv[]) {
14
15     // Draw some simple shapes
16     System.out.println( "Drawing some basic shapes" );
17     
18     SWIGTYPE_p_ColorMap cmap = simple.new_ColorMap(null);
19     SWIGTYPE_p_FrameBuffer f    = simple.new_FrameBuffer(400,400);
20     
21     // Clear the picture
22     simple.FrameBuffer_clear(f,(short)simple.BLACK);
23     
24     // Make a red box
25     simple.FrameBuffer_box(f,40,40,200,200,(short)simple.RED);
26     
27     // Make a blue circle
28     simple.FrameBuffer_circle(f,200,200,40,(short)simple.BLUE);
29     
30     // Make green line
31     simple.FrameBuffer_line(f,10,390,390,200, (short)simple.GREEN);
32     
33     // Write an image out to disk
34     
35     simple.FrameBuffer_writeGIF(f,cmap,"image.gif");
36     System.out.println( "Wrote image.gif" );
37     
38     simple.delete_FrameBuffer(f);
39     simple.delete_ColorMap(cmap);
40     }
41 }