I'm converting the java code examples in Killer Game Programming in
Java by Andrew Davison to Clojure and am having great fun doing it.
But I've hit wall where I can't seem to get the code to work.

The following code moves an animated gif strip to a java array:

  public BufferedImage[] loadStripImageArray(String fnm, int number)
  {
    if (number <= 0) {
      System.out.println("number <= 0; returning null");
      return null;
    }

    BufferedImage stripIm;
    if ((stripIm = loadImage(fnm)) == null) {
      System.out.println("Returning null");
      return null;
    }

    int imWidth = (int) stripIm.getWidth() / number;
    int height = stripIm.getHeight();
    int transparency = stripIm.getColorModel().getTransparency();

    BufferedImage[] strip = new BufferedImage[number];
    Graphics2D stripGC;

    // each BufferedImage from the strip file is stored in strip[]
    for (int i=0; i < number; i++) {
      strip[i] =  gc.createCompatibleImage(imWidth, height,
transparency);   <=====

      // create a graphics context
      stripGC = strip[i].createGraphics();
<=====
      // stripGC.setComposite(AlphaComposite.Src);

      // copy image
      stripGC.drawImage(stripIm,
                  0,0, imWidth,height,
                  i*imWidth,0, (i*imWidth)+imWidth,height,
                  null);
      stripGC.dispose();
    }
    return strip;
  } // end of loadStripImageArray()

The problem I'm having is with the for loop.   If I create an abject
array of say 6 buffered images,  how do I reference the indexed image
array to match the lines pointed to?  In other words what is the
equivalent of strip[i] in Clojure?

I'm not exactly a beginner, but this has stumped me.

Bill


-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to