Class Caption

  • All Implemented Interfaces:
    ImageFilter

    public class Caption
    extends java.lang.Object
    implements ImageFilter
    An ImageFilter which will overlay a text caption to an image.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private float alpha
      The opacity level of the text to add.
      private java.awt.Color c
      The color of the text to add.
      private java.lang.String caption
      The text of the caption.
      private java.awt.Font font
      The font of text to add.
      private int insets
      The insets for the text to draw.
      private Position position
      The position at which the text should be drawn.
    • Constructor Summary

      Constructors 
      Constructor Description
      Caption​(java.lang.String caption, java.awt.Font font, java.awt.Color c, float alpha, Position position, int insets)
      Instantiates a filter which adds a text caption to an image.
      Caption​(java.lang.String caption, java.awt.Font font, java.awt.Color c, Position position, int insets)
      Instantiates a filter which adds a text caption 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

      • caption

        private final java.lang.String caption
        The text of the caption.
      • font

        private final java.awt.Font font
        The font of text to add.
      • c

        private final java.awt.Color c
        The color of the text to add.
      • alpha

        private final float alpha
        The opacity level of the text to add.

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

      • position

        private final Position position
        The position at which the text should be drawn.
      • insets

        private final int insets
        The insets for the text to draw.
    • Constructor Detail

      • Caption

        public Caption​(java.lang.String caption,
                       java.awt.Font font,
                       java.awt.Color c,
                       float alpha,
                       Position position,
                       int insets)
        Instantiates a filter which adds a text caption to an image.
        Parameters:
        caption - The text of the caption.
        font - The font of the caption.
        c - The color of the caption.
        alpha - The opacity level of caption.

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

        position - The position of the caption.
        insets - The inset size around the caption. Cannot be negative.
      • Caption

        public Caption​(java.lang.String caption,
                       java.awt.Font font,
                       java.awt.Color c,
                       Position position,
                       int insets)
        Instantiates a filter which adds a text caption to an image.

        The opacity of the caption will be 100% opaque.

        Parameters:
        caption - The text of the caption.
        font - The font of the caption.
        c - The color of the caption.
        position - The position of the caption.
        insets - The inset size around the caption. Cannot be negative.
    • 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.