Package ch.sahits.game.graphic.image

Examples of ch.sahits.game.graphic.image.NamedBufferedImage


   * @param name
   */
  protected void removeImage(String name) {
    for (Iterator<NamedBufferedImage> iterator = images.iterator(); iterator
        .hasNext();) {
      NamedBufferedImage img = iterator.next();
      if (img.getName().equals(name)) {
        iterator.remove();
        viewChanged=true;
        break;
      }
    }
View Full Code Here


      String imageName) {
    if (contains(insertImageName)){
      throw new IllegalStateException("The image "+insertImageName+" cannot be added twice");
    }
    for (int i = 0; i < images.size(); i++) {
      NamedBufferedImage img = images.get(i);
      logger.debug("check image "+img.getName());
      if (img.getName().equals(imageName)) {
        NamedBufferedImage insertImage = new NamedBufferedImage(
            imsLoader.getImage(insertImageName),
            insertImageName);
        images.add(i, insertImage);
        viewChanged=true;
        break;
View Full Code Here

  }
  protected final void insertFirst(String insertImageName){
    if (contains(insertImageName)){
      throw new IllegalStateException("The image "+insertImageName+" cannot be added twice");
    }
    NamedBufferedImage insertImage = new NamedBufferedImage(
        imsLoader.getImage(insertImageName),
        insertImageName);
    images.add(0, insertImage);
    viewChanged=true;
  }
View Full Code Here

   */
  protected void insertImageLast(String insertImageName) {
    if (contains(insertImageName)){
      throw new IllegalStateException("The image "+insertImageName+" cannot be added twice");
    }
    NamedBufferedImage insertImage = new NamedBufferedImage(
        imsLoader.getImage(insertImageName), insertImageName);
    images.add(insertImage);
    viewChanged=true;
  }
View Full Code Here

      Color oldColor = gScr.getColor();
      gScr.setColor(Color.black);
      gScr.fillRect(rect.x, rect.y, rect.width, rect.height); // black background
      // display the images
      for (int i = 0; i < images.size(); i++) {
        NamedBufferedImage img = images.get(i);
        Point offset = offsets.get(img.getName());
        if (offset == null) {
          throw new NullPointerException(
              "The offset must be stored for " + img.getName());
        }
        //System.out.println("Draw image: "+img.getName());
        gScr.drawImage(img.getImage(), offset.x, offset.y, null);
//        try {
//          ImageIO.write(img.getImage(), "png", new File("ImagePart"
//              + i + ".png"));
//        } catch (IOException e) {
//          e.printStackTrace();
View Full Code Here

            } else {
              // remove the old page
              removeImage(getImageName(MouseState.HISTORY_PAGE));
              // add next image
              BufferedImage img = imsLoader.getLocalImageGroup(names[TEXT_HISTORY], --historyIndex);
              insertImageLast(new NamedBufferedImage(img, names[TEXT_HISTORY]));
            }
          }
        }
        if (polyName.equals(names[TEXT_FOCUS_NEXT])){
          if (pageState==PageState.HISTORY){
            if (historyIndex==historySize-1){
              // back to start page
              returnBackToStartFromHistory();
            } else {
              // remove the old page
              removeImage(getImageName(MouseState.HISTORY_PAGE));
              // add next image
              BufferedImage img = imsLoader.getLocalImageGroup(names[TEXT_HISTORY], ++historyIndex);
              insertImageLast(new NamedBufferedImage(img, names[TEXT_HISTORY]));
            }
          }
        }
        if (polyName.equals(names[TEXT_FOCUS_HISTORY])){
          // remove highlight image
          removeImage(getImageName(state));
          // remove the text
          removeImage(getImageName(MouseState.UNFOCUSED));
          // add back and next
          insertImageLast(names[TEXT_BACK_NEXT]);
          // add history
          historyIndex=0;
          historySize=imsLoader.getLocalImageGroupeSize(names[TEXT_HISTORY]);
          BufferedImage img = imsLoader.getLocalImageGroup(names[TEXT_HISTORY], historyIndex);
          insertImageLast(new NamedBufferedImage(img, names[TEXT_HISTORY]));
          // change page state
          pageState = PageState.HISTORY;
          state = MouseState.HISTORY_PAGE;
        } // end history
        if (polyName.equals(names[TEXT_FOCUS_NEW])){
View Full Code Here

          for (int j = 0; j < fnames.length; j++) {
            String name = head+j;
            BufferedImage img = loadImage(fnames[j]);
            logger.debug("  Stored " + name + "/" + fnames[j]);

            images.add(new NamedBufferedImage(img, name));
          }
          localImageMap.put(head, images);
          break;
        }
      }
View Full Code Here

   * @param name
   */
  protected void removeImage(String name) {
    for (Iterator<NamedBufferedImage> iterator = images.iterator(); iterator
        .hasNext();) {
      NamedBufferedImage img = iterator.next();
      if (img.getName().equals(name)) {
        iterator.remove();
        viewChanged=true;
        break;
      }
    }
View Full Code Here

      String imageName) {
    if (contains(insertImageName)){
      throw new IllegalStateException("The image "+insertImageName+" cannot be added twice");
    }
    for (int i = 0; i < images.size(); i++) {
      NamedBufferedImage img = images.get(i);
System.out.println("check image "+img.getName());       
      if (img.getName().equals(imageName)) {
        NamedBufferedImage insertImage = new NamedBufferedImage(
            imsLoader.getImage(insertImageName),
            insertImageName);
        images.add(i, insertImage);
        viewChanged=true;
        break;
View Full Code Here

  }
  protected final void insertFirst(String insertImageName){
    if (contains(insertImageName)){
      throw new IllegalStateException("The image "+insertImageName+" cannot be added twice");
    }
    NamedBufferedImage insertImage = new NamedBufferedImage(
        imsLoader.getImage(insertImageName),
        insertImageName);
    images.add(0, insertImage);
    viewChanged=true;
  }
View Full Code Here

TOP

Related Classes of ch.sahits.game.graphic.image.NamedBufferedImage

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.