/*
 * Copyright (c) 2014 Mario Guggenberger <mg@protyposis.net>
 *
 * This file is part of MediaPlayer-Extended.
 *
 * MediaPlayer-Extended is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * MediaPlayer-Extended is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with MediaPlayer-Extended.  If not, see <http://www.gnu.org/licenses/>.
 */

package net.protyposis.android.spectaculum.effects;

import java.util.List;

import net.protyposis.android.spectaculum.gles.Framebuffer;
import net.protyposis.android.spectaculum.gles.Texture2D;

/**
 * Created by Mario on 18.07.2014.
 */
public interface Effect {

    interface Listener {
        void onEffectChanged(Effect effect);
    }

    String getName();

    void init(int width, int height);

    boolean isInitialized();

    void apply(Texture2D source, Framebuffer target);

    /**
     * Sets a parameter handler for the parameters of this effect. The parameter handler takes
     * care that the parameter values are set on the correct thread (i.e. the GL thread).
     * Setting the handler on the effect makes sure that it is automatically set on its parameters.
     * @see Parameter#setHandler(ParameterHandler)
     * @param handler a handler to set, or null to unset
     */
    void setParameterHandler(ParameterHandler handler);

    void addParameter(Parameter param);

    List<Parameter> getParameters();

    boolean hasParameters();

    void setListener(Listener listener);
}

@@ -984,16 +984,72 @@
 D;%0A%0A/**%0A
+ * Interface to shader effects for the SpectaculumView.%0A
  * Creat
@@ -1114,802 +1114,2738 @@
     
-interface Listener %7B%0A        void onEffectChanged(Effect effect);%0A    %7D%0A%0A    String getName();%0A%0A    void init(int width, int height);%0A%0A    boolean isInitialized();%0A%0A    void apply(Texture2D source, Framebuffer target);%0A%0A    /**%0A     * Sets a parameter handler for the parameters of this effect. The parameter handler takes%0A     * care that the parameter values are set on the correct thread (i.e. the GL thread).%0A     * Setting the handler on the effect makes sure that it is automatically set on its parameters.%0A     * @see Parameter#setHandler(ParameterHandler)%0A     * @param handler a handler to set, or null to unset%0A     */%0A    void setParameterHandler(ParameterHandler handler);%0A%0A    void addParameter(Parameter param);%0A%0A    List%3CParameter%3E getParameters();%0A%0A    boolean hasParameters();%0A
+/**%0A     * Callback interface for effect events.%0A     */%0A    interface Listener %7B%0A        /**%0A         * Gets called when a parameter of the effect has changed.%0A         * @param effect the effect whose parameter has changed%0A         */%0A        void onEffectChanged(Effect effect);%0A    %7D%0A%0A    /**%0A     * Gets the name of the effect.%0A     * @return the name of the effect%0A     */%0A    String getName();%0A%0A    /**%0A     * Initializes the effect by loading all required resources (shaders, framebuffers, textures,%0A     * subeffects, ...) and preparing it for usage. The resolution of the render pipeline respectively%0A     * the texture resolution for internal processing must be supplied.%0A     * @param width the texture width%0A     * @param height the texture height%0A     */%0A    void init(int width, int height);%0A%0A    /**%0A     * Returns the initialization status of the effect.%0A     * @return true if the effect is initialized and ready to use, else false%0A     */%0A    boolean isInitialized();%0A%0A    /**%0A     * Applies the effect to a source texture and writes it to the target framebuffer. The source%0A     * texture is the input image data that the effect is applied to, and the target can be an%0A     * intermediate framebuffer (for chaining to another effect) or the screen for direct output.%0A     * @param source the source texture where the input image is read from%0A     * @param target the target framebuffer where the result with the applied effect is written to%0A     */%0A    void apply(Texture2D source, Framebuffer target);%0A%0A    /**%0A     * Sets a parameter handler for the parameters of this effect. The parameter handler takes%0A     * care that the parameter values are set on the correct thread (i.e. the GL thread).%0A     * Setting the handler on the effect makes sure that it is automatically set on its parameters.%0A     * @see Parameter#setHandler(ParameterHandler)%0A     * @param handler a handler to set, or null to unset%0A     */%0A    void setParameterHandler(ParameterHandler handler);%0A%0A    /**%0A     * Adds a parameter to the effect. Parameters can be used to parameterize parameters of the effect :)%0A     * @see Parameter%0A     * @param param the parameter to add%0A     */%0A    void addParameter(Parameter param);%0A%0A    /**%0A     * Gets a list of available parameters of the effect.%0A     * @return list of effect parameters%0A     */%0A    List%3CParameter%3E getParameters();%0A%0A    /**%0A     * Checks if this effect has any parameters.%0A     * @return true if there are parameters attached, else false%0A     */%0A    boolean hasParameters();%0A%0A    /**%0A     * Sets a listener that gets called when any parameter value of the effect has changed.%0A     * @see Listener#onEffectChanged(Effect)%0A     * @param listener the listener to call back%0A     */
 %0A   

Add documentation to Effect interface