Class AbstractMultiLevelSource

    • Constructor Detail

      • AbstractMultiLevelSource

        protected AbstractMultiLevelSource​(MultiLevelModel multiLevelModel)
    • Method Detail

      • getModel

        public MultiLevelModel getModel()
        Description copied from interface: MultiLevelSource
        Gets the layout model for the multi-resolution image supported by this LevelImageSource.
        Specified by:
        getModel in interface MultiLevelSource
        Returns:
        the multi-resolution image model.
      • getImage

        public RenderedImage getImage​(int level)
        Gets the RenderedImage at the given resolution level. Unless reset() is called, the method will always return the same image instance at the same resolution level. If a level image is requested for the first time, the method calls createImage(int) in order to retrieve the actual image instance.
        Specified by:
        getImage in interface MultiLevelSource
        Parameters:
        level - The resolution level.
        Returns:
        The RenderedImage at the given resolution level.
      • getImageShape

        public Shape getImageShape​(int level)
        Description copied from interface: MultiLevelSource
        Gets the shape of the area where this image's raster data contains valid pixels at the given resolution level. The method returns null, if the entire image raster contains valid pixels.
        Specified by:
        getImageShape in interface MultiLevelSource
        Parameters:
        level - The resolution level.
        Returns:
        The shape of the area where the image has data, can be null.
      • createImage

        protected abstract RenderedImage createImage​(int level)
        Called by getImage(int) if a level image is requested for the first time. Note that images created via this method will be disposed when reset() is called on this multi-level image source. See getImage(int).

        The dimension of the level image created must be the same as that obtained from {DefaultMultiLevelSource.getLevelImageBounds(Rectangle sourceBounds, double scale)} for the scale associated with the given resolution level.

        Parameters:
        level - The resolution level.
        Returns:
        An instance of a RenderedImage for the given resolution level.
      • reset

        public void reset()
        Removes all cached level images and also disposes any PlanarImages among them.

        Overrides should always call super.reset().

        Specified by:
        reset in interface MultiLevelSource
      • checkLevel

        protected void checkLevel​(int level)
        Utility method which checks if a given level is valid.
        Parameters:
        level - The resolution level.
        Throws:
        IllegalArgumentException - if level < 0 || level >= getModel().getLevelCount()