use of android.opengl.GLSurfaceView in project android-gif-drawable by koral--.
the class GifTexImage2DFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
if (!isOpenGLES2Supported()) {
Snackbar.make(container, R.string.gles2_not_supported, Snackbar.LENGTH_LONG).show();
return null;
}
try {
GifOptions options = new GifOptions();
options.setInIsOpaque(true);
mGifTexImage2D = new GifTexImage2D(new InputSource.ResourcesSource(getResources(), R.drawable.anim_flag_chile), options);
} catch (IOException e) {
throw new IllegalStateException(e);
}
final GLSurfaceView view = (GLSurfaceView) inflater.inflate(R.layout.opengl, container, false);
view.setEGLContextClientVersion(2);
view.setRenderer(new Renderer());
view.getHolder().setFixedSize(mGifTexImage2D.getWidth(), mGifTexImage2D.getHeight());
mGifTexImage2D.startDecoderThread();
return view;
}
use of android.opengl.GLSurfaceView in project android-flip by openaphid.
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-gpuimage by CyberAgent.
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 OnPictureSavedListener() {
@Override
public void onPictureSaved(final Uri uri) {
pictureFile.delete();
camera.startPreview();
view.setRenderMode(GLSurfaceView.RENDERMODE_CONTINUOUSLY);
}
});
}
});
}
use of android.opengl.GLSurfaceView in project platform_frameworks_base by android.
the class DemoPresentation method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
// Be sure to call the super class.
super.onCreate(savedInstanceState);
// Get the resources for the context of the presentation.
// Notice that we are getting the resources from the context of the presentation.
Resources r = getContext().getResources();
// Inflate the layout.
setContentView(R.layout.presentation_content);
// Set up the surface view for visual interest.
mRenderer = new CubeRenderer(false);
mSurfaceView = (GLSurfaceView) findViewById(R.id.surface_view);
mSurfaceView.setRenderer(mRenderer);
// Add a button.
mExplodeButton = (Button) findViewById(R.id.explode_button);
mExplodeButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mRenderer.explode();
}
});
}
use of android.opengl.GLSurfaceView in project android-gpuimage-ndkbuild-sample by mugku.
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