android-gpuimage-plus
android-gpuimage-plus copied to clipboard
make ImageGLSurfaceview wrap it contnet
How to make ImageGLSurfaceview wrap it content, i don't want the black space when image ratio not equal to glsurfaceview ratio, i don't want to use DISPLAY_SCALE_TO_FILL or DISPLAY_ASPECT_FILL or using ImageView instead Thanks sorry for my English !!
See https://github.com/wysaid/android-gpuimage-plus/blob/master/library/src/main/java/org/wysaid/view/CameraGLSurfaceView.java#L115 set to true
it is CameraGLSurfaceView, can i using it instead ImageGLSurfaceView
Although it's too late, I've managed to solve this issue by setting a custom measure in ImageGLSufaceView
based on the Bitmap
measure, as following :
public void initializeView(Bitmap src, int mWidth, int mHeight) {
mDensity = getResources().getDisplayMetrics().density;
viewWidth = getResources().getDisplayMetrics().widthPixels;
viewHeight = getResources().getDisplayMetrics().heightPixels;
viewRatio = (double) viewHeight / (double) viewWidth;
bmRatio = (double) (mHeight) / (double) (mWidth);
if (bmRatio < viewRatio) {
bmWidth = viewWidth;
bmHeight = (int) (((double) viewWidth) * ((double) (mHeight) / (double) (mWidth)));
} else {
bmHeight = viewHeight;
bmWidth = (int) (((double) viewHeight) * ((double) (mWidth) / (double) (mHeight)));
}
final FrameLayout.LayoutParams lparams = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT);
lparams.gravity = Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL;
lparams.width = bmWidth;
lparams.height = bmHeight;
imgPhotoEdit.setLayoutParams(lparams);
imgPhotoEdit.setImageBitmap(src);
}
and just call it , initializeView(srcBitmap,srcBitmap.getWidth,srcBitmap.getHeight);