processBitmap

fun <P : ImageProcessor> P.processBitmap(connectedInput: ImageProcessor.Input, bitmap: Bitmap, outputRotationDegrees: Int = 0, timeout: Long = 10, timeoutUnit: TimeUnit = TimeUnit.SECONDS, mirrorHorizontally: Boolean = false, mirrorVertically: Boolean = false, allowDownscaling: Boolean = true): Bitmap?

If connectedInput is currently connected to this processor, process the bitmap and output the result as Bitmap. Source bitmap will be cropped to match connectedInput aspect ratio if they are different. Source bitmap will be rotated on ImageProcessor.Input.rotationDegrees of the connectedInput during processing. outputRotationDegrees can be used to apply an additional rotation to the resulting Bitmap. This method is a blocking operation therefore it is expected to run on a worker thread.

Return

processed bitmap as Bitmap or null in case of timeout exceeded, failure occurred or the provided parameters are not supported. Returns the source bitmap if there is no effect applied and source bitmap should not be transformed.

Since

1.3.0

Parameters

outputRotationDegrees

defines the natural orientation of the result Bitmap in relation to a device that is rendering it. If outputRotationDegrees is Int.MIN_VALUE (the default) then implementation is expected to use the current device rotation to determine of the result Bitmap.

mirrorHorizontally

defines if the bitmap should be mirrored horizontally before processing.

mirrorVertically

defines if the bitmap should be mirrored vertically before processing.

allowDownscaling

defines if source bitmap can be downscaled before processing to optimize performance and reduce memory usage. If allowDownscaling is False, then full size bitmap will be processed that may cause issues with rendered textures and/or graphics memory.