Package vash

Examples of vash.Tree


      //  Everything we need should be present on any modern machine, so this should
      //  never get thrown in practice.
      System.err.println("Missing cryptographic primitives: " + e.toString());
      System.exit(1);
    }
    Tree tree = new Tree(tp);

    for(int size = 16; size <= 2048; size *= 2) {
      // The image parameters encapsulate the data we need map the tree
      //  into a physical image and provides several size-dependent
      //  services the tree uses when generating images.
      ImageParameters ip = new ImageParameters(size, size);
      tree.setGenerationParameters(ip);

      // The tree provides images as a packed, unstrided array of 24-bit
      //  BGR pixels.
      byte[] pix = tree.generateCurrentFrame();
     
      // The static dataToImage method of Output builds a BufferedImage
      //  stack to interpret our raw pixels.  The BufferedImage does not
      //  rewrite the pixels, it just gives us an easy-to-use API on
      //  top of our existing data.
View Full Code Here


  private final int WIDTH = 128;
  private final int HEIGHT = 128;

  public void runStaticTest(String algo, String name, int width, int height) {
    TreeParameters tp;
    Tree tree;

    // ensure we have an output directory
    File treeTgt = new File(String.format("./gallery-%s/trees/", name));
    if(!treeTgt.exists()) {
      Assert.assertTrue(treeTgt.mkdirs());
    }
   
    for(int i = 0; i < GALLERY_SIZE; i++) {
      System.out.format("At image: %03d\n", i);
      InputStream data = new ByteArrayInputStream(String.format("%03d", i).getBytes());
      tp = TreeParameters.createInstanceOrDie(algo, null, data);
      tree = new Tree(tp);

      // write out the tree we built
      try {
        tree.show(String.format("./gallery-%s/trees/%03d.txt", name, i));
      } catch(IOException e) {
        fail(e.toString());
      }

      ImageParameters ip = new ImageParameters(width, height);
      tree.setGenerationParameters(ip);
      byte[] actual = tree.generateCurrentFrame();
      TestOperationIntegration.compare(actual, width, height, String.format("./test/reference-%s/%03d.png", name, i), null);
     
      OutputParameters op = new OutputParameters(String.format("./gallery-%s/%03d.png", name, i), width, height);
      Output out = new Output(op, tree);
      try {
View Full Code Here

TOP

Related Classes of vash.Tree

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.