File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
library/src/main/java/jp/co/cyberagent/android/gpuimage Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -67,6 +67,7 @@ public enum ScaleType {CENTER_INSIDE, CENTER_CROP}
67
67
private GPUImageFilter filter ;
68
68
private Bitmap currentBitmap ;
69
69
private ScaleType scaleType = ScaleType .CENTER_CROP ;
70
+ private int scaleWidth , scaleHeight ;
70
71
71
72
/**
72
73
* Instantiates a new GPUImage object.
@@ -251,6 +252,18 @@ public void setScaleType(ScaleType scaleType) {
251
252
requestRender ();
252
253
}
253
254
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
+
254
267
/**
255
268
* Sets the rotation of the displayed image.
256
269
*
@@ -729,6 +742,8 @@ private int[] getScaleSize(int width, int height) {
729
742
newWidth = outputWidth ;
730
743
newHeight = (newWidth / width ) * height ;
731
744
}
745
+ scaleWidth = Math .round (newWidth );
746
+ scaleHeight = Math .round (newHeight );
732
747
return new int []{Math .round (newWidth ), Math .round (newHeight )};
733
748
}
734
749
You can’t perform that action at this time.
0 commit comments