init

fun init(activity: ComponentActivity)

For use outside composable functions.

Initializes the capture class with a copy of the activity it will be using to measure the screen against.

This function is broken out separately from the constructor so that you can use the ScreenCapture class itself inside of DI framework, like Hilt, and later set up the capturing capabilities in the onCreate() function of a ComponentActivity.

Parameters

activity

An activity which will be used to measure the screen.