FileDocCategorySizeDatePackage
ToGrayFilter.javaAPI DocAndroid 5.1 API2838Thu Mar 12 22:22:30 GMT 2015android.filterpacks.imageproc

ToGrayFilter

public class ToGrayFilter extends SimpleImageFilter
hide

Fields Summary
private boolean
mInvertSource
private int
mTileSize
private android.filterfw.core.MutableFrameFormat
mOutputFormat
private static final String
mColorToGray4Shader
Constructors Summary
public ToGrayFilter(String name)


       
        super(name, null);
    
Methods Summary
protected android.filterfw.core.ProgramgetNativeProgram(android.filterfw.core.FilterContext context)

        throw new RuntimeException("Native toGray not implemented yet!");
    
protected android.filterfw.core.ProgramgetShaderProgram(android.filterfw.core.FilterContext context)

        int inputChannels = getInputFormat("image").getBytesPerSample();
        if (inputChannels != 4) {
            throw new RuntimeException("Unsupported GL input channels: " +
                                       inputChannels + "! Channels must be 4!");
        }
        ShaderProgram program = new ShaderProgram(context, mColorToGray4Shader);
        program.setMaximumTileSize(mTileSize);
        if (mInvertSource)
            program.setSourceRect(0.0f, 1.0f, 1.0f, -1.0f);
        return program;
    
public voidsetupPorts()

        addMaskedInputPort("image", ImageFormat.create(ImageFormat.COLORSPACE_RGBA,
                                                       FrameFormat.TARGET_GPU));
        addOutputBasedOnInput("image", "image");