我创建了一些自定义元素,我想以编程方式将它们放置在右上角(n顶部边缘的m像素和右边缘的像素).因此我需要获得屏幕宽度和屏幕高度,然后设置位置:
int px = screenWidth - m;
int py = screenHeight - n;
Run Code Online (Sandbox Code Playgroud)
如何获得screenWidth并screenHeight在主要活动?
如何裁剪位图图像?这是我的问题,我已尝试使用意图的一些概念,但仍然失败..
我有一个我要裁剪的位图图像!!
这是代码:
Intent intent = new Intent("com.android.camera.action.CROP");
intent.setClassName("com.android.camera", "com.android.camera.CropImage");
File file = new File(filePath);
Uri uri = Uri.fromFile(file);
intent.setData(uri);
intent.putExtra("crop", "true");
intent.putExtra("aspectX", 1);
intent.putExtra("aspectY", 1);
intent.putExtra("outputX", 96);
intent.putExtra("outputY", 96);
intent.putExtra("noFaceDetection", true);
intent.putExtra("return-data", true);
startActivityForResult(intent, REQUEST_CROP_ICON);
Run Code Online (Sandbox Code Playgroud)
@Thanks可以帮助我吗?
我需要能够GLSurfaceView在特定时刻捕捉到某个时刻的图像.我有以下代码:
relative.setDrawingCacheEnabled(true);
screenshot = Bitmap.createBitmap(relative.getDrawingCache());
relative.setDrawingCacheEnabled(false);
Log.v(TAG, "Screenshot height: " + screenshot.getHeight());
image.setImageBitmap(screenshot);
Run Code Online (Sandbox Code Playgroud)
该GLSurfaceView包含内的RelativeLayout,但我也尝试它直接使用GLSurfaceView,试图捕捉图像.有了这个,我认为屏幕捕获透明图像,即没有任何东西.任何帮助将不胜感激.
我知道这是一个微不足道的问题,但从glGet()文档开始我还没有找到任何有用的信息.我正在使用我的纹理作为精灵,因此以纹素/像素跟踪它们的大小至关重要.
当我创建纹理时,glTexImage2D()我需要将像素数据数组的大小传递给它.但OpenGL是将它存储在任何地方,还是我必须在我的代码中跟踪它们?(这感觉别扭,因为客户机代码仍然能够覆盖与所述纹理glTexImage2D()/ glTexSubImage2D()/ glCopyTexImage2D()等未通话时相应的变化的大小,从而导致视觉失真.)