Class ImageSaver

All Implemented Interfaces:
PropertyChangeListener, EventListener, AutoConfigurable, Buildable, Configurable, GameComponent, PropertyNameSource, ValidityChecker, Translatable, Auditable, ImageSearchTarget, SearchTarget

public class ImageSaver extends AbstractToolbarItem
This allows the user to capture a snapshot of the entire map into a PNG file.
  • Field Details

  • Constructor Details

    • ImageSaver

      public ImageSaver()
    • ImageSaver

      public ImageSaver(Map m)
  • Method Details

    • addTo

      public void addTo(Buildable b)
      Expects to be added to a Map. Adds a button to the map window toolbar that initiates the capture
      Specified by:
      addTo in interface Buildable
      Overrides:
      addTo in class AbstractToolbarItem
      Parameters:
      b - parent Buildable to add this component to as a subcomponent.
    • removeFrom

      public void removeFrom(Buildable b)
      Description copied from class: AbstractToolbarItem
      Remove from our parent
      Specified by:
      removeFrom in interface Configurable
      Overrides:
      removeFrom in class AbstractToolbarItem
      Parameters:
      b - parent
    • writeMapAsImage

      public void writeMapAsImage()
      Write a PNG-encoded snapshot of the map.
    • writeMapRectAsImage

      protected void writeMapRectAsImage(File file, int x, int y, int w, int h)
      Helper method for writing images.
      Parameters:
      file - the file to write
      x - the left edge of the map area to write
      y - the top edge of the map area to write
      w - the width of the map area to write
      h - the height of the map area to write
    • getHelpFile

      public HelpFile getHelpFile()
      Returns:
      a HelpFile describing how to use and configure * this component
    • getConfigureTypeName

      public static String getConfigureTypeName()
    • getAllowableConfigureComponents

      public Class<?>[] getAllowableConfigureComponents()
      Returns:
      a list of valid sub-component Classes. If a Class appears in this list, then instances of that class may be added to this component from the Editor's ConfigureTree window by right-clicking on the component and selecting the appropriate "Add" option.
    • isMandatory

      public boolean isMandatory()
      Description copied from interface: Buildable
      Is this component a reqired component within its parent?
      Returns:
      true if component is mandatory
    • isUnique

      public boolean isUnique()
      Description copied from interface: Buildable
      Does this component need to be unique within it's parent?
      Returns: