import vtk.vtkNativeLibrary;
import vtk.vtkImageCanvasSource2D;
import vtk.vtkOggTheoraWriter;

    
public class OggTheora 
{
  // -----------------------------------------------------------------
  // 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[]) 
  {

    String fileName = "test.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);

    vtkOggTheoraWriter writer = new vtkOggTheoraWriter();

    writer.SetInputConnection(source.GetOutputPort());
    writer.SetFileName(fileName);
    writer.Start();

    for(int i = 0; i < 100; i++)
    {
      source.SetDrawColor(0,0,0,1); //black
      source.FillBox(0, 100, 0, 100); //clear image
      source.SetDrawColor(255,0,0,1); //red
      source.FillBox(i, 20, 10, 20);
      source.Update();
      writer.Write();
    }
    writer.End();
  }
}

@@ -87,16 +87,43 @@
 aWriter;
+%0Aimport vtk.vtkNamedColors;
 %0A%0A    %0Ap
@@ -742,61 +742,48 @@
     
-String fileName = %22test.avi%22;%0A    for(int i = 0; i %3C 
+ //parse command line arguments%0A    if (
 args
@@ -793,14 +793,15 @@
 ngth
-; ++i)
+ != 1) 
 %0A   
@@ -813,52 +813,141 @@
     
-switch (i) %0A   
+  System.err.println(%22Usage: java -classpath ... OggTheora Filename(.avi) e.g OggTheora.avi%22);%0A
    
-%7B%0A
      
-   case 0:
+return;%0A    %7D
 %0A    
+%0A
     
+String 
 file
@@ -962,40 +962,253 @@
 rgs%5B
-i
+0
 %5D;%0A    
+%0A
     
-break;%0A      %7D%0A    %7D
+vtkNamedColors colors = new vtkNamedColors();%0A%0A    double bkgcolor%5B%5D = new double%5B%5D %7B0, 0,0,1%7D;%0A    double boxcolor%5B%5D = new double%5B%5D %7B255,0,0,1%7D;%0A%0A    colors.SetColor(%22bkgColor%22, bkgcolor);%0A    colors.SetColor(%22boxColor%22, boxcolor);
 %0A%0A  
@@ -1639,15 +1639,16 @@
 lor(
-0,0,0,1
+bkgcolor
 ); /
@@ -1706,16 +1706,25 @@
 r image%0A
+        %0A
       so
@@ -1741,25 +1741,24 @@
 awColor(
-255,0,0,1
+boxcolor
 ); //red
@@ -1795,16 +1795,25 @@
 0, 20);%0A
+        %0A
       so

Update OggTheora.java