TJCustomFilter

org.libjpegturbo.turbojpeg

## Interface TJCustomFilter

-     public interface TJCustomFilter

  Custom filter callback interface

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `customFilter(java.nio.ShortBuffer coeffBuffer, java.awt.Rectangle bufferRegion, java.awt.Rectangle planeRegion, int componentID, int transformID, TJTransform transform)` A callback function that can be used to modify the DCT coefficients after they are losslessly transformed but before they are transcoded to a new JPEG image.

- - ### Method Detail

    - #### customFilter

          void customFilter(java.nio.ShortBuffer coeffBuffer,
                          java.awt.Rectangle bufferRegion,
                          java.awt.Rectangle planeRegion,
                          int componentID,
                          int transformID,
                          TJTransform transform)
                            throws TJException

      A callback function that can be used to modify the DCT coefficients after they are losslessly transformed but before they are transcoded to a new JPEG image. This allows for custom filters or other transformations to be applied in the frequency domain.
      Parameters:
        `coeffBuffer` - a buffer containing transformed DCT coefficients. (NOTE: this buffer is not guaranteed to be valid once the callback returns, so applications wishing to hand off the DCT coefficients to another function or library should make a copy of them within the body of the callback.)
        `bufferRegion` - rectangle containing the width and height of `coeffBuffer` as well as its offset relative to the component plane. TurboJPEG implementations may choose to split each component plane into multiple DCT coefficient buffers and call the callback function once for each buffer.
        `planeRegion` - rectangle containing the width and height of the component plane to which `coeffBuffer` belongs
        `componentID` - ID number of the component plane to which `coeffBuffer` belongs. (Y, Cb, and Cr have, respectively, ID's of 0, 1, and 2 in typical JPEG images.)
        `transformID` - ID number of the transformed image to which `coeffBuffer` belongs. This is the same as the index of the transform in the `transforms` array that was passed to `TJTransformer.transform()`.
        `transform` - a `TJTransform` instance that specifies the parameters and/or cropping region for this transform
      Throws:
        `TJException`