import vtk.vtkImageCanvasSource2D;
import vtk.vtkNamedColors;
import vtk.vtkNativeLibrary;
import vtk.vtkAVIWriter;

public class AVI 
{
  //-----------------------------------------------------------------
  // Load VTK library and print which library was not properly loaded
  static 
  {
    if (!vtkNativeLibrary.LoadAllNativeLibraries()) 
    {
      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) 
      {
        if (!lib.IsLoaded()) 
        {
          System.out.println(lib.GetLibraryName() + " not loaded");
        }
      }
    }
    vtkNativeLibrary.DisableOutputWindow(null);
  }
  // ----------------------------------------------------------------
  
  public static void main(String args[]) 
  {
	vtkNamedColors colors = new vtkNamedColors();
	  
	double bkgColor[] = new double[] {0, 0,0,1};
	double boxColor[] = new double[] {255,0,0,1};
	  
	colors.SetColor("bkgColor", bkgColor);
	colors.SetColor("boxColor", boxColor);
	
	
	// Provide default values.
	String fileName = "Output.avi";
	for(int i = 0; i < args.length; ++i)
	{
		switch (i) 
		{
			case 0:
				fileName = args[i];
		        	break;

		}
	}
    vtkImageCanvasSource2D Source = new vtkImageCanvasSource2D();
    Source.SetScalarTypeToUnsignedChar();
    Source.SetNumberOfScalarComponents(3);
    Source.SetExtent(0, 100, 0, 100, 0, 0);

    vtkAVIWriter Writer = new vtkAVIWriter();
    Writer.SetInputConnection(Source.GetOutputPort());
    Writer.SetFileName(fileName);
    Writer.Start();

    for(int i = 0; i < 100; i++)
    {
      
      Source.SetDrawColor(bkgColor);
      Source.FillBox(0, 100, 0, 100);
      Source.SetDrawColor(boxColor);
      Source.FillBox(i, 20, 10, 20);
      Source.Update();
      Writer.Write();
      
    }
    Writer.End();
  }

}

@@ -716,17 +716,20 @@
 %5D) %0A  %7B%0A
-%09
+    
 vtkNamed
@@ -770,17 +770,20 @@
 ();%0A%09  %0A
-%09
+    
 double b
@@ -819,17 +819,20 @@
 0,0,1%7D;%0A
-%09
+    
 double b
@@ -873,13 +873,12 @@
 1%7D;%0A
-%09  %0A%09
+    
 colo
@@ -912,17 +912,20 @@
 Color);%0A
-%09
+    
 colors.S
@@ -959,13 +959,17 @@
 r);%0A
-%09%0A%09%0A%09
+    %0A    
 // P
@@ -991,17 +991,20 @@
 values.%0A
-%09
+    
 String f
@@ -1027,17 +1027,20 @@
 t.avi%22;%0A
-%09
+    
 for(int 
@@ -1068,21 +1068,28 @@
 h; ++i)%0A
-%09%7B%0A%09%09
+    %7B%0A      
 switch (
@@ -1096,15 +1096,18 @@
 i) %0A
-%09%09%7B%0A%09%09%09
+      %7B%0A%09 
 case
@@ -1111,19 +1111,17 @@
 ase 0:%0A%09
-%09%09%09
+ 
 fileName
@@ -1136,18 +1136,16 @@
 i%5D;%0A
-%09%09
         
 %09bre
@@ -1144,17 +1144,17 @@
     
-%09
+ 
 break;%0A%0A
 %09%09%7D%0A
@@ -1153,13 +1153,20 @@
 k;%0A%0A
-%09%09%7D%0A%09
+      %7D%0A    
 %7D%0A  

Update AVI.java