Skip to content

Commit

Permalink
增加了镜像旋转的库支持 (2017-04-28)
Browse files Browse the repository at this point in the history
  • Loading branch information
CarGuo committed Apr 28, 2017
1 parent ebf3049 commit d5feda2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -179,20 +179,29 @@ protected void resolveTransform() {
Matrix transform = new Matrix();
transform.setScale(-1, 1, mTextureView.getWidth() / 2, 0);
mTextureView.setTransform(transform);
mCoverImageView.setScaleType(ImageView.ScaleType.MATRIX);
mCoverImageView.setImageMatrix(transform);
mTransformCover = transform;
mChangeTransform.setText("左右镜像");
}
break;
case 2: {
Matrix transform = new Matrix();
transform.setScale(1, -1, 0, mTextureView.getHeight() / 2);
mTextureView.setTransform(transform);
mCoverImageView.setScaleType(ImageView.ScaleType.MATRIX);
mCoverImageView.setImageMatrix(transform);
mTransformCover = transform;
mChangeTransform.setText("上下镜像");
}
break;
case 0: {
Matrix transform = new Matrix();
transform.setScale(1, 1, mTextureView.getWidth() / 2, 0);
mTextureView.setTransform(transform);
mCoverImageView.setScaleType(ImageView.ScaleType.MATRIX);
mCoverImageView.setImageMatrix(transform);
mTransformCover = null;
mChangeTransform.setText("旋转镜像");
}
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import android.app.Activity;
import android.content.Context;
import android.graphics.Matrix;
import android.graphics.SurfaceTexture;
import android.media.AudioManager;
import android.media.MediaPlayer;
Expand Down Expand Up @@ -81,6 +82,8 @@ public abstract class GSYVideoPlayer extends GSYBaseVideoPlayer implements View.

protected String mPlayTag = ""; //播放的tag,防止错误,因为普通的url也可能重复

protected Matrix mTransformCover = null;

protected int mPlayPosition = -22; //播放的tag,防止错误,因为普通的url也可能重复

protected float mDownX;//触摸的X
Expand Down Expand Up @@ -711,6 +714,10 @@ protected void showPauseCover() {
&& !mFullPauseBitmap.isRecycled() && mShowPauseCover) {
mCoverImageView.setRotation(mTextureView.getRotation());
mCoverImageView.setImageBitmap(mFullPauseBitmap);
if(mTransformCover != null) {
mCoverImageView.setScaleType(ImageView.ScaleType.MATRIX);
mCoverImageView.setImageMatrix(mTransformCover);
}
mCoverImageView.setVisibility(VISIBLE);
}
} catch (Exception e) {
Expand Down

0 comments on commit d5feda2

Please sign in to comment.