本文整理匯總了Java中android.view.SurfaceView.getWidth方法的典型用法代碼示例。如果您正苦於以下問題:Java SurfaceView.getWidth方法的具體用法?Java SurfaceView.getWidth怎麽用?Java SurfaceView.getWidth使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.view.SurfaceView
的用法示例。
在下文中一共展示了SurfaceView.getWidth方法的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++;
}