当前位置: 首页>>代码示例>>Java>>正文


Java CaptureCameraPreview类代码示例

本文整理汇总了Java中org.artoolkit.ar.base.camera.CaptureCameraPreview的典型用法代码示例。如果您正苦于以下问题:Java CaptureCameraPreview类的具体用法?Java CaptureCameraPreview怎么用?Java CaptureCameraPreview使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


CaptureCameraPreview类属于org.artoolkit.ar.base.camera包,在下文中一共展示了CaptureCameraPreview类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onRequestPermissionsResult

import org.artoolkit.ar.base.camera.CaptureCameraPreview; //导入依赖的package包/类
@Override
public void onRequestPermissionsResult(int requestCode,
                                       @NonNull String[] permissions,
                                       @NonNull int[] grantResults) {
    Log.i(TAG, "onRequestPermissionsResult(): called");
    if (requestCode == CaptureCameraPreview.REQUEST_CAMERA_PERMISSION_RESULT) {
        if (grantResults[0] != PackageManager.PERMISSION_GRANTED) {
            Toast.makeText(getApplicationContext(),
                "Application will not run with camera access denied",
                Toast.LENGTH_LONG).show();
        }
        else if (1 <= permissions.length) {
            Toast.makeText(getApplicationContext(),
                String.format("Camera access permission \"%s\" allowed", permissions[0]),
                Toast.LENGTH_SHORT).show();
        }
        CaptureCameraPreview previewHook = getCameraPreview();
        if (null != previewHook) {
            Log.i(TAG, "onRequestPermissionsResult(): reset ask for cam access perm");
            previewHook.resetGettingCameraAccessPermissionsFromUserState();
        }
    }
    else
        super.onRequestPermissionsResult(requestCode, permissions, grantResults);
}
 
开发者ID:norips,项目名称:Projet_MBA,代码行数:26,代码来源:ARActivity.java

示例2: onResume

import org.artoolkit.ar.base.camera.CaptureCameraPreview; //导入依赖的package包/类
@Override
protected void onResume() {
	super.onResume();
	//Crea la view de la camara
	preview = new CaptureCameraPreview(this, this);

	FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.MATCH_PARENT);
	//Añade las views al layout
	mainLayout.addView(gameView,layoutParams);
	mainLayout.addView(preview,layoutParams);

}
 
开发者ID:GLUD,项目名称:trascendentAR,代码行数:13,代码来源:ARLauncher.java

示例3: onResume

import org.artoolkit.ar.base.camera.CaptureCameraPreview; //导入依赖的package包/类
@SuppressWarnings("deprecation") // FILL_PARENT still required for API level 7 (Android 2.1)
@Override
   public void onResume() {
   	//Log.i(TAG, "onResume()");
   	super.onResume();

   	// Create the camera preview
   	preview = new CaptureCameraPreview(this, this, isRearCameraDefault );
   	
   	Log.i(TAG, "CaptureCameraPreview created"); 
   	
   	// Create the GL view
   	glView = new GLSurfaceView(this);    		
	glView.setEGLConfigChooser(8, 8, 8, 8, 16, 0);
	glView.getHolder().setFormat(PixelFormat.TRANSLUCENT); // Needs to be a translucent surface so the camera preview shows through.
	glView.setRenderer(renderer);		
	glView.setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY); // Only render when we have a frame (must call requestRender()).
	glView.setZOrderMediaOverlay(true); // Request that GL view's SurfaceView be on top of other SurfaceViews (including CameraPreview's SurfaceView).
	
	Log.i(TAG, "GLSurfaceView created");
	
	// Add the views to the interface
       mainLayout.addView(preview, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
       mainLayout.addView(glView, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));

	Log.i(TAG, "Views added to main layout.");

	if (glView != null) glView.onResume();
   }
 
开发者ID:yurisuzukiltd,项目名称:AR-Music-Kit,代码行数:30,代码来源:ARActivity.java

