Class Watermark

  • All Implemented Interfaces:
    ImageFilter

    public class Watermark
    extends java.lang.Object
    implements ImageFilter
    This class applies a watermark to an image.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private int insets
      The insets for the watermark.
      private float opacity
      The opacity of the watermark.
      private Position position
      The position of the watermark.
      private java.awt.image.BufferedImage watermarkImg
      The watermark image.
    • Constructor Summary

      Constructors 
      Constructor Description
      Watermark​(Position position, java.awt.image.BufferedImage watermarkImg, float opacity)
      Instantiates a filter which applies a watermark to an image.
      Watermark​(Position position, java.awt.image.BufferedImage watermarkImg, float opacity, int insets)
      Instantiates a filter which applies a watermark to an image.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.awt.image.BufferedImage apply​(java.awt.image.BufferedImage img)
      Applies a image filtering operation on an image.
      • Methods inherited from class java.lang.Object

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

      • position

        private final Position position
        The position of the watermark.
      • watermarkImg

        private final java.awt.image.BufferedImage watermarkImg
        The watermark image.
      • opacity

        private final float opacity
        The opacity of the watermark.
      • insets

        private final int insets
        The insets for the watermark.
    • Constructor Detail

      • Watermark

        public Watermark​(Position position,
                         java.awt.image.BufferedImage watermarkImg,
                         float opacity,
                         int insets)
        Instantiates a filter which applies a watermark to an image.
        Parameters:
        position - The position of the watermark.
        watermarkImg - The watermark image.
        opacity - The opacity of the watermark.

        The value should be between 0.0f and 1.0f, where 0.0f is completely transparent, and 1.0f is completely opaque.

        insets - Inset size around the watermark. Cannot be negative.
      • Watermark

        public Watermark​(Position position,
                         java.awt.image.BufferedImage watermarkImg,
                         float opacity)
        Instantiates a filter which applies a watermark to an image.
        Parameters:
        position - The position of the watermark.
        watermarkImg - The watermark image.
        opacity - The opacity of the watermark.

        The value should be between 0.0f and 1.0f, where 0.0f is completely transparent, and 1.0f is completely opaque.

    • Method Detail

      • apply

        public java.awt.image.BufferedImage apply​(java.awt.image.BufferedImage img)
        Description copied from interface: ImageFilter
        Applies a image filtering operation on an image.
        Specified by:
        apply in interface ImageFilter
        Parameters:
        img - The image to apply the filtering on.
        Returns:
        The resulting image after applying this filter.