Class FilterConf

java.lang.Object
swingtree.style.FilterConf

@Immutable public final class FilterConf extends Object
The filter configuration object defines if and how a filter should be applied on the rendering of the parent of a particular component. This may include a blur, a convolution kernel, a scale and translation applied to the parent layer.
Note that this configuration may only have an effect if the component it is applied to is non-opaque, which is to say that it does not have another other styles which would obstruct the rendering of the parent layer.

This class exposes the following properties with their respective purpose and default values:
  • Kernel

    The convolution kernel to apply to the parent layer using the ConvolveOp class. Default value is KernelConf.none()

  • Area

    The area of the current component to which the filter should be applied to. Default value is UI.ComponentArea.BODY, which includes the interior and border area of the component.

  • Offset

    The translation to apply to the filtered parent layer. Default value is (0.0, 0.0), which means no translation.

  • Scale

    The scale to apply to the filtered parent layer. Default value is (1.0, 1.0), which means no scaling is applied to the parent layer.

  • Blur

    The blur radius, which is used to apply a gaussian blur to the parent layer using the ConvolveOp class. Default value is 0.0, which means no blur is applied.

  • Method Summary

    Modifier and Type
    Method
    Description
    Define the component area which should display the filtered parent.
    blur(double radius)
    Supply values greater than 0 to this to apply a gaussian blur to the parent layer.
    boolean
     
    int
     
    kernel(Size size, double... matrix)
    Use this to configure a custom convolution kernel based on a row major matrix represented by a width, height and an array of values whose length is the product of the supplied width and height.
    Note that this operation will be applied after the parent layer was translated and scaled and blurred.
    offset(double x, double y)
    Uses the given x and y offset values to translate the parent layer before applying other filtering operations.
    scale(double x, double y)
    Scales the parent layer by the given x and y factors before applying other filtering operations.
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Method Details

    • kernel

      public FilterConf kernel(Size size, double... matrix)
      Use this to configure a custom convolution kernel based on a row major matrix represented by a width, height and an array of values whose length is the product of the supplied width and height.
      Note that this operation will be applied after the parent layer was translated and scaled and blurred.
      Parameters:
      size - The Size object representing the width and height of the matrix to be used as the convolution kernel.
      matrix - A var args array of double values used to form a row major matrix.
      Returns:
      An updated filter configuration containing the desired convolution kernel.
    • area

      public FilterConf area(UI.ComponentArea area)
      Define the component area which should display the filtered parent. Everything outside that area will not be affected by the filter. Take a look at the UI.ComponentArea enum documentation for more information on the available areas.
      Parameters:
      area - A constant representing the area of the component to which the filter should be clipped to.
      Returns:
      An updated filter configuration with the desired clipping area.
    • offset

      public FilterConf offset(double x, double y)
      Uses the given x and y offset values to translate the parent layer before applying other filtering operations.
      Parameters:
      x - The amount to translate the parent layer along the x-axis before filtering.
      y - The amount to translate the parent layer along the y-axis before filtering.
      Returns:
      An updated filter configuration having the desired translation.
    • scale

      public FilterConf scale(double x, double y)
      Scales the parent layer by the given x and y factors before applying other filtering operations.
      Parameters:
      x - The factor to scale the parent layer along the x-axis before filtering.
      y - The factor to scale the parent layer along the y-axis before filtering.
      Returns:
      An updated filter configuration having the desired scaling.
    • blur

      public FilterConf blur(double radius)
      Supply values greater than 0 to this to apply a gaussian blur to the parent layer. Note that this operation will be applied after the parent layer was translated and scaled.
      Parameters:
      radius - The radius of the gaussian blur filter to apply to the parent layer.
      Returns:
      An updated filter configuration having the desired blur radius.
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object