简体   繁体   中英

Android GPU image, how to apply a filter to part of an image

So I'm using https://github.com/CyberAgent/android-gpuimage and I want to achieve this (apply the filter only to a zone of the image):

在此处输入图片说明

Uri imageUri = ...;
mGPUImage = new GPUImage(this);
mGPUImage.setGLSurfaceView((GLSurfaceView) findViewById(R.id.surfaceView));
mGPUImage.setImage(imageUri);
sepiaFilter = new GPUImageSepiaFilter()
mGPUImage.setFilter(sepiaFilter);

is there a way to do something like:

TextureZone textureZone = new TextureZone(...);
sepiaFilter.setFilterOnlyOn(textureZone)

or do I need to go deeper and make a custom shader?

You have to write your custom filter with self-written fragment shader. In fragment shader, you should check for which fragment will be applied the filter.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM