File tree Expand file tree Collapse file tree
library/src/main/java/jp/co/cyberagent/android/gpuimage Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -67,6 +67,7 @@ public enum ScaleType {CENTER_INSIDE, CENTER_CROP}
6767 private GPUImageFilter filter ;
6868 private Bitmap currentBitmap ;
6969 private ScaleType scaleType = ScaleType .CENTER_CROP ;
70+ private int scaleWidth , scaleHeight ;
7071
7172 /**
7273 * Instantiates a new GPUImage object.
@@ -251,6 +252,18 @@ public void setScaleType(ScaleType scaleType) {
251252 requestRender ();
252253 }
253254
255+ /**
256+ * This gets the size of the image. This makes it easier to adjust
257+ * the size of your imagePreview to the the size of the scaled image.
258+ *
259+ * @param width The bitmap width
260+ * @param height The bitmap height
261+ * @return array with width and height of bitmap image
262+ */
263+ public int [] getScaleSize () {
264+ return new int [] {scaleWidth , scaleHeight };
265+ }
266+
254267 /**
255268 * Sets the rotation of the displayed image.
256269 *
@@ -729,6 +742,8 @@ private int[] getScaleSize(int width, int height) {
729742 newWidth = outputWidth ;
730743 newHeight = (newWidth / width ) * height ;
731744 }
745+ scaleWidth = Math .round (newWidth );
746+ scaleHeight = Math .round (newHeight );
732747 return new int []{Math .round (newWidth ), Math .round (newHeight )};
733748 }
734749
You can’t perform that action at this time.
0 commit comments