在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:cats-oss/android-gpuimage开源软件地址:https://github.com/cats-oss/android-gpuimage开源编程语言:Java 98.6%开源软件介绍:GPUImage for AndroidIdea from: iOS GPUImage framework Goal is to have something as similar to GPUImage as possible. Vertex and fragment shaders are exactly the same. That way it makes it easier to port filters from GPUImage iOS to Android. Requirements
UsageGradle dependencyrepositories {
mavenCentral()
}
dependencies {
implementation 'jp.co.cyberagent.android:gpuimage:2.x.x'
} Sample CodeWith preview:Java: @Override
public void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity);
Uri imageUri = ...;
gpuImage = new GPUImage(this);
gpuImage.setGLSurfaceView((GLSurfaceView) findViewById(R.id.surfaceView));
gpuImage.setImage(imageUri); // this loads image on the current thread, should be run in a thread
gpuImage.setFilter(new GPUImageSepiaFilter());
// Later when image should be saved saved:
gpuImage.saveToPictures("GPUImage", "ImageWithFilter.jpg", null);
} Kotlin: public override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_gallery)
val imageUri: Uri = ...
gpuImage = GPUImage(this)
gpuImage.setGLSurfaceView(findViewById<GLSurfaceView>(R.id.surfaceView))
gpuImage.setImage(imageUri) // this loads image on the current thread, should be run in a thread
gpuImage.setFilter(GPUImageSepiaFilter())
// Later when image should be saved saved:
gpuImage.saveToPictures("GPUImage", "ImageWithFilter.jpg", null)
} Using GPUImageView<jp.co.cyberagent.android.gpuimage.GPUImageView
android:id="@+id/gpuimageview"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:gpuimage_show_loading="false"
app:gpuimage_surface_type="texture_view" /> <!-- surface_view or texture_view --> Java: @Override
public void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity);
Uri imageUri = ...;
gpuImageView = findViewById(R.id.gpuimageview);
gpuImageView.setImage(imageUri); // this loads image on the current thread, should be run in a thread
gpuImageView.setFilter(new GPUImageSepiaFilter());
// Later when image should be saved saved:
gpuImageView.saveToPictures("GPUImage", "ImageWithFilter.jpg", null);
} Kotlin: public override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_gallery)
val imageUri: Uri = ...
gpuImageView = findViewById<GPUImageView>(R.id.gpuimageview)
gpuImageView.setImage(imageUri) // this loads image on the current thread, should be run in a thread
gpuImageView.setFilter(GPUImageSepiaFilter())
// Later when image should be saved saved:
gpuImageView.saveToPictures("GPUImage", "ImageWithFilter.jpg", null)
} Without preview:Java: public void onCreate(final Bundle savedInstanceState) {
public void onCreate(final Bundle savedInstanceState) {
Uri imageUri = ...;
gpuImage = new GPUImage(context);
gpuImage.setFilter(new GPUImageSobelEdgeDetection());
gpuImage.setImage(imageUri);
gpuImage.saveToPictures("GPUImage", "ImageWithFilter.jpg", null);
} Kotlin: public override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_gallery)
val imageUri: Uri = ...
gpuImage = GPUImage(this)
gpuImage.setFilter(GPUImageSepiaFilter())
gpuImage.setImage(imageUri)
gpuImage.saveToPictures("GPUImage", "ImageWithFilter.jpg", null)
} GPUImage for iOS shadersSupport status of
Others
GradleMake sure that you run the clean target when using maven. gradle clean assemble License
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论