wysaid / android-gpuimage-plus

Android Image & Camera Filters Based on OpenGL.
MIT License
1.8k stars 473 forks source link

请教下怎样使用filters下面的滤镜? #203

Open yungs2017 opened 7 years ago

yungs2017 commented 7 years ago

我在c++代码中想使用“色彩平衡”和“CGEColorLevelFilter”这两个滤镜,尝试了都没有成功,下面是我的代码: CGE::CGEImageHandlerAndroid handler; CGE::CGEColorLevelFilter f = new CGE::CGEColorLevelFilter(); f->setGamma(2.f); f->setLevel(0.2f,0.6f); CGESharedGLContext glContext = CGESharedGLContext::create(); glContext->makecurrent(); f->init(); handler.initWithBitmap(env, emBitmap); handler.addImageFilter(f); handler.processingFilters(); //Run the filters. jobject resultBitmap = handler.getResultBitmap(env); delete glContext; return resultBitmap;

这种方法使用我自定义的滤镜可以成功,使用filter下面的滤镜是否还要其他的事项?谢谢

wysaid commented 7 years ago

context放到handler之前

yungs2017 commented 7 years ago

尝试了各种顺序,都没有执行成功😂😂😂

wysaid commented 7 years ago

context创建和makecurrent放到你这几句最前面

wysaid commented 7 years ago

以及两次set应该在init之后,建议写代码之前先看看例子