Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
ac13
GSYVideoPlayer
提交
f3ab3e5a
G
GSYVideoPlayer
项目概览
ac13
/
GSYVideoPlayer
与 Fork 源项目一致
从无法访问的项目Fork
通知
7
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
GSYVideoPlayer
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
f3ab3e5a
编写于
9月 29, 2017
作者:
G
guoshuyu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
增加水印效果 (2017-09-29)
上级
826a19d6
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
43 addition
and
10 deletion
+43
-10
app/src/main/java/com/example/gsyvideoplayer/DetailFilterActivity.java
...java/com/example/gsyvideoplayer/DetailFilterActivity.java
+1
-1
app/src/main/java/com/example/gsyvideoplayer/effect/BitmapIconEffect.java
...a/com/example/gsyvideoplayer/effect/BitmapIconEffect.java
+33
-0
app/src/main/java/com/example/gsyvideoplayer/effect/GSYVideoGLViewCustomRender.java
...ple/gsyvideoplayer/effect/GSYVideoGLViewCustomRender.java
+9
-9
未找到文件。
app/src/main/java/com/example/gsyvideoplayer/DetailFilterActivity.java
浏览文件 @
f3ab3e5a
...
...
@@ -138,7 +138,7 @@ public class DetailFilterActivity extends GSYBaseActivityDetail {
Bitmap
bitmap
=
BitmapFactory
.
decodeResource
(
getResources
(),
R
.
drawable
.
unlock
);
//自定义render需要在播放器设置
detailPlayer
.
setCustomGLRenderer
(
new
GSYVideoGLViewCustomRender
(
bitmap
,
dp2px
(
96
),
dp2px
(
128
),
0.6f
));
detailPlayer
.
setCustomGLRenderer
(
new
GSYVideoGLViewCustomRender
(
bitmap
,
dp2px
(
32
),
dp2px
(
43
),
0.6f
));
changeFilter
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
...
...
app/src/main/java/com/example/gsyvideoplayer/effect/BitmapIconEffect.java
浏览文件 @
f3ab3e5a
...
...
@@ -12,6 +12,8 @@ import com.shuyu.gsyvideoplayer.GSYVideoGLView.ShaderInterface;
public
class
BitmapIconEffect
implements
ShaderInterface
{
private
GLSurfaceView
mGlSurfaceViewl
;
private
Bitmap
mBitmap
;
private
int
mWidth
=
-
1
;
...
...
@@ -20,6 +22,8 @@ public class BitmapIconEffect implements ShaderInterface {
private
float
mAlpha
=
1.0f
;
private
float
mPositionOffset
=
1.0f
;
public
BitmapIconEffect
(
Bitmap
bitmap
)
{
this
(
bitmap
,
bitmap
.
getWidth
(),
bitmap
.
getHeight
());
}
...
...
@@ -37,6 +41,7 @@ public class BitmapIconEffect implements ShaderInterface {
@Override
public
String
getShader
(
GLSurfaceView
mGlSurfaceView
)
{
this
.
mGlSurfaceViewl
=
mGlSurfaceView
;
String
shader
=
"#extension GL_OES_EGL_image_external : require\n"
+
"precision mediump float;\n"
...
...
@@ -59,6 +64,34 @@ public class BitmapIconEffect implements ShaderInterface {
return
(
float
)
mHeight
;
}
/**
* 水印图的默认比例
*/
public
float
getScaleW
()
{
return
getWidth
()
/
mGlSurfaceViewl
.
getWidth
();
}
/**
* 水印图的默认比例
*/
public
float
getScaleH
()
{
return
getHeight
()
/
mGlSurfaceViewl
.
getHeight
();
}
/**
* 水印图的起始位置,默认右边
*/
public
float
getPositionX
()
{
return
-(
mGlSurfaceViewl
.
getWidth
()
/
(
getWidth
())
-
mPositionOffset
);
}
/**
* 水印图的起始位置,默认上
*/
public
float
getPositionY
()
{
return
-(
mGlSurfaceViewl
.
getHeight
()
/
(
getHeight
())
-
mPositionOffset
);
}
public
Bitmap
getBitmap
()
{
return
mBitmap
;
}
...
...
app/src/main/java/com/example/gsyvideoplayer/effect/GSYVideoGLViewCustomRender.java
浏览文件 @
f3ab3e5a
...
...
@@ -4,6 +4,7 @@ import android.annotation.SuppressLint;
import
android.graphics.Bitmap
;
import
android.graphics.BitmapFactory
;
import
android.opengl.GLES20
;
import
android.opengl.GLU
;
import
android.opengl.GLUtils
;
import
android.opengl.Matrix
;
...
...
@@ -35,13 +36,11 @@ public class GSYVideoGLViewCustomRender extends GSYVideoGLViewSimpleRender {
private
final
float
[]
mTriangleVerticesData
=
{
// X, Y, Z, U, V
-
1.0f
,
-
1.0f
,
0.0f
,
0.0f
,
0.0f
,
1.0f
,
-
1.0f
,
0.0f
,
1.0f
,
0.0f
,
-
1.0f
,
1.0f
,
0.0f
,
0.0f
,
1.0f
,
1.0f
,
1.0f
,
0.0f
,
1.0f
,
1.0f
,};
-
1.0f
,
-
1.0f
,
0.0f
,
0.0f
,
0.0f
,
1.0f
,
-
1.0f
,
0.0f
,
1.0f
,
0.0f
,
-
1.0f
,
1.0f
,
0.0f
,
0.0f
,
1.0f
,
1.0f
,
1.0f
,
0.0f
,
1.0f
,
1.0f
,};
private
float
[]
mMVPMatrix
=
new
float
[
16
];
...
...
@@ -140,8 +139,9 @@ public class GSYVideoGLViewCustomRender extends GSYVideoGLViewSimpleRender {
//旋转到正常角度
Matrix
.
setRotateM
(
mMVPMatrix
,
0
,
180
f
,
0.0f
,
0
,
1.0f
);
//调整大小比例
Matrix
.
scaleM
(
mMVPMatrix
,
0
,
mBitmapEffect
.
getWidth
()
/
mSurfaceView
.
getWidth
(),
mBitmapEffect
.
getHeight
()
/
mSurfaceView
.
getWidth
(),
1
);
Matrix
.
scaleM
(
mMVPMatrix
,
0
,
mBitmapEffect
.
getScaleW
(),
mBitmapEffect
.
getScaleH
(),
1
);
//调整位置
Matrix
.
translateM
(
mMVPMatrix
,
0
,
mBitmapEffect
.
getPositionX
(),
mBitmapEffect
.
getPositionY
(),
0
f
);
}
@Override
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录