示例4: onResume

import org.artoolkit.ar.base.camera.CaptureCameraPreview; //导入依赖的package包/类
@SuppressWarnings("deprecation") // FILL_PARENT still required for API level 7 (Android 2.1)
	@Override
    public void onResume() {
    	//Log.i(TAG, "onResume()");
    	super.onResume();
    	
    	// Create the camera preview
    	preview = new CaptureCameraPreview(this, this);
    	
    	Log.i(TAG, "CaptureCameraPreview created"); 
    	
    	// Create the GL view
//    	glView = new GLSurfaceView(this);

        glView = (GLSurfaceView) this.graphics.getView();


		// Set to use OpenGL ES 2.0
//		glView.setEGLContextClientVersion(2);

//		glView.setEGLConfigChooser(8, 8, 8, 8, 16, 0);
		glView.getHolder().setFormat(PixelFormat.TRANSLUCENT); // Needs to be a translucent surface so the camera preview shows through.
		glView.setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY); // Only render when we have a frame (must call requestRender()).
		glView.setZOrderMediaOverlay(true); // Request that GL view's SurfaceView be on top of other SurfaceViews (including CameraPreview's SurfaceView).
//
//		Log.i(TAG, "GLSurfaceView created");
		
		// Add the views to the interface
        mainLayout.addView(preview, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
        mainLayout.addView(glView, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));

		Log.i(TAG, "Views added to main layout.");

		if (glView != null) glView.onResume();
    }
 
开发者ID:harua8n,项目名称:CodeSamples,代码行数:36,代码来源:ARActivity.java

示例5: onResume

import org.artoolkit.ar.base.camera.CaptureCameraPreview; //导入依赖的package包/类
@SuppressWarnings("deprecation") // FILL_PARENT still required for API level 7 (Android 2.1)
@Override
   public void onResume() {
   	//Log.i(TAG, "onResume()");
   	super.onResume();
   	
   	// Create the camera preview
   	preview = new CaptureCameraPreview(this, this);
   	
   	Log.i(TAG, "CaptureCameraPreview created"); 
   	
   	// Create the GL view
   	glView = new GLSurfaceView(this);    		
	glView.setEGLConfigChooser(8, 8, 8, 8, 16, 0);
	glView.getHolder().setFormat(PixelFormat.TRANSLUCENT); // Needs to be a translucent surface so the camera preview shows through.
	glView.setRenderer(renderer);		
	glView.setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY); // Only render when we have a frame (must call requestRender()).
	glView.setZOrderMediaOverlay(true); // Request that GL view's SurfaceView be on top of other SurfaceViews (including CameraPreview's SurfaceView).
	
	Log.i(TAG, "GLSurfaceView created");
	
	// Add the views to the interface
       mainLayout.addView(preview, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
       mainLayout.addView(glView, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));

	Log.i(TAG, "Views added to main layout.");

	if (glView != null) glView.onResume();
   }
 
开发者ID:plattysoft,项目名称:ArToolKitJpctBaseLib,代码行数:30,代码来源:ARActivity.java

示例6: onResume

