Package ch.sahits.game.graphic.image

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


   */
  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])){
          System.out.println("Clicked on 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

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.