Class ImageSaver

All Implemented Interfaces:
AutoConfigurable, Buildable, Configurable, PropertyNameSource, ValidityChecker, Translatable, 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
      Default behavior assumes we are removing this from the module toolbar
      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
    • writeImage

      @Deprecated(since="2020-08-06", forRemoval=true) public void writeImage(OutputStream[] out) throws IOException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Write a PNG-encoded snapshot of the map to the given OutputStreams, dividing the map into vertical sections, one per stream
      Throws:
      IOException
    • 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.