use of android.opengl.GLSurfaceView in project robotium by RobotiumTech.
the class ScreenshotTaker method wrapAllGLViews.
/**
* Extract and wrap the all OpenGL ES Renderer.
*/
private void wrapAllGLViews(View decorView) {
ArrayList<GLSurfaceView> currentViews = viewFetcher.getCurrentViews(GLSurfaceView.class, true, decorView);
final CountDownLatch latch = new CountDownLatch(currentViews.size());
for (GLSurfaceView glView : currentViews) {
Object renderContainer = new Reflect(glView).field("mGLThread").type(GLSurfaceView.class).out(Object.class);
Renderer renderer = new Reflect(renderContainer).field("mRenderer").out(Renderer.class);
if (renderer == null) {
renderer = new Reflect(glView).field("mRenderer").out(Renderer.class);
renderContainer = glView;
}
if (renderer == null) {
latch.countDown();
continue;
}
if (renderer instanceof GLRenderWrapper) {
GLRenderWrapper wrapper = (GLRenderWrapper) renderer;
wrapper.setTakeScreenshot();
wrapper.setLatch(latch);
} else {
GLRenderWrapper wrapper = new GLRenderWrapper(glView, renderer, latch);
new Reflect(renderContainer).field("mRenderer").in(wrapper);
}
}
try {
latch.await();
} catch (InterruptedException ex) {
ex.printStackTrace();
}
}
use of android.opengl.GLSurfaceView in project android-gpuimage-ndkbuild-sample by mugku.
the class ActivityCamera method takePicture.
private void takePicture() {
// TODO get a size that is about the size of the screen
Camera.Parameters params = mCamera.mCameraInstance.getParameters();
params.setRotation(90);
mCamera.mCameraInstance.setParameters(params);
for (Camera.Size size : params.getSupportedPictureSizes()) {
Log.i("ASDF", "Supported: " + size.width + "x" + size.height);
}
mCamera.mCameraInstance.takePicture(null, null, new Camera.PictureCallback() {
@Override
public void onPictureTaken(byte[] data, final Camera camera) {
final File pictureFile = getOutputMediaFile(MEDIA_TYPE_IMAGE);
if (pictureFile == null) {
Log.d("ASDF", "Error creating media file, check storage permissions");
return;
}
try {
FileOutputStream fos = new FileOutputStream(pictureFile);
fos.write(data);
fos.close();
} catch (FileNotFoundException e) {
Log.d("ASDF", "File not found: " + e.getMessage());
} catch (IOException e) {
Log.d("ASDF", "Error accessing file: " + e.getMessage());
}
data = null;
Bitmap bitmap = BitmapFactory.decodeFile(pictureFile.getAbsolutePath());
// mGPUImage.setImage(bitmap);
final GLSurfaceView view = (GLSurfaceView) findViewById(R.id.surfaceView);
view.setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY);
mGPUImage.saveToPictures(bitmap, "GPUImage", System.currentTimeMillis() + ".jpg", new GPUImage.OnPictureSavedListener() {
@Override
public void onPictureSaved(final Uri uri) {
pictureFile.delete();
camera.startPreview();
view.setRenderMode(GLSurfaceView.RENDERMODE_CONTINUOUSLY);
}
});
}
});
}
use of android.opengl.GLSurfaceView in project UltimateAndroid by cymcsg.
the class FlipViewController method setupSurfaceView.
//--------------------------------------------------------------------------------------------------------------------
// Internals
private void setupSurfaceView(Context context) {
surfaceView = new GLSurfaceView(getContext());
cards = new FlipCards(this, flipOrientation == VERTICAL);
renderer = new FlipRenderer(this, cards);
surfaceView.setEGLConfigChooser(8, 8, 8, 8, 16, 0);
surfaceView.setZOrderOnTop(true);
surfaceView.setRenderer(renderer);
surfaceView.getHolder().setFormat(PixelFormat.TRANSLUCENT);
surfaceView.setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY);
addViewInLayout(surfaceView, -1, new AbsListView.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT), false);
}
use of android.opengl.GLSurfaceView in project android-flip by openaphid.
the class FlipViewGroup method setupSurfaceView.
private void setupSurfaceView() {
surfaceView = new GLSurfaceView(getContext());
renderer = new FlipRenderer(this);
surfaceView.setEGLConfigChooser(8, 8, 8, 8, 16, 0);
surfaceView.setZOrderOnTop(true);
surfaceView.setRenderer(renderer);
surfaceView.getHolder().setFormat(PixelFormat.TRANSLUCENT);
surfaceView.setRenderMode(GLSurfaceView.RENDERMODE_CONTINUOUSLY);
addView(surfaceView);
}
use of android.opengl.GLSurfaceView in project android-gpuimage by CyberAgent.
the class ActivityCamera method onCreate.
@Override
public void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_camera);
((SeekBar) findViewById(R.id.seekBar)).setOnSeekBarChangeListener(this);
findViewById(R.id.button_choose_filter).setOnClickListener(this);
findViewById(R.id.button_capture).setOnClickListener(this);
mGPUImage = new GPUImage(this);
mGPUImage.setGLSurfaceView((GLSurfaceView) findViewById(R.id.surfaceView));
mCameraHelper = new CameraHelper(this);
mCamera = new CameraLoader();
View cameraSwitchView = findViewById(R.id.img_switch_camera);
cameraSwitchView.setOnClickListener(this);
if (!mCameraHelper.hasFrontCamera() || !mCameraHelper.hasBackCamera()) {
cameraSwitchView.setVisibility(View.GONE);
}
}
Aggregations