Package 

Interface Filter


  • 
    public interface Filter
    
                        

    A Filter is a real time filter that operates onto the camera preview, plus any snapshot media taken with takePictureSnapshot and takeVideoSnapshot. You can apply filters to the camera engine using setFilter. The default filter is called NoFilter and can be used to restore the normal preview. A lof of other filters are collected in the Filters class. Advanced users can create custom filters using GLES. It is recommended to extend BaseFilter instead of this class. All Filters should have a no-arguments public constructor. This ensures that you can pass the filter class to XML attribute {@code app:cameraFilter}, and also helps BaseFilter automatically make a copy of the filter. Parameterized filters can implement OneParameterFilter and TwoParameterFilter to receive parameters in the 0F-1F range. This helps in making filter copies and also let us map the filter parameter to gestures.

    • Method Summary

      Modifier and Type Method Description
      abstract String getVertexShader() Returns a String containing the vertex shader.
      abstract String getFragmentShader() Returns a String containing the fragment shader.
      abstract void onCreate(int programHandle) The filter program was just created.
      abstract void onDestroy() The filter program is about to be destroyed.
      abstract void draw(long timestampUs, @NonNull() Array<float> transformMatrix) Called to render the actual texture.
      abstract void setSize(int width, int height) Called anytime the output size changes.
      abstract Filter copy() Clones this filter creating a new instance of it.If it has any important parameters, these should be passedto the new instance.
      • Methods inherited from class java.lang.Object

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

      • onCreate

         abstract void onCreate(int programHandle)

        The filter program was just created. We pass in a handle to the OpenGLprogram that was created, so you can fetch pointers.

        Parameters:
        programHandle - handle
      • onDestroy

         abstract void onDestroy()

        The filter program is about to be destroyed.

      • draw

         abstract void draw(long timestampUs, @NonNull() Array<float> transformMatrix)

        Called to render the actual texture. The given transformation matrixshould be applied.

        Parameters:
        timestampUs - timestamp in microseconds
        transformMatrix - matrix
      • setSize

         abstract void setSize(int width, int height)

        Called anytime the output size changes.

        Parameters:
        width - width
        height - height
      • copy

        @NonNull() abstract Filter copy()

        Clones this filter creating a new instance of it.If it has any important parameters, these should be passedto the new instance.