getScaleFactor

abstract fun getScaleFactor(    sourceWidth: Int,     sourceHeight: Int,     requestedWidth: Int,     requestedHeight: Int): Float

Returns a float (0, +infinity) indicating a scale factor to apply to the source width and height when displayed in the requested width and height.

The returned scale factor will be split into a power of two sample size applied via inSampleSize and a float scale factor applied after downsampling via inTargetDensity and inDensity. Because of rounding errors the scale factor may not be applied precisely.

The float scaling factor will only be applied on KitKat+. Prior to KitKat, only the power of two downsampling will be applied.

Parameters

sourceWidth

The width in pixels of the image to be downsampled.

sourceHeight

The height in pixels of the image to be downsampled.

requestedWidth

The width in pixels of the view/target the image will be displayed in.

requestedHeight

The height in pixels of the view/target the image will be displayed in.