import org.artoolkit.ar.base.camera.CaptureCameraPreview; //导入依赖的package包/类
@SuppressWarnings("deprecation") // FILL_PARENT still required for API level 7 (Android 2.1)
@Override
public void onResume() {
    Log.i(TAG, "onResume(): called");
    super.onResume();

    // Create the camera preview
    preview = new CaptureCameraPreview(mActivity, this);
    Log.i(TAG, "onResume(): CaptureCameraPreview constructed");

    if (preview.gettingCameraAccessPermissionsFromUser())
        //No need to go further, must ask user to allow access to the camera first.
        return;

    // Create the GL view
    glView = new GLSurfaceView(this);

    // Check if the system supports OpenGL ES 2.0.
    final ActivityManager activityManager = (ActivityManager)getSystemService(Context.ACTIVITY_SERVICE);
    final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();
    final boolean supportsEs2 = configurationInfo.reqGlEsVersion >= 0x20000;

    if (supportsEs2) {
        Log.i(TAG, "onResume(): OpenGL ES 2.x is supported");

        if (renderer instanceof ARRendererGLES20) {
            // Request an OpenGL ES 2.0 compatible context.
            glView.setEGLContextClientVersion(2);
        } else {
            Log.w(TAG, "onResume(): OpenGL ES 2.x is supported but only a OpenGL 1.x renderer is available." +
                    " \n Use ARRendererGLES20 for ES 2.x support. \n Continuing with OpenGL 1.x.");
            glView.setEGLContextClientVersion(1);
        }
    } else {
        Log.i(TAG, "onResume(): Only OpenGL ES 1.x is supported");
        if (renderer instanceof ARRendererGLES20)
            throw new RuntimeException("Only OpenGL 1.x available but a OpenGL 2.x renderer was provided.");
        // This is where you could create an OpenGL ES 1.x compatible
        // renderer if you wanted to support both ES 1 and ES 2.
        glView.setEGLContextClientVersion(1);
    }

    glView.setEGLConfigChooser(8, 8, 8, 8, 16, 0);
    glView.getHolder().setFormat(PixelFormat.TRANSLUCENT); // Needs to be a translucent surface so the camera preview shows through.
    glView.setRenderer(renderer);
    glView.setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY); // Only render when we have a frame (must call requestRender()).
    glView.setZOrderMediaOverlay(true); // Request that GL view's SurfaceView be on top of other SurfaceViews (including CameraPreview's SurfaceView).

    Log.i(TAG, "onResume(): GLSurfaceView created");

    Point windowSize = new Point();
    getWindowManager().getDefaultDisplay().getSize(windowSize);
    // Assumes landscape orientation //TODO: Auto rotate
    float aspectRatio = 4.0f / 3.f;
    int height = windowSize.y;
    int width = Math.round(height * aspectRatio);

    if (width > windowSize.x) {
        // For portrait screens instead...
        width = windowSize.x;
        height = Math.round(width * aspectRatio);
    }

    // Add the views to the interface
    mainLayout.addView(preview, new LayoutParams(width, height));
    mainLayout.addView(glView, new LayoutParams(width, height));
    Log.i(TAG, "onResume(): Views added to main layout.");

    Log.i(TAG, "onResume(): Views added to main layout.");
    if (glView != null) glView.onResume();
}
 
开发者ID:norips,项目名称:Projet_MBA,代码行数:72,代码来源:ARActivity.java

示例7: getCameraPreview

import org.artoolkit.ar.base.camera.CaptureCameraPreview; //导入依赖的package包/类
/**
* Returns the camera preview that is providing the video frames.
* @return The camera preview that is providing the video frames.
*/
  public CaptureCameraPreview getCameraPreview() {
  	return preview;
  }
 
开发者ID:yurisuzukiltd,项目名称:AR-Music-Kit,代码行数:8,代码来源:ARActivity.java

示例8: getCameraPreview

import org.artoolkit.ar.base.camera.CaptureCameraPreview; //导入依赖的package包/类
/**
 * Returns the camera preview that is providing the video frames.
 *
 * @return The camera preview that is providing the video frames.
 */
public CaptureCameraPreview getCameraPreview() {
    return preview;
}
 
开发者ID:norips,项目名称:Projet_MBA,代码行数:9,代码来源:ARActivity.java

示例9: getCameraPreview

import org.artoolkit.ar.base.camera.CaptureCameraPreview; //导入依赖的package包/类
public CaptureCameraPreview getCameraPreview() { return preview; } 
开发者ID:donaldmunro,项目名称:AARemu,代码行数:2,代码来源:ARemuActivity.java


注:本文中的org.artoolkit.ar.base.camera.CaptureCameraPreview类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。