Class DisplacementMapRed

  • All Implemented Interfaces:
    java.awt.image.RenderedImage, CachableRed

    public class DisplacementMapRed
    extends AbstractRed
    This implementation of RenderableImage will render its input GraphicsNode on demand for tiles.
    Version:
    $Id: DisplacementMapRed.java 1733416 2016-03-03 07:07:13Z gadams $
    • Field Detail

      • scaleX

        private float scaleX
        The displacement scale factor along the x axis
      • scaleY

        private float scaleY
        The displacement scale factor along the y axis
      • xChannel

        private ARGBChannel xChannel
        The channel type of the operation on X axis
      • yChannel

        private ARGBChannel yChannel
        The channel type of the operation on Y axis
      • offsets

        CachableRed offsets
        The offset image (displacement map).
      • maxOffX

        int maxOffX
        The maximum possible offsets in x and y
      • maxOffY

        int maxOffY
        The maximum possible offsets in x and y
      • hints

        java.awt.RenderingHints hints
        The set of rendering hints
    • Constructor Detail

      • DisplacementMapRed

        public DisplacementMapRed​(CachableRed image,
                                  CachableRed offsets,
                                  ARGBChannel xChannel,
                                  ARGBChannel yChannel,
                                  float scaleX,
                                  float scaleY,
                                  java.awt.RenderingHints rh)
        Parameters:
        image - the image to distort
        offsets - the displacement map
        xChannel - defines the channel of off whose values will be on X-axis operation
        yChannel - defines the channel of off whose values will be
        scaleX - defines the scale factor of the filter operation on the X axis.
        scaleY - defines the scale factor of the filter operation on the Y axis
        rh - the rendering hints
    • Method Detail

      • copyData

        public java.awt.image.WritableRaster copyData​(java.awt.image.WritableRaster wr)
      • getTile

        public java.awt.image.Raster getTile​(int tileX,
                                             int tileY)
        Specified by:
        getTile in interface java.awt.image.RenderedImage
        Overrides:
        getTile in class AbstractRed
      • filterBL

        public void filterBL​(java.awt.image.Raster off,
                             java.awt.image.WritableRaster dst,
                             int[] xTile,
                             int[] xOff,
                             int[] yTile,
                             int[] yOff)
      • filterBLPre

        public void filterBLPre​(java.awt.image.Raster off,
                                java.awt.image.WritableRaster dst,
                                int[] xTile,
                                int[] xOff,
                                int[] yTile,
                                int[] yOff)
      • filterNN

        public void filterNN​(java.awt.image.Raster off,
                             java.awt.image.WritableRaster dst,
                             int[] xTile,
                             int[] xOff,
                             int[] yTile,
                             int[] yOff)
        Does displacement map using Nearest neighbor interpolation
        Parameters:
        off - the displacement map
        dst - stores the filtered image. If null, a destination will be created. img and dst can refer to the same Raster, in which situation the img will be modified.