Project Name | Stars | Downloads | Repos Using This | Packages Using This | Most Recent Commit | Total Releases | Latest Release | Open Issues | License | Language |
---|---|---|---|---|---|---|---|---|---|---|
Cameraview | 4,622 | 4 years ago | 183 | apache-2.0 | Java | |||||
[DEPRECATED] Easily integrate Camera features into your Android app | ||||||||||
Playerbase | 2,822 | 2 years ago | 15 | apache-2.0 | Java | |||||
The basic library of Android player will process complex business components. The access is simple。Android播放器基础库,专注于播放视图组件的高复用性和组件间的低耦合,轻松处理复杂业务。 | ||||||||||
Scene | 1,944 | 6 months ago | 5 | apache-2.0 | Java | |||||
Android Single Activity Applications framework without Fragment. | ||||||||||
Yjplay | 1,635 | 3 years ago | 33 | apache-2.0 | C | |||||
一个支持自定义UI布局,流式API, 加密,直播 ,亮度,音量,快进等手势 ,广告视频预览,多种加载模式 ,多种分辨率切换 ,多种封面图, 自定义数据源,列表播放,倍数播放,边播变缓存<font color="red">不是使用AndroidVideoCache</font>,离线播放,神奇的播放器 | ||||||||||
Android Opengl Canvas | 989 | 8 months ago | 20 | apache-2.0 | Java | |||||
An Android library that provides views using openGL canvas to draw things on SurfaceView or TextureView. | ||||||||||
Fpsanimator | 730 | 5 years ago | 2 | Java | ||||||
FPSAnimator is very easy animation library for Android TextureView and SurfaceView. | ||||||||||
Icamera | 404 | 2 years ago | 4 | August 28, 2021 | 9 | apache-2.0 | Kotlin | |||
A well designed camera library for Android platform with almost all features you require when making a camera app. | ||||||||||
Blur Lib Android | 343 | 3 years ago | 8 | other | Kotlin | |||||
Texturevideoview | 276 | 31 | 5 years ago | 7 | January 31, 2017 | 3 | apache-2.0 | Java | ||
A VideoView based on the official Android 7.1.1_r13 sources using a TextureView instead of a SurfaceView by sprylab technologies GmbH. | ||||||||||
Wechatvideoview | 245 | 3 years ago | 3 | Java | ||||||
Android - 微信 - 朋友圈 - 小视频播放,wechat friend-circle,small video play |
此项目灵感来源:
感谢这些源代码提供者!
项目应用
提供一个类似Android Canvas类的使用OpenGL来实现绘制的canvasGL。可以像传统自定义View那样直接继承 GLViews, 再使用这个canvas绘制需要的东西。
提供类似 GPUImage 里的Filter的API,可以在使用canvasGL画东西时实现图像处理。
提供的View是继承 GLSurfaceView 或 TextureView 的,可以使用这两种View的特性,特别是TextureView的特性。
另外,因为使用OpenGL在另一线程渲染,所以里面的 GLContinuousView 还提供能够实现高性能的动画的方法。(如果只要这个功能不要其它得话,那么我建议你直接继承View,见浅析Android的canvas性能)
与GPUImage对比:
sample:
// in root build.gradle
allprojects {
repositories {
jcenter()
maven { url "https://jitpack.io" }
}
}
// module build.gradle
dependencies {
implementation 'com.github.ChillingVan:android-openGL-canvas:v1.5.4.0'
}
public class MyGLView extends GLView {
public MyGLView(Context context) {
super(context);
}
public MyGLView(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
protected void onGLDraw(ICanvasGL canvas) {
// draw things with canvas here
}
}
其中, GLContinuouslyView, GLTextureView, GLContinuousTextureView, GLMultiTexProducerView and GLMultiTexConsumerView 用法相似.
使用CanvasGL实现绘制
canvas.drawBitmap(textBitmap, left, top);
// transform
canvas.save();
canvas.rotate(rotateDegree, x, y);
canvas.drawBitmap(bitmap, left, top);
canvas.restore();
// or
CanvasGL.BitmapMatrix matrix = new CanvasGL.BitmapMatrix();
matrix.postScale(2.1f, 2.1f);
matrix.postRotate(90);
canvas.drawBitmap(bitmap, matrix);
// apply filter to the bitmap
textureFilter = new ContrastFilter(2.8f);
canvas.drawBitmap(bitmap, left, top, textureFilter);
可以与Camera结合,注意运行样例代码的时候尽量使用真机而不是模拟器。
如果不想使用View,可以使用 MultiTexOffScreenCanvas 实现脱离屏幕的绘制,然后使用getDrawingBitmap方法获取绘制的内容。
MediaPlayer
可以用 MediaPlayer 去解码视频,并绘制到 TextureView 上。 如果用本项目里的 GLSurfaceTextureProducerView ,那么还可以做视频处理。 结合AndroidInstantVideo的stream publisher,就能生成新视频。
这个GLCanvas不能绘制文本。只能先把文本转成Bitmap来绘制 可以使用AndroidCanvasHelper来画任意东西再转化为Bitmap给GLCanvas 这有同步和异步模式,视情况用对应的模式,详细请看例子。
每一个View的onGLDraw都运行在自己的线程而非主线程。
目前的Filter没有GPUImage里那么多,如果有需要,参照我的代码自己实现即可,难度不高。
为什么Bitmap修改后,再次绘制时并没更新?
因为没有调用canvasGL的invalidateTextureContent(bitmap)。改变了的Bitmap需要重新绑定texture。因为绑定需要耗时,所以库里面才不做成每次都重新绑定。
CanvasGL里面没有drawPath或者drawText,要实现的话本库提供了IAndroidCanvasHelper,但这个只是用安卓自己的canvas生成一个Bitmap,所以要注意性能
Copyright 2016 ChillingVan.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on
an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.