/// Evolver Copyright 2000, Morgan McGuire
/// matrix@alum.mit.edu   http://graphics3d.com/matrix
import java.awt.*;

public class VSplit extends TwoArgumentOperator implements ELOperator
{
  public void apply(ELMatrix argument[], ELMatrix out, ELEnvironment environment)
  {
    checkArguments(argument);

    int width = out.getWidth();
    int height = out.getHeight();

  }

  public void fastApply(ELMatrix argument[], ELMatrix out, ELEnvironment environment) {
    checkArguments(argument);

    int width = out.getWidth();
    int height = out.getHeight();

    int y1 = height / 2;
    // Be lousy; just subsample
    for (int c = 0; c < 3; c++) {
        // Top half
        for (int y = 0; y < y1; y++) {
            System.arraycopy(argument[0].channel[c], (y * 2) * width, out.channel[c], y * width, width);
        }

        // Bottom half
        for (int y = y1; y < height; y++) {
            System.arraycopy(argument[1].channel[c], (y * 2 + y1) * width, out.channel[c], y * width, width);
        }
    }
  }

  public String name() {
    return "VSplit";
  }

  public String description() {
      return "Uses one image to color the top half of the image and to color the bottom";
  }

  protected String iconString() {
      return "VS";
  }
}
