Class ImageFactory

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean existImageIcon​(java.lang.String imageName)
      Checks, if icon exists
      void gameDataChanged​(GameDataEvent e)
      Called if Gamedata changes.
      boolean imageIconSizeCheck​(java.lang.String imageName, int maxHeight, int maxWidth)
      Checks, if icon exeeds given max sizes
      javax.swing.ImageIcon loadImage​(java.lang.String imageName)
      Loads the given image.
      javax.swing.ImageIcon loadImage​(java.lang.String imageName, java.lang.Boolean errorIfNotFound)
      Loads the given image.
      javax.swing.ImageIcon loadImageIcon​(java.lang.String imageName)
      DOCUMENT-ME
      java.awt.Image loadMapImage​(java.lang.String imageName)
      Load an image by file name.
      java.awt.Image loadMapImage​(java.lang.String imageName, boolean errorIfNotFound)
      Load an image by file name.
      java.awt.Image merge​(java.awt.Image rgb, java.awt.Image alpha)
      Combine two images of equal size to one, where the resulting image contains the RGB information of the first image directly and the RGB information of the second one as alpha channel information.
      void waitForImage​(java.awt.Image img)
      Wait until an image is loaded.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • Method Detail

      • loadImage

        public javax.swing.ImageIcon loadImage​(java.lang.String imageName)
        Loads the given image. First it tests to load
      • loadImage

        public javax.swing.ImageIcon loadImage​(java.lang.String imageName,
                                               java.lang.Boolean errorIfNotFound)
        Loads the given image. First it tests to load
      • merge

        public java.awt.Image merge​(java.awt.Image rgb,
                                    java.awt.Image alpha)
        Combine two images of equal size to one, where the resulting image contains the RGB information of the first image directly and the RGB information of the second one as alpha channel information.
        Parameters:
        rgb - the image to take rgb information from.
        alpha - the image to take the alpha channel information from.
        Returns:
        the composite image, or null if rgb or alpha were null or they were not of equal size.
      • waitForImage

        public void waitForImage​(java.awt.Image img)
        Wait until an image is loaded.
      • loadImageIcon

        public javax.swing.ImageIcon loadImageIcon​(java.lang.String imageName)
        DOCUMENT-ME
      • loadMapImage

        public java.awt.Image loadMapImage​(java.lang.String imageName)
        Load an image by file name. This procedure tries different file formats in the following order: .png, if not found then .gif. If a .gif file is available, an optional -alpha.gif file is used for alpha-channel information. If no such -alpha.gif file can be found, the optional alpha information in the .gif file is used. If no such file seems to exist, null is returned. All file names are prepended with the path 'images/map/'+gamename enforcing that the files are located in such a sub-directory of the resources root directory /res. If no such image is found, the fallback to 'images/map/' is used to load the file
        Parameters:
        imageName - a file name without extension.
        Returns:
        the image loaded from fileName, or null if not file could be found.
      • loadMapImage

        public java.awt.Image loadMapImage​(java.lang.String imageName,
                                           boolean errorIfNotFound)
        Load an image by file name. This procedure tries different file formats in the following order: .png, if not found then .gif. If a .gif file is available, an optional -alpha.gif file is used for alpha-channel information. If no such -alpha.gif file can be found, the optional alpha information in the .gif file is used. If no such file seems to exist, null is returned. All file names are prepended with the path 'images/map/'+gamename enforcing that the files are located in such a sub-directory of the resources root directory /res. If no such image is found, the fallback to 'images/map/' is used to load the file
        Parameters:
        imageName - a file name without extension.
        Returns:
        the image loaded from fileName, or null if not file could be found.
      • existImageIcon

        public boolean existImageIcon​(java.lang.String imageName)
        Checks, if icon exists
        Parameters:
        imageName - the name of the icon to check
        Returns:
        true, if a loadImage order would be succesfull...
      • imageIconSizeCheck

        public boolean imageIconSizeCheck​(java.lang.String imageName,
                                          int maxHeight,
                                          int maxWidth)
        Checks, if icon exeeds given max sizes
        Parameters:
        imageName - the name of the icon to check
        Returns:
        true, if a loadImage order would be succesfull...