本文整理汇总了Java中android.view.SurfaceView.getHeight方法的典型用法代码示例。如果您正苦于以下问题:Java SurfaceView.getHeight方法的具体用法?Java SurfaceView.getHeight怎么用?Java SurfaceView.getHeight使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.view.SurfaceView
的用法示例。
在下文中一共展示了SurfaceView.getHeight方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: drawFrame
import android.view.SurfaceView; //导入方法依赖的package包/类
/**
* Draws a frame onto the SurfaceView and the encoder surface.
* <p>
* This will be called whenever we get a new preview frame from the camera. This runs
* on the UI thread, which ordinarily isn't a great idea -- you really want heavy work
* to be on a different thread -- but we're really just throwing a few things at the GPU.
* The upside is that we don't have to worry about managing state changes between threads.
* <p>
* If there was a pending frame available notification when we shut down, we might get
* here after onPause().
*/
private void drawFrame() {
//Log.d(TAG, "drawFrame");
if (mEglCore == null) {
Log.d(TAG, "Skipping drawFrame after shutdown");
return;
}
// Latch the next frame from the camera.
mDisplaySurface.makeCurrent();
mCameraTexture.updateTexImage();
mCameraTexture.getTransformMatrix(mTmpMatrix);
// Fill the SurfaceView with it.
SurfaceView sv = (SurfaceView) findViewById(R.id.continuousCapture_surfaceView);
int viewWidth = sv.getWidth();
int viewHeight = sv.getHeight();
GLES20.glViewport(0, 0, viewWidth, viewHeight);
mFullFrameBlit.drawFrame(mTextureId, mTmpMatrix);
drawExtra(mFrameNum, viewWidth, viewHeight);
mDisplaySurface.swapBuffers();
// Send it to the video encoder.
if (!mFileSaveInProgress) {
mEncoderSurface.makeCurrent();
GLES20.glViewport(0, 0, VIDEO_WIDTH, VIDEO_HEIGHT);
mFullFrameBlit.drawFrame(mTextureId, mTmpMatrix);
drawExtra(mFrameNum, VIDEO_WIDTH, VIDEO_HEIGHT);
mCircEncoder.frameAvailableSoon();
mEncoderSurface.setPresentationTime(mCameraTexture.getTimestamp());
mEncoderSurface.swapBuffers();
}
mFrameNum++;